Next
Prev
Dataset 1
Dataset 2
Dataset 3

The chart data (dataset) can be changed dynamically (e.g. change the dataset by clicking the button) by calling setData().

This sample is to show how to change the dataset when users click the button. If users click the button, the JavaScript function which sets the appropriate dataset is called.

<div class="button" onclick="changeData1()">Dataset 1</div>
<div class="button" onclick="changeData2()">Dataset 2</div>
<div class="button" onclick="changeData3()">Dataset 3</div>
					
function changeData1()
{
  document.getElementById("chart1").setData(chartData1);
}

function changeData2()
{
  document.getElementById("chart1").setData(chartData2);
}

function changeData3()
{
  document.getElementById("chart1").setDataURL(dataURL);
}

© 2017 KoolChart. All rights reserved.