Next
Prev
Default
2011 2012 2013
Brazil 2.7 1 2.5
Russia 4.3 3.4 1.3
India 6.6 4.7 5
China 9.3 7.7 7.7
South Africa 3.6 2.5 1.9

To create a chart, the chart layout and the chart data (dataset) must be set by calling setLayout() (or setLayoutUR()) and setData() (or setDataURL()). The XML format is the only valid format of the layout, and the XML, Array, JSON and CSV formats are supported for the format of the chart data (dataset). Both layout and data can be passed to the functions as an argument of the string value (setLayout(), setData()) or as an argument of the URL location of the file (setLayoutURL(), setDataURL()).

This sample demonstrates how to set the string value to the layout and to set the Array data converted from the HTML table above.

var chartData = tableDataToArray("table_data", "Country",  "vertical");
document.getElementById(id).setLayout(layoutStr);
document.getElementById(id).setData(chartData);

function tableDataToArray(id, categoryField, direction)
{
  return KoolChart.tableToArray(id, categoryField, direction);
}

© 2017 KoolChart. All rights reserved.