Reputation: 1057
High Charts API http://api.highcharts.com/highcharts#Series.setData()
javascript
....
$('#button').click(function() {
chart.series[0].setData( //How can I use this method to add the data?
['Firefox', 55.0],
['IE', 16.8],
['Safari', 7.5],
['Opera', 7.2],
['Others', 0.7]
);
See full code and example on jfiddle http://jsfiddle.net/bK7fh/
Upvotes: 1
Views: 11581
Reputation: 2071
You forgot that set data takes an array of data, not lots of arrays.
Here is an example:
$('#button').click(function () {
chart.series[0].setData([
['Firefox', 55.0],
['IE', 16.8],
['Safari', 7.5],
['Opera', 7.2],
['Others', 0.7]
]);
});
Here is your fiddle, and working: http://jsfiddle.net/bK7fh/2/
Upvotes: 6