[Chartjs]-Line Chart x-Axis datapoints with Strings

0👍

Has I was saying, this might be a good solution for your problem.
I’ve made a simple example demonstrating a multiline chart with strings at xAxis:

https://codepen.io/anon/pen/NmVgLO

Here you can see how did I build part of the chart “data”

var data = {
     labels:["2015", "2016", "test"],
     datasets:[
     {
         label: "Data1",
         fill: false,
         lineTension: 0.1,
         borderColor: "red",
         pointHoverBackgroundColor: "yellow",
         data: [
            {x:"2015",y:5},
            {x:"test",y:10}
         ]
      },
      {
         label: "Data2",
         fill: false,
         lineTension: 0.1,
         borderColor: "blue",
         borderCapStyle: 'square',
         pointHoverBackgroundColor: "yellow",
         data: [
             {x:"2015",y:5},
             {x:"2016",y:10}
         ],
         spanGaps: true,
      }
   ]
};

Leave a comment