4,819
社区成员
发帖
与我相关
我的任务
分享{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"}
]} //获取数据
$.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
}]
});
}
}
});
}