91超碰碰碰碰久久久久久综合_超碰av人澡人澡人澡人澡人掠_国产黄大片在线观看画质优化_txt小说免费全本

溫馨提示×

溫馨提示×

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

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

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

临安市| 桂东县| 星子县| 灵台县| 鄂伦春自治旗| 古浪县| 祁东县| 定陶县| 垣曲县| 静宁县| 运城市| 广水市| 西藏| 连江县| 西畴县| 营口市| 安宁市| 赣榆县| 泰和县| 威信县| 环江| 屯门区| 崇文区| 通渭县| 丹凤县| 长宁区| 顺义区| 城口县| 中山市| 尤溪县| 大田县| 阿拉善盟| 兴业县| 新安县| 阿拉尔市| 留坝县| 东山县| 会东县| 宁明县| 左权县| 昭觉县|