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 ...
随机推荐
- IIS备份和还原
当我们电脑系统有大量的站点和虚拟目录的时候,电脑因为种种原因需要重做系统,那么重装系统后这些站点我们是否只能一个一个的添加,如果有成百上千个站点呢,任务量可想而知,本文将介绍如何备份和还原window ...
- VC6.0 工程转到VS2010一些问题的描述及解决方法
下列为VC6.0 工程转到VS2008一些问题的描述及解决方法 //////////////////////////////////////////////////////////////////// ...
- CSS如何计算优先级?如何计算权重?
(1) 优先级就近原则,同权重以最近者为准 载入样式以最后载入的样式为准: 同权重下:内联样式表(标签内部) > 嵌入样式表(当前文件) > 外部样式表(外部文件) !import > ...
- day02 秘钥生成,免密访问命令
hadoop免密登陆: 生成秘钥: ssh-keygen -t dsa -P '' -f ~/.ssh/id_dsa cat ~/.ssh/id_dsa.pub >> ~/.ssh/aut ...
- CentOS 7 配置 ISCSI 服务器
一.服务器配置 1.安装配置软件: yum install targetcli -y 2.进入配置界面: targetcli ,并进行如下配置: 1) /backstores/block create ...
- xdu2017校赛F
Problem F Dogs of Qwordance Senior Backend R&D Engineers 问题描述 那年夏天,锘爷和杰师傅漫步在知春公园的小道上.他们的妻子.孩子牵 着 ...
- cocos2dx v3.x lua绑定分析
打算新项目转到cocos2dx v3上了,下载代码浏览过后发现改动真是非常大,结构性调整很多. 比如tolua绑定这一块,就几乎全翻新了. 胶水代码的生成,改成了全自动式的,通过clang来分析c++ ...
- HDU 5236 Article (概率DP+贪心)
题意:要求输入一篇N个字符的文章,对所有非负整数i:每到第i+0.1秒时可以输入一个文章字符,每到第i+0.9秒时有P的概率崩溃(回到开头或者上一个存盘点) 每到第i秒有一次机会可以选择按下X个键存盘 ...
- BMFont使用图片自定义字体(无需字体文件)
网上搜BMFont做字体,很多都是从一个字体文件读取,然后选择需要的字,然后保存成图片文字,这个对于一般的文字的确很实用,因为Unity本身不支持中文,所以只好这样了. 但是做过游戏的都知道,策划总是 ...
- uWSGI + Nginx + Django 部署
1. uWSGI 服务器 Django 默认使用 WSGI(Python Web Server Gateway ) 作为 Web 服务器,一般仅用来作为测试使用,实际生产环境而是使用 uWSGI 和 ...