Next
Prev
Layout & Dataset 1
Layout & Dataset 2

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

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

<div class="button" onclick="changeLayoutDataset1()">Layout & Dataset 1</div>
<div class="button" onclick="changeLayoutDataset1()">Layout & Dataset 2</div>
					
function changeLayoutDataset1()
{
  document.getElementById("chart1").setLayoutURL(layoutURL1);
  document.getElementById("chart1").setDataURL(dataURL);
}

function changeLayoutDataset2()
{
  document.getElementById("chart1").setLayoutURL(layoutURL2);
  document.getElementById("chart1").setData(chartData);
}

© 2017 KoolChart. All rights reserved.