Skip to content

Instantly share code, notes, and snippets.

@biscuitvile
Created March 13, 2012 16:03
Show Gist options
  • Save biscuitvile/2029592 to your computer and use it in GitHub Desktop.
Save biscuitvile/2029592 to your computer and use it in GitHub Desktop.
Highchart updating
var chart = new Highcharts.Chart({
chart: {
renderTo: 'container'
},
xAxis: {
categories: ['Category 1', 'Category 2']
},
plotOptions: {
series: {
cursor: 'pointer',
point: {
events: {
click: function(){
hs.htmlExpand(null, {
pageOrigin: {
x: this.pageX,
y: this.pageY
},
headingText: this.series.name,
maincontentText: "Current value is " + this.y + " <span style='visibility:hidden;' class='dynamic-index'>" + this.x + "</span><br />New value: <input class='dynamic-input' type='text' /><input class='dynamic-button' type='submit' value='Submit!' />",
width: 200
});
}
},
},
},
},
series: [{
data: [29, 106]
}]
});
$('.dynamic-button').live('click', function(){
val = parseInt($('.dynamic-input:visible:first').val());
index = parseInt($('.dynamic-index:visible:first').text());
hs.close();
chart.series[0].data[index].update(val);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment