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. SpringMVC 利用@ResponseBody注解返回Json时,出现406 not acceptable 错误的解决方法。

    1 在RequestMapping中加入produces属性如: @RequestMap(value="/path",produces="application/json ...

  2. hibernate中的session的获取方法以及区别

    获取sesstionFactory的方法: // sessionFactory factory = new AnnotationConfiguration.configure("hibern ...

  3. 第六篇 elasticsearch express 删除索引数据

    express 框架删除elasticsearch索引数据 1.在elasticsearch.js文件下添加 function deleteDocument(id) { return elasticC ...

  4. Debian安装Docker

    Debian 安装 Docker CE 准备工作 系统要求 Docker CE 支持以下版本的 Debian 操作系统: Stretch 9 Jessie 8 (LTS) Wheezy 7.7 (LT ...

  5. Learning Python 005 字符串和编码

    Python 字符串和编码 介绍 计算机是美国人发明的,最早只有127个字母被编码到计算机,这个编码表被称为ASCII编码,比如大写字母A的编码是65,小写字母z的编码是122. 处理中文一个字节显然 ...

  6. WHAT is CPU负载?

    WHAT?? 1.CPU负载都有哪些? cpu负载的定义:在一般情况下可以将单核心cpu的负载看成是一条单行的桥,数字1代表cpu刚好能够处理过来,即桥上能够顺利通过所有的车辆,桥外没有等待的车辆,桥 ...

  7. CSS样式基础:

    CSS:外部文件导入  <link rel="stylesheet" type="text/css" href="./style.css&quo ...

  8. python包管理

    如果是python 项目目录,例如pycharm里新建的python项目,则可以通过from,import导入目录下的文件夹. 如果是普通文件目录,则代码里不能相对方式导入该目录下的文件夹,需要加入要 ...

  9. ajax的回调函数和匿名函数

    1.什么是js回调函数 一. 回调函数的作用 js代码会至上而下一条线执行下去,但是有时候我们需要等到一个操作结束之后再进行下一个操作,这时候就需要用到回调函数. 二. 回调函数的解释 因为函数实际上 ...

  10. Netbeans使用UTF-8编码

    如果要NetBeans用UTF-8对文件进行解码,需要修改配置文件,具体方法如下: 1. 找到你的Netbeans安装目录下的etc文件夹,如C:\Program Files\NetBeans 6.9 ...