Highcharts 曲线图数据怎么转换显示多条曲线?
各位大神们救急了,求教了这个是取到的json字符串,要分别显示SD00001和SD00002两条曲线:
请问这个json字符串怎么转换放到下面这个是js中数组jsonyD1中去:
{RowCount:10,Rows:
[
{ "fcmpno":"SD00001","Ftotal": "118","years": "2013-01"},
{ "fcmpno":"SD00001","Ftotal": "180","years": "2013-02"},
{ "fcmpno":"SD00001","Ftotal": "140","years": "2013-03"},
{ "fcmpno":"SD00001","Ftotal": "110","years": "2013-04"},
{ "fcmpno":"SD00001","Ftotal": "280","years": "2013-05"},
{ "fcmpno":"SD00002","Ftotal": "163","years": "2013-01"},
{ "fcmpno":"SD00002","Ftotal": "200","years": "2013-02"},
{ "fcmpno":"SD00002","Ftotal": "150","years": "2013-03"},
{ "fcmpno":"SD00002","Ftotal": "278","years": "2013-04"},
{ "fcmpno":"SD00002","Ftotal": "169","years": "2013-05"}
]}请问这个json字符串怎么转换放到下面这个是js中数组jsonyD1中去:
//获取数据
$.ajax({ url: '../ashx/jpkh.ashx?action=jpkh_line_load',
cache: false,
async: false,
data:postbody,
success: function(data) {
var json = eval("(" + data + ")");
if(json.Rows.length == 0)
{
$$("container").hide();
alert("没有可显示数据");
}
if (json.Rows.length > 0) {
$$("container").show();
for (var i = 0; i < json.Rows.length; i++) {
var rows = json.Rows[i];
var Years = rows.years;
var Ftotal = rows.Ftotal;
jsonXData.push(Years); //赋值
jsonyD1.push(parseInt(Ftotal));
}
var chart;
chart = new Highcharts.Chart({
chart: {
renderTo: 'container', //放置图表的容器
plotBackgroundColor: null,
plotBorderWidth: null,
defaultSeriesType: 'line', //图表类型line, spline, area, areaspline, column, bar, pie , scatter
zoomType: 'xy'
},
title: {
text: '基盘客户曲线图'
},
xAxis: {//X轴数据
categories: jsonXData,
lineWidth: 2,
labels: {
rotation: -45, //字体倾斜
align: 'right',
style: { font: 'normal 13px 宋体' }
}
},
yAxis: {//Y轴显示文字
lineWidth: 2,
title: {
text: '客户数/人'
}
},
tooltip: {
formatter: function() {
return '<b>' + this.x + '</b><br/>' +
this.series.name + ': ' + Highcharts.numberFormat(this.y, 0);
}
},
plotOptions: {
column: {
dataLabels: {
enabled: true
},
enableMouseTracking: true//是否显示title
}
},
series: [{
name: '基盘客户曲线图',
data: jsonyD1
}]
});
}
}
});
}
...全文
相关推荐
highcharts加载多条曲线数据
NULL 博文链接:https://747017186.iteye.com/blog/2196221
highcharts曲线图
实时显示highcharts曲线图,读取本地txt文件
各种JS曲线图效果
各种各样的JS曲线图,很强大,自行下载看效果
Highcharts多个图表共用一个提示框,每个图表多条曲线
Highcharts多个图表共用一个提示框,每个图表多条曲线,下载后直接使用,如有问题欢迎咨询。
强大的highcharts插件曲线图(类似股票曲线图)
今天给大家推荐一款强大的highcharts插件,适合做一些曲线图之类的前端特效 请在火狐等高版本浏览器下浏览网站,低版本不支持


图表区
