Home forums Using CanvasJS Display two graph in the same chart Reply To: Display two graph in the same chart

#25670

@wemba,

Primary y-axes are drawn to the left and secondary to the right of the chart (incase of line, column, area charts). To have both the axes towards left of the chart, you will have to define multiple primary y-axis (Please refer code-snippet below) and assign dataSeries to them by setting axisYIndex. Please refer documentation for more info.

axisY: [{
      title: "Weight(kg)",
      suffix: "kg",
      lineColor: "#84A7D1",
      lineThickness: 5,
      interval: 1,
      intervalType: "number",
      includeZero: true,
      viewportMinimum: 0,
      viewportMaximum: 12
    },{
      title: "Height (cm)",
      suffix: "cm",
      lineColor: "#C24642",
      lineThickness: 5,
      interval: 5,
      minimum: 10,
      intervalType: "number",
      includeZero: false,
      viewportMinimum: 10,
      viewportMaximum: 80
 }]

In order to help us in understanding the issue, please follow below guideline:

Have a reproducible demo of your chart.

This one step can assure you a speedy response. Fork out our template JSFiddle and reproduce the chart at your end. Try to keep it to the bare minimum by removing unnecessary code.

From what we have observed, sometimes things get delayed mostly when we are not able to reproduce the issue or not able to understand the exact requirements.

Having a JSFiddle helps us in figuring out the issue and many a times we can just edit your code on JSFiddle to fix the issue right-away.


Vishwas R
Team CanvasJS