Home Forums Chart Support Show Multiseries Line Chart With Grouped Data Reply To: Show Multiseries Line Chart With Grouped Data

#14215

@Vishwas R,

Thanks for an instant reply.

var dataSeries = [];
var chart = new CanvasJS.Chart("chartContainer", {            
  title: {
    text: "MultiSeries Chart from JSON"
  },
  zoomEnabled: true, 
  toolTip: {
    animationEnabled: true,
    shared: true
  },
  data: dataSeries
});

$.when(
    $.getJSON("https://api.myjson.com/bins/k2rm5", function(result) {      
    		for(var i = 0; i < result.length; i++) {
        	var dps = [];
        	var label = result[i].label;
          var len = Object.keys(result[i]).length - 2;
          for(j = 1; j <= len; j++) {
          	dps.push({x: result[i].id, y: parseInt(result[i].allThreads) });
          }
          dataSeries.push({name: label, type: "line", dataPoints: dps});
        }
      })
    ).then(function() {
    chart.render();
 }); 

I changed the code a little bit and it’s close to my idea but when the column “Label” is repeated for example :”Login Page” instead of creating new dataSeries, Can I update new dataPoint for that Label.
Thanks

  • This reply was modified 7 years, 2 months ago by jonasbui1476.