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;//设置轴的间隔

  • 相关阅读:
    GPU 版 TensorFlow failed to create cublas handle: CUBLAS_STATUS_ALLOC_FAILED
    Python -- 值转换为字符串的两种机制
    Python
    vim中注释多行python代码
    HTTP协议状态码详解(HTTP Status Code)
    关于Python报错:SyntaxError: Non-ASCII character 'xe5' in file的解决方法
    Linux如何查看进程、杀死进程、启动进程等常用命令
    vim 如何设置显示行号和缩进
    一、报错
    二、极光推送
  • 原文地址:https://www.cnblogs.com/lmy213/p/2599068.html
Copyright © 2011-2022 走看看