線形圖
站在用戶的角度思考問題,與客戶深入溝通,找到尼瀘西網(wǎng)站設計與尼瀘西網(wǎng)站推廣的解決方案,憑借多年的經(jīng)驗,讓設計與互聯(lián)網(wǎng)技術結合,創(chuàng)造個性化、用戶體驗好的作品,建站類型包括:成都網(wǎng)站設計、成都網(wǎng)站制作、企業(yè)官網(wǎng)、英文網(wǎng)站、手機端網(wǎng)站、網(wǎng)站推廣、主機域名、雅安服務器托管、企業(yè)郵箱。業(yè)務覆蓋尼瀘西地區(qū)。
前臺代碼:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Line.aspx.cs" Inherits="hhh.Line" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<script src="Scripts/jquery.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(function () {
var chart;
$(document).ready(function () {
chart = new Highcharts.Chart({
chart: {
renderTo: 'container',
type: 'line'
},
title: {
text: '測試數(shù)據(jù)'
},
xAxis: {
categories: [<%=str %>]
},
yAxis: {
title: {
text: '單位/萬元'
}
},
tooltip: {
formatter: function () {
return '<b>' + this.series.name + '</b><br/>' +
this.x + ': ' + this.y + '萬元'+'<br/>所占百分比:'+changeTwoDecimal_f((this.y/<%=allcount %>)*100)+'%';
}
},
plotOptions: {
line: {
dataLabels: {
enabled: true
},
enableMouseTracking: true
}
},
series: [{
name:'測試數(shù)據(jù)',
data: [<%=strdata %>]
}]
});
});
changeTwoDecimal_f = function (floatvar) {
var f_x = parseFloat(floatvar);
if (isNaN(f_x)) {
alert('function:changeTwoDecimal->parameter error');
return false;
}
var f_x = Math.round(floatvar * 100) / 100;
var s_x = f_x.toString();
var pos_decimal = s_x.indexOf('.');
if (pos_decimal < 0) {
pos_decimal = s_x.length;
s_x += '.';
}
while (s_x.length <= pos_decimal + 2) {
s_x += '0';
}
return s_x;
}
})
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<script src="Scripts/highcharts.js" type="text/javascript"></script>
<script src="Scripts/exporting.js" type="text/javascript"></script>
<div id="container" style="min-width: 400px; height: 400px; margin: 0 auto"></div>
</div>
</form>
</body>
</html>
后臺代碼:
public string str = "";//文本
public string strdata = "";//數(shù)據(jù)
public double allcount = 0;
protected void Page_Load(object sender, EventArgs e)
{
LoadData();
}
protected void LoadData()
{
XmlDocument myDoc = new XmlDocument();
myDoc.Load(Server.MapPath("DB_51aspx.xml"));
XmlNode xn = myDoc.SelectSingleNode("//VoteInfo[ID='2']");//讀取數(shù)據(jù)源
XmlNodeList xnl = xn.SelectNodes("Item");
double AllCount = 0;//總數(shù)
for (int i = 0; i < xnl.Count; i++)
{
AllCount += Convert.ToSingle(xnl.Item(i).SelectSingleNode("Count").InnerText);
}
allcount = AllCount;
for (int i = 0; i < xnl.Count; i++)
{
XmlNode xn0 = xnl.Item(i);
strdata += xn0.SelectSingleNode("Count").InnerText+ ",";
str += "\'" + xn0.SelectSingleNode("Title").InnerText + "\'" + ",";
}
strdata = strdata.Remove(strdata.Length-1,1);
str = str.Remove(str.Length-1,1);
}
效果圖展示:
網(wǎng)頁名稱:js圖表控件:highcharts的應用(三)
文章起源:http://jinyejixie.com/article0/iehjio.html
成都網(wǎng)站建設公司_創(chuàng)新互聯(lián),為您提供品牌網(wǎng)站建設、靜態(tài)網(wǎng)站、外貿(mào)網(wǎng)站建設、外貿(mào)建站、建站公司、網(wǎng)站制作
聲明:本網(wǎng)站發(fā)布的內容(圖片、視頻和文字)以用戶投稿、用戶轉載內容為主,如果涉及侵權請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內容未經(jīng)允許不得轉載,或轉載時需注明來源: 創(chuàng)新互聯(lián)