MS Chart 条状图【转】

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 条状图【转】的更多相关文章
- HighCharts之2D堆条状图
HighCharts之2D堆条状图 1.HighCharts之2D堆条状图源码 StackedBar.html: <!DOCTYPE html> <html> <head ...
- HighCharts之2D条状图
HighCharts之2D条状图 1.HighCharts之2D条状图源码 bar.html: <!DOCTYPE html> <html> <head> < ...
- Excel 2010高级应用-条状图(五)
Excel 2010高级应用-条状图(五) 基本操作如下: 1.新建一个Excel空白文档,并命名条状图 2.单击"插入",找到条状图的样图 3.选择其中一种类型的条状图样图,在空 ...
- Flex实现双轴条状图
1.问题背景 一般的,柱状图可以实现双轴图,但是如何实现双轴条状图? 2.实现实例 <?xml version="1.0" encoding="utf-8" ...
- Iocomp控件教程之Pie Chart——饼状图控件
Pie Chart--饼状图控件(Pie Chart)以饼状图形式显示每一个项目内容所占的百分比比重.在设计时.能够使用属性编辑器加入或者移除项目以及更改属性值.在执行时.使用AddItem,Remo ...
- python中matplotlib绘图封装类之折线图、条状图、圆饼图
DrawHelper.py封装类源码: import matplotlib import matplotlib.pyplot as plt import numpy as np class DrawH ...
- 利用js来画图形(例如:条状图,圆饼图等)
背景:java开发的过程中,需要对数据进行可视化,这样方便客户理解此时的数据状态 语言:java,js,window7,echarts包文件 sample的例子下面的参照 https://www.ec ...
- maplotlib python 玩具绘图 横向纵向条状图
from matplotlib import font_manager#解决zh-han图形汉字乱码 my_font = font_manager.FontProperties(fname=" ...
- Wpf/Wp/Silverlight-Chart图表控件:柱状图、饼状图等使用汇总
链接:http://www.cnblogs.com/jimson/archive/2010/06/21/Wpfchat.html http://www.cnblogs.com/mgen/p/32361 ...
随机推荐
- C#使用NPOI读取电子表格Excel到DataGridView中
上篇博文中已经介绍了如何写入Excel文件.这篇再介绍一下 如何从Excel中读取数据并保存到DataGridView中. 从Excel中读取数据并保存至DataGridView中,Excel文件第一 ...
- 问题:C# Dictionary嵌套使用;结果:嵌套Dictionary添加 , C#2.0泛型详细介绍
Dictionary<int, Dictionary<string, string>> dict1 = new Dictionary<int, Dictionary< ...
- jquery easyui 推荐博客 (MVC+EF+EasyUI+Bootstrap)
构建ASP.NET MVC5+EF6+EasyUI 1.4.3+Unity4.x注入的后台管理系统(52)-美化EasyUI皮肤和图标 系列目录 我很久以前就想更新系统的皮肤功能,Easyui 自 ...
- linux命令-yum工具详解
yum比rpm的优势在于解决依赖关系.可以指定源. [root@wangshaojun ~]# yum list ////列出rpm包资源 网络资源 rrdtool-php. x86_64 ...
- DevKit及rails的安装
Ruby on Rails的安装,是从被称为RubyGems的包管理系统开始的. Ruby on Rails是由Ruby处理系统的类库的.被称为"gem"的格式来进行配置的.&qu ...
- [xdoj1029]求解某个数的最高位和最低位
解题关键: 1.最高位求法 long long int x=n^m; 式子两边同时取lg lg(x)=m*lg(n): x=10^(m*lg(n)): 10的整数次方的最高位一定是1,所以x的最高位取 ...
- IoC概述
---------------siwuxie095 IoC,即 Inversion of Control,控制反转,它是 Spring 容器的内核 AOP.声明式事务等功能都是在此基础上开花结果,即 ...
- Debian安装Docker
Debian 安装 Docker CE 准备工作 系统要求 Docker CE 支持以下版本的 Debian 操作系统: Stretch 9 Jessie 8 (LTS) Wheezy 7.7 (LT ...
- 树莓派 Learning 002 装机后必要的操作 --- 09 root用户 密码
树莓派 装机后必要的操作 - root用户 密码 我的树莓派型号:Raspberry Pi 2 Model B V1.1 装机系统:NOOBS v1.9.2 树莓派使用的Linux是debian系统, ...
- Struts2学习第七课 ActionSupport
com.opensymphony.xwork2.ActionSupport类是默认的Action类,如果某个Action节点没有配置class属性,则ActionSupport即为待执行的Action ...