![](/img/trans.png)
[英]Highcharts: How to pass the color parameter with data and dates to the bar chart?
[英]Highcharts how to pass data from server into chart
这是示例Highcharts的代码:
$(document).ready(function () {
$(function () {
$('#container').highcharts({
chart: {
type: 'column',
margin: 75,
options3d: {
enabled: true,
alpha: 10,
beta: 25,
depth: 70
}
},
title: {
text: '@Model.FirstName'
},
plotOptions: {
column: {
depth: 25
}
},
xAxis: {
categories: Highcharts.getOptions().lang.shortMonths
},
yAxis: {
title: {
text: null
}
},
series: [{
name: 'Sales',
data: [2, 3, null, 4, 0, 5, 1, 4, 6, 3]
}],
credits: {
enabled: false
},
});
});
});
我想传递服务器上的系列“数据:[2、3,null,4、0、5、1、4、6、3]”和类别:“ Highcharts.getOptions()。lang.shortMonths”。 我该怎么做?
您可以通过Ajax请求数据并调用chart.addSeries
function requestData() {
$.ajax({
url: 'myserverurl',
type: "GET",
dataType: "json",
success: function(data) {
chart.addSeries({
name: "somename",
data: data.mydata
});
},
cache: false
});
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.