Home Forums Chart Support How to plot multiple line graphs on same Chart Reply To: How to plot multiple line graphs on same Chart

#26271

@welshp2,

You can render multiple line series in a single chart by adding dataSeries elements to data Array. Please take a look at the below code snippet for the same.

data: [
  {        
	type: "line",
	dataPoints: [
	  { x: 10, y: 21 },
	  { x: 20, y: 25},
	  { x: 30, y: 20 },
	  { x: 40, y: 25 },
	  { x: 50, y: 27 },
	  { x: 60, y: 28 },
	  { x: 70, y: 28 },
	  { x: 80, y: 24 },
	  { x: 90, y: 26}
	]
  },
  {        
	type: "line",
	dataPoints: [
   	  { x: 10, y: 31 },
   	  { x: 20, y: 35},
   	  { x: 30, y: 30 },
   	  { x: 40, y: 35 },
   	  { x: 50, y: 35 },
   	  { x: 60, y: 38 },
   	  { x: 70, y: 38 },
   	  { x: 80, y: 34 },
   	  { x: 90, y: 44}
	]
   },
   .
   .
   .
]

Also, please take a look at this documentation page for more information on creating multi-series chart.

Multi Series Line Chart

—-
Manoj Mohan
Team CanvasJS