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. python version 2.7 required,which was not found in

    python version 2.7 required,which was not found in 出现上面这种情况的原因我推测有两种: 1.NumPy和SciPy官方网站上只提供了32bit的文件 ...

  2. JavaScript中设置cookie的值

    cookie 与 session 是网页开发中常用的信息存储方式.Cookie是在客户端开辟的一块可存储用户信息的地方:Session是在服务器内存中开辟的一块存储用户信息的地方.JavaScript ...

  3. ubuntu部署supersor

     1.安装pip $ sudo apt-get install python-pip –y $ sudo pip install - -upgrade pip //升级pip 2.安装supervis ...

  4. nodejs中 underscore 包有什么作用

    Underscore一个JavaScript实用库,提供了一整套函数式变成有用的实用功能,但是没有扩展任何JavaScript内置对象.它是这个问题的答案:“如果我在一个空白的HTML页面前坐下, 并 ...

  5. macOS 安装 Docker

    系统要求 Docker for Mac 要求系统最低为 macOS 10.10.3 Yosemite,或者 2010 年以后的 Mac 机型,准确说是带 Intel MMU 虚拟化的,最低 4GB 内 ...

  6. 项目一:第一天 1、项目概述 2、环境搭建(重点) 3、Jquery Easyui 前端UI框架 4、Jquery Ztree 树形插件使用

    1.项目环境 注:添加jar包直接在common_parent里面添加. 搭建数据库 create tablespace bos317space datafile 'c:\ bos317.dbf'   ...

  7. c/c++转义字符大全【转自互联网】

    将转义字符收集如下:转义字符 意义 ASCII码值(十进制) \a 响铃(BEL) 007 \b 退格(BS) 008 \f 换页(FF) 012 \n 换行(LF) 010 \r 回车(CR) 01 ...

  8. JavaScript学习系列1 基础-变量

    1. 在一次面试中,被问到JavaScript中使用严格模式有什么区别, 这里的严格模式指的是 ECMAScript5严格模式 我们首先来看看普通模式,也就是非严格模式 a = 5; console. ...

  9. 19.Imagetragick 命令执行漏洞(CVE-2016–3714)

    Imagetragick 命令执行漏洞(CVE-2016–3714) 漏洞简介: Imagetragick 命令执行漏洞在16年爆出来以后,wooyun上面也爆出了数个被该漏洞影响的大厂商,像腾讯, ...

  10. invalid loc header的解决办法

    eclipse 运行程序,报invalid loc header,网上一查,删除maven仓库(默认位于%USERPROFILE%\.m2\repository\org)中的下载包,然后重新下载.