addTo(String arrayName, Object options [, Number index = array.length])

Adds a new element of given type to the specified array. For example, it can be used to add new Axis to axisY array.


Parameters:
        propertyName: Name of the property
        options: Option for the new element
        index: Index of the array where the new element is to be added. Defaults to the length (end) of array.

Example: chart.addTo(“axisY”, { title: “Axis Y 2 Title” },2);

Note:
  • Chart should be rendered before you can use this method.
  • Chart renders automatically after addTo() operation.

var  chart =  new  CanvasJS.Chart("container",
{
     .
     .
     .
});
chart.render();

chart.addTo("axisY", {title: "Axis Y 2 Title"}, 2);
Try it Yourself by Editing the Code below.

  Also See:    



In order to provide better support,we have closed the comments and switched completely to our Forums.
If you have any questions, please feel free to ask in our forums.