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. C#的闭包

    简单的理解:闭包变量是把局部变量的作用域扩展到回调函数,发生在匿名方法注册到委托上,而匿名方法中使用外部的局部变量 说什么都不如图示那么容易明白啊 先看C#的源码 class Program { st ...

  2. cdh ntpdate 问题

    ntpdc -np 一个正常一个不正常

  3. LDA与最小二乘法的关系及其变种详解

    1 LDA与最小二乘法的关联 对于二值分类问题,令人惊奇的是最小二乘法和LDA分析是一致的.回顾之前的线性回归,给定N个d维特征的训练样例(i从1到N),每个对应一个类标签.我们之前令y=0表示一类, ...

  4. 【转】WebElement.getText()为空解决方法

    WebElement.getText()为空解决方法 当使用getText()获取一个普通的链接文本时: <a href="http://www.baidu.com"> ...

  5. Entity Framework Code-First(14):From Existing DB

    Code-First from an Existing Database: Here, you will learn how to generate code-first context and en ...

  6. Struts2学习第七课 动态方法调用

    动态方法调用:通过url动态调用Action中的方法. action声明: <package name="struts-app2" namespace="/&quo ...

  7. C++哪些函数不能是虚函数

    1. inline是编译时展开,必须有实体:(不考虑不展开的假inline)   2. static属于class自己的,也必须有实体:   3. 构造函数.复制构造函数.virtual函数基于vta ...

  8. gitlab私服搭建

    1.什么是gitlab: gitlab 是一个用于仓库管理系统的开源项目,它以git为代码管理工具,因此代码可以管到它上边来.搭建私服gitlab可以方便我们有条不紊的管理我们的代码.闲话不说,上代码 ...

  9. InfoQ —— 腾讯游戏大数据服务场景与应用

    简介 周东祥,本人从2010年毕业进入腾讯互动娱乐部门工作,一直致力在腾讯游戏运营开发工作.先后负责SAP业务受理系统,盗号自助系统,元数据系统以及近2年在腾讯游戏大数据运营开发中积累大量的大数据开发 ...

  10. Maven中如何利用继承创建web项目(分层开发)

    1.创建父项目parent 新建——Maven Project——勾选Create a Simple Project(skip archetype selected)——填写parent坐标,注意打包 ...