zoukankan      html  css  js  c++  java
  • 生成图表

    <p>在ASP.Net自带的Chartlet生成图表。</p>

    1.添加程序集Chartlet.dll的引用(系统自带)否则找不到FanG命名空间

    2.在页面上注册命名空间:<%@ Register assembly="Chartlet" namespace="FanG" tagprefix="shit" %>,也可以在配置文件里配制。

    3.现在就可以写代码了<shit:Chartlet ID="Chartlet1" runat="server" Width="800px"  Height="500px" />

    前端Code:

     1 <%@ Register assembly="Chartlet" namespace="FanG" tagprefix="shit" %>
     2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
     3 
     4 <html xmlns="http://www.w3.org/1999/xhtml">
     5 <head runat="server">
     6     <title>JS正则验证文本框的值</title>
     7 </head>
     8 <body>
     9     <form id="form1" runat="server">
    10     <div align="center">
    11             <shit:Chartlet ID="Chartlet1" runat="server" Width="800px"  Height="500px" />
    12     </div>
    13     </form>
    14 </body>
    15 </html>
    View Code

    后台Code:

     1 if (!IsPostBack)
     2             {
     3                 string pass = "90";
     4                 string oppo = "54";
     5                 string aband = "66";
     6                 if (pass!="")
     7                 {
     8                     Chartlet1.Visible = true;
     9                     ArrayList ColorGuider = new ArrayList();
    10                     List<ArrayList> DataArray = new List<ArrayList>();
    11                     ArrayList XLabel = new ArrayList();
    12                     ColorGuider.Add("钢欣");
    13                     ColorGuider.Add("木材");
    14                     ColorGuider.Add("棉花");
    15                     XLabel.Add("Ariel");
    16                     string[] xlable = { pass, oppo, aband };
    17                     ArrayList item;
    18                     for (int i = 0; i < xlable.Count(); i++)
    19                     {
    20                         item = new ArrayList();
    21                         item.Add(xlable[i]);
    22                         DataArray.Add(item);
    23                     }
    24                     Chartlet1.ChartTitle.Text = "按Ariel统计";
    25                     Chartlet1.XLabels.UnitText = "2013年8月16日";
    26                     Chartlet1.YLabels.UnitText = "日销售量(kg)";
    27                     Chartlet1.InitializeData(DataArray.ToArray(), XLabel, ColorGuider);
    28                 }
    29                 else
    30                 {
    31                     
    32                     Chartlet1.Visible = false;
    33                 }
    34             }
    View Code

    效果:

  • 相关阅读:
    第二次作业循环语句
    c语言01次作业分支,顺序结构
    PAT 1027. Colors in Mars
    PAT 1026 Table Tennis
    PAT 1035 Password
    PAT 1038. Recover the Smallest Number
    PAT 1028 List Sorting (25)
    PAT 1041 Be Unique (20)
    PAT 1025 PAT Ranking
    1037. Magic Coupon
  • 原文地址:https://www.cnblogs.com/huangzhen22/p/3261279.html
Copyright © 2011-2022 走看看