zoukankan      html  css  js  c++  java
  • asp.net Chart 条形柱状图

    DataSet ds = DbHelperOleDb.Query(sbSql.ToString());//获取数据源

    Chart1.Series.Clear();//清空Series集合,自我感觉显示用例的时候清空下,重新添加容易控制
                foreach (DataRow item in ds.Tables[0].Rows)//添加设置用例图标
                {
                    Chart1.Series.Add(item["fund_code"].ToString());//添加一个Series
                    Chart1.Series[item["fund_code"].ToString()].Legend = "Legend1";//设置Legend的名称
                    Chart1.Series[item["fund_code"].ToString()].LegendText = item["fund_Name"].ToString() + " " + item["total_share"] + "亿份";//设置在用例中显示的内容
                    Chart1.Series[item["fund_code"].ToString()].Font = new Font("Microsoft Sans Serif", 6.75f);//设置用例的字体样式
                    Chart1.Series[item["fund_code"].ToString()].Palette = ChartColorPalette.BrightPastel;//设置调色板,
                    Chart1.Series[item["fund_code"].ToString()].ChartType = SeriesChartType.Bar;//设置图标显示的类型,此处为条形柱状图
                    Chart1.Series[item["fund_code"].ToString()].ToolTip = item["fund_Name"].ToString() + " #VAL 亿份";//工具提示
                }
                Chart1.Legends[0].Font = new Font("Microsoft Sans Serif", 6.75f);
                Chart1.DataSource = ds;//设置数据源
                if (Chart1.Series.Count > 0)
                {

          //绑定
                    Chart1.Series[0].XValueMember = "fund_code";
                    Chart1.Series[0].YValueMembers = "total_share";
                }
                Chart1.DataBind();
                Chart1.ChartAreas[0].AxisX.Interval = 1;//设置轴的间隔

  • 相关阅读:
    对 Unity 脚本生命周期的调研
    实现僵尸跑酷游戏的 UGUI 实践
    Unity UGUI 按钮绑定事件的 4 种方式
    virtualbox下给centos7固定ip
    linux新建文件夹
    centos7修改hostname
    linux下杀进程的方法
    virtualbox下最小化安装centos7后上网设置
    ubuntu下自动获取ip设置
    Caused by: org.springframework.beans.NotWritablePropertyException:
  • 原文地址:https://www.cnblogs.com/lmy213/p/2599068.html
Copyright © 2011-2022 走看看