亚洲激情专区-91九色丨porny丨老师-久久久久久久女国产乱让韩-国产精品午夜小视频观看

溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

js圖表控件:highcharts的應用(三)

發布時間:2020-03-30 22:33:35 來源:網絡 閱讀:427 作者:蒼穹斷雪 欄目:編程語言

    線形圖

    前臺代碼:

    <%@ 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: '測試數據'
                    },
                    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:'測試數據',
                        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 = "";//數據
        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']");//讀取數據源

            XmlNodeList xnl = xn.SelectNodes("Item");

            double AllCount = 0;//總數

            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);
        }

      效果圖展示:

      

js圖表控件:highcharts的應用(三)

 

向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI

台东市| 桦南县| 香河县| 邹城市| 云龙县| 洪湖市| 靖安县| 桦南县| 健康| 新兴县| 如东县| 剑川县| 小金县| 鄱阳县| 女性| 岳西县| 南投县| 新郑市| 南丹县| 敦煌市| 左云县| 瑞昌市| 桃江县| 濮阳市| 长寿区| 突泉县| 铅山县| 绥中县| 中西区| 嘉黎县| 惠州市| 玉山县| 大名县| 墨脱县| 潜山县| 嘉峪关市| 威远县| 富阳市| 龙山县| 肇州县| 娄底市|