set(String propertyName, Mixed value [, Boolean updateChart = true])

Sets the specified property of dataSeries.


Parameters:
        propertyName: Name of the property.
        value: value to be set on property.
        updateChart: When true, Updates the chart automatically after setting the value. Defaults to true.

Example : chart.data[0].set(“name”, “First Series” );

Note:
  • Chart should be rendered before you can use this method.
  • Because the chart updates each time set is called by default, it is recommended to disable auto update (set updateChart to false) till the last step if you have to set multiple properties. Otherwise it can affect performance because of repeated chart rendering. You can see an example below.

var  chart =  new  CanvasJS("container",
{
    .
    . 
    data:[{
         //dataSeries1
    },
    {
        //dataSeries2
    },
    .
    ],
    .
    .
});
chart.render();
chart.data[0].set("type", "doughnut");

Properties that can be set via this method

Please refer to DataSeries Element for complete list of properties that can be set via this method.

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.