我正在寻找一种基于 jQuery UI 滑块确定的值动态更新 Highcharts 的方法。我还不太熟悉 AJAX 或 JSON,所以我运气不佳。我试图让收入在给定的几个月内逐渐增加(例如,订阅服务)。为了方便起见,我把它放在了 jsFiddle http://jsfiddle.net/nlem33/Sbm2T/3/上。任何帮助将不胜感激,谢谢!
$(function () {
var chart;
$(document).ready(function() {
chart = new Highcharts.Chart({
chart: {
renderTo: 'container',
backgroundColor: null,
type: 'area'
},
title: {
text: ''
},
subtitle: {
text: ''
},
xAxis: {
categories: ['1', '2', '3', '4', '5', '6',],
tickmarkPlacement: 'on',
title: {
text: 'months'
}
},
yAxis: {
title: {
text: '$(thousands)'
},
labels: {
formatter: function() {
return this.value / 1000;
}
}
},
tooltip: {
formatter: function() {
return ''+
this.x +': '+ Highcharts.numberFormat(this.y, 0, ',') +' hundred';
}
},
plotOptions: {
area: {
stacking: 'normal',
lineColor: '#666666',
lineWidth: 1,
marker: {
lineWidth: 1,
lineColor: '#666666'
}
}
},
legend:{
align: 'bottom',
x: 275,
borderColor: null
},
credits: {
enabled: false
},
series: [{
name: 'Revenue',
data: [100, 130, 170, 220, 350, 580]
}, {
name: 'Cost',
data: [100, 120, 140, 160, 180, 200]
}]
});
});