首页 新闻 会员 周边 捐助

.net获取折线图

0
悬赏园豆:5 [已关闭问题] 关闭于 2017-01-03 14:51

从后台获取数据,后台给我传的数据是这样的

[{ id: '', title: '', xitem: '', ytext: '', unit: '', data: '' }]
data格式:Json Object [{name:'',data:''}]

 

我界面是这么写的,请问哪里不对,或者应该怎么写,求大神指导

@{
Layout = null;
}

<!DOCTYPE html>

<html>
<head>
<meta name="viewport" content="width=device-width" />
<title>首页 车流量</title>
<link href="~/Quote/jquery.bootgrid-1.3.1/bootstrap.min.css" rel="stylesheet" />
<script src="~/Scripts/jquery-1.8.3.min.js"></script>
<script src="~/Quote/highcharts/highcharts.js"></script>
<script src="~/Quote/highcharts/modules/exporting.js"></script>
</head>
<body>
<input type="hidden" id="UIID" value="@ViewData["UIID"]" />
<div id="Content">
<div id="CheLiuLiang"></div>
</div>
<script type="text/javascript">
$(function () {
GetCarCount();
})
//获取车流量数据
function GetCarCount() {
//ChartInit("CheLiuLiang", "车流量", xdate, "数量", "辆", Data);
$.ajax({
url: "/Base/DataSel",
type: "post",
data: {
Data: "[]",
UIID: $("#UIID").val(),
CZID: "ChaXun"
},
success: function (msg) {

}
})
}
//初始化图标 id-存放位置 title-图表标题 xitem-横坐标项 ytext-纵坐标标题 unit-度量衡单位 data-数据
function ChartInit(id, title, xitem, ytext, unit, data) {
$('#' + id).highcharts({
chart: {//默认折线图 column:柱状图
//type: 'column'
},
title: {//标题
text: title,
x: -20 //center
},
subtitle: {//子标题
//text: '来源: WorldClimate.com',
//x: -20
},
xAxis: {//横坐标
categories: xitem
},
yAxis: {//纵坐标
title: {
text: '数量 (' + unit + ')'
},
plotLines: [{
value: 0,
width: 1,
color: '#808080'
}]
},
tooltip: {//数据点提示框
valueSuffix: unit
},
legend: {//图例
layout: 'vertical',
align: 'right',
verticalAlign: 'middle',
borderWidth: 0
},
series: data
});
}
</script>
</body>
</html>

haodejiuzheyangba的主页 haodejiuzheyangba | 初学一级 | 园豆:142
提问于:2016-12-29 10:31
< >
分享
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册