chart.update()

Method Definition: update (Object config, Boolean discardOldConfig)
Parent: Chart
Description: update() function used to update more than one chart-properties at one short

chart.update() is used to update many parameters/properties/setting of Chart.

Also note that chart.render() must be called to initiate the internal drawing of the Chart. render() function must be called after updating any parameter of Chart or any chart-element using setProperty() or update() function.

Function Parameters/Arguments
config
You update entire chart or selective properties of chart by passing chart object properties in a JSON object.
Note: If you want to update only data-points of the chart at realtime then its always recommended to use setData() function to achieve best performance.
discardOldConfig
Default Value: false
Second parameter of the function is a Boolean value. Set forceDiscardOldConfig as true if you want to discard old config completely. Set it to false if you just update few properties without affecting other existing properties.

Pseudo code
                      var chart = new Cosfire.Chart("chart-container", {....});

// Set Data nothing but setting one or more DataSeries having DataPoints in each DataSeries
chart.setDate([...]);

chart.render(function onRenderCompleted() {
  // Once the chart rendered you can update the chart farther

  // Update many properties at one short
  chart.update({...}, false);

  // Now call render again to redraw the chart
  chart.render();
}));                 
                  
In the example below background of the Chart is getting updated in every 1 second.