private void Form1_Load(object sender, EventArgs e)
 {
            string sql1 = "select  类别,count(*) as  发文数量 from 条目表 where 时间 like '%" + DateTime.Now.ToShortDateString() + "%'  group by 类别 order by count(*) desc";
            OleDbCommand cmd1 = new OleDbCommand(sql1, conn);
            conn.Open();
            OleDbDataReader dr1= cmd1.ExecuteReader();
            chart1.Series["今日发文量"].Points.DataBindXY(dr1, "类别", dr1, "发文数量");
            dr1.Close();
            conn.Close();

string d_before = DateTime.Now.ToShortDateString();
            string w_before = DateTime.Now.AddDays(-6).ToShortDateString();

string sql2 = "select  类别,count(*) as  发文数量 from 条目表 where 时间 between #" + w_before + "# and #" + d_before + "#  group by  类别 order by count(*) desc";
            OleDbCommand cmd2 = new OleDbCommand(sql2, conn);
            conn.Open();
            OleDbDataReader dr2 = cmd2.ExecuteReader();
            chart1.Series["最近七天发文量"].Points.DataBindXY(dr2, "类别", dr2, "发文数量");
            dr2.Close();
            conn.Close();

string dd_before = DateTime.Now.AddDays(-1).ToShortDateString();
            string sql3 = "select  类别,count(*) as  发文数量 from 条目表 where 时间 like '%" + dd_before + "%'  group by 类别 order by count(*) desc";
            OleDbCommand cmd3 = new OleDbCommand(sql3, conn);
            conn.Open();
            OleDbDataReader dr3 = cmd3.ExecuteReader();
            chart1.Series["昨日发文量"].Points.DataBindXY(dr3, "类别", dr3, "发文数量");
            dr3.Close();
            conn.Close();

DateTime startMonth = DateTime.Now.AddDays(1 - DateTime.Now.Day);
            string sstartMonth = startMonth.ToShortDateString();
            string endMonth = startMonth.AddMonths(1).AddDays(-1).ToShortDateString();     //本月月末

string sql4 = "select  类别,count(*) as  发文数量 from 条目表 where 时间 between #" + sstartMonth + "# and #" + endMonth + "#    group by 类别 order by count(*) desc";
            OleDbCommand cmd4 = new OleDbCommand(sql4, conn);
            conn.Open();
            OleDbDataReader dr4 = cmd4.ExecuteReader();
            chart1.Series["月发文量"].Points.DataBindXY(dr4, "类别", dr4, "发文数量");
            dr4.Close();
            conn.Close();
  }

MS Chart 条状图【转】的更多相关文章

  1. HighCharts之2D堆条状图

    HighCharts之2D堆条状图 1.HighCharts之2D堆条状图源码 StackedBar.html: <!DOCTYPE html> <html> <head ...

  2. HighCharts之2D条状图

    HighCharts之2D条状图 1.HighCharts之2D条状图源码 bar.html: <!DOCTYPE html> <html> <head> < ...

  3. Excel 2010高级应用-条状图(五)

    Excel 2010高级应用-条状图(五) 基本操作如下: 1.新建一个Excel空白文档,并命名条状图 2.单击"插入",找到条状图的样图 3.选择其中一种类型的条状图样图,在空 ...

  4. Flex实现双轴条状图

    1.问题背景 一般的,柱状图可以实现双轴图,但是如何实现双轴条状图? 2.实现实例 <?xml version="1.0" encoding="utf-8" ...

  5. Iocomp控件教程之Pie Chart——饼状图控件

    Pie Chart--饼状图控件(Pie Chart)以饼状图形式显示每一个项目内容所占的百分比比重.在设计时.能够使用属性编辑器加入或者移除项目以及更改属性值.在执行时.使用AddItem,Remo ...

  6. python中matplotlib绘图封装类之折线图、条状图、圆饼图

    DrawHelper.py封装类源码: import matplotlib import matplotlib.pyplot as plt import numpy as np class DrawH ...

  7. 利用js来画图形(例如:条状图,圆饼图等)

    背景:java开发的过程中,需要对数据进行可视化,这样方便客户理解此时的数据状态 语言:java,js,window7,echarts包文件 sample的例子下面的参照 https://www.ec ...

  8. maplotlib python 玩具绘图 横向纵向条状图

    from matplotlib import font_manager#解决zh-han图形汉字乱码 my_font = font_manager.FontProperties(fname=" ...

  9. Wpf/Wp/Silverlight-Chart图表控件:柱状图、饼状图等使用汇总

    链接:http://www.cnblogs.com/jimson/archive/2010/06/21/Wpfchat.html http://www.cnblogs.com/mgen/p/32361 ...

随机推荐

  1. /* font-awesome-4.7.0的应用*/

    <!DOCTYPE html> /* font-awesome-4.7.0的应用*/ <html lang="en"> <head> <m ...

  2. shell script-判断式

    test判断式 看下面: test -e /opt/a.txt && echo "exist" || echo "not exist" 判断 / ...

  3. Learning Python 012 函数式编程 1 高阶函数

    Python 函数式编程 1 高阶函数 高阶函数 Q:什么是高阶函数? A:一个函数接收另一个函数作为参数,这种函数就称之为高阶函数. 简单举个例子: def add(x, y, f): return ...

  4. Entity Framework Code-First(10.1):EntityTypeConfiguration

    EntityTypeConfiguration Class in Code-First: Before we start to configure using Fluent API, let's se ...

  5. 在Ionic Framework 退出APP

    使用以下代码: ionic.Platform.exitApp(); 在控制器中增加: $scope.Quit = function(){ ionic.Platform.exitApp(); }

  6. Loadrunner监控服务器资源

    LoadRunner 加载监听服务器的步骤如下: 1.在 LoadRunner Controller 下,将工作面板切换到 Run状态,Available Graphs 栏 ,System Resou ...

  7. HBase高可用原理与实践

    前言 前段时间有套线上HBase出了点小问题,导致该套HBase集群服务停止了2个小时,从而造成使用该套HBase作为数据存储的应用也出现了服务异常.在排查问题之余,我们不禁也在思考,以后再出现类似的 ...

  8. ProtoBuf练习(四)

    其中一个类型 protobuf语言的oneof字段类型相当于C++语言的联合数据类型 工程目录结构 $ ls proto/ sample_oneof.proto proto文件 $ cat proto ...

  9. flask-sqlalchemy中 backref lazy的参数实例解释和选择

    官方文档:http://docs.sqlalchemy.org/en/rel_1_0/orm/basic_relationships.html#relationship-patterns 最近在学习到 ...

  10. oracle语句解析顺序