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 ...
随机推荐
- python 基础 字典生成式
dict1 = {1:2,3:4,6:7,9:10} print dict((v,k) for k,v in dict.items()) 结果 {2:1.4:3,10:9,7:6} res = [{' ...
- Qt乱码解决办法(常量中有换行符)
用记事本打开源代码,然后点另存为,utf-8,编码覆盖 QStringLiteral("打开相机")
- Java探索之旅(14)——文本I/O与读写
1文件类File ❶封装文件或路径的属性.不包括创建和读写文件操作.File实例并不会实际创建文件.不论文件存在与否,可以创建任意文件名的实例.两种实例创建方式如下: ...
- 【spring boot logback】日志颜色渲染,使用logback-spring.xml自定义的配置文件后,日志没有颜色了
接着spring boot日志logback解析之后,发现使用logback-spring.xml自定义的配置文件后,日志没有颜色了 怎么办? 官网处理日志链接:https://logback.qos ...
- hadoop集群监控工具Apache Ambari安装配置教程
ambari 1.2.4 下载地址:http://www.apache.org/dist/incubator/ambari/ambari-1.2.4/ambari-1.2.4-incubating.t ...
- 7.31实习培训日志-docker sql
docker mysql docker问题 今天问了老师有关docker的问题,entrypoint和cmd的区别,两者同时存在cmd的执行结果会被当做参数传入entrypoint. dockerfi ...
- ADT-23.0.2百度网盘下载地址
最近 Google 被墙 http://download.csdn.net/download/wentai2009/7736389
- PPT2010学习笔记(共20讲)
第1讲 商务PPT中的必备元素 # 设计需打破规范 第2讲 封面页设计(一) 大图型封面页 # 基础知识点: 插入矩形和圆形 设置半透明色 设置字体变形效果 图片增强工具 利用过渡色虚化图片边缘 ...
- Ansible Playbooks高级使用
文件操作 文件创建 file 用于设置文件/链接/目录的属性,或者删除文件/链接/目录 ### state如果是directory当目录不存在时会自动创建:如果是file当文件不存在时不会自动创建 - ...
- 使用配置类而不使用XML文件(代替bean.xml)对spring进行配置
以下类是一个配置类,它的作用和bean.xml是一样的注解: @Configuration 作用: 用于指定当前类是一个spring配置类,当创建容器时会从该类上加载注解. 获取容器时需要使用Anno ...