轩辕不败vs嗜杀者:柱状图改进版 - CoolBug - 博客园
来源:百度文库 编辑:九乡新闻网 时间:2024/10/06 02:42:35
柱状图改进版
{
//创建一个画布
Bitmap bm=new Bitmap(350,355);
//在新建的画布上画一个图
Graphics bp=Graphics.FromImage(bm);
//设置bp的背景色为White
bp.Clear(Color.White);
//创建数据源,在此为一个数组,这里可以从数据集(DataSet)中获取数据.
int [] a1={20,40,60,80,100,120,140,160};
int [] a2={40,60,80,100,120,140,160,180};
//画一个矩形,将柱形图圈起来
bp.FillRectangle(new SolidBrush(Color.Beige),1,1,255,205);
bp.DrawRectangle(Pens.Black,1,1,255,205);
//定义一种样式
StringFormat fontStyle=new System.Drawing.StringFormat(StringFormatFlags.DisplayFormatControl);
//通过循环画出柱状图
//柱图1 --Blue
for(int i=0;i
//填充图(着色,起点X,起点Y,宽,高)
bp.FillRectangle(new SolidBrush(Color.Blue),(i*30)+25,200-a1[i],5,a1[i]+5);
//填充边框(着色,起点X,起点Y,宽,高)
bp.DrawRectangle(Pens.Black,(i*30)+25,200-a1[i],5,a1[i]+5);
//输出月份
bp.DrawString((i+1).ToString()+"月",new Font("宋体", 10), Brushes.Black ,(i*30)+18,210,fontStyle);
}
//柱图2--Red
for(int i=0;i
bp.FillRectangle(new SolidBrush(Color.Red),(i*30)+30,200-a2[i],5,a2[i]+5);
bp.DrawRectangle(Pens.Black,(i*30)+30,200-a2[i],5,a2[i]+5);
}
//画两个例子图
//旁边的"产品A"
bp.FillRectangle(new SolidBrush(Color.Blue),280,10,20,10);
bp.DrawRectangle(Pens.Black,280,10,20,10);
bp.DrawString("产品A",new Font("宋体", 10), Brushes.Black ,305,10,fontStyle);
//旁边的"产品B"
bp.FillRectangle(new SolidBrush(Color.Red),280,30,20,10);
bp.DrawRectangle(Pens.Black,280,30,20,10);
bp.DrawString("产品B",new Font("宋体", 10), Brushes.Black ,305,30,fontStyle);
bp.DrawString("臭虫公司销虫量",new Font("宋体", 12), Brushes.Black ,45,230,fontStyle);
//以gif图片格式把图输出到IE上
bm.Save(Response.OutputStream,ImageFormat.Gif);
}
分类: 程序,还是程序
柱状图改进版 - CoolBug - 博客园
台球瞄准方法详解(改进版) - 陌路刀客 - 博客园
清除 垃圾改进版
DMI指标改进版
CSS柱状图的实现
照片直方图(柱状图)详解
清除系统垃圾改进版
MACD指标中的柱状图分析
深入认识柱状图(直方图)
效率的真实含义——此“帕累托改进”非彼“帕累托改进” - 谢作诗 - 名家博客 - 博客 ...
清除系统垃圾改进版01
清除系统垃圾改进版qq
清除系统垃圾改进版2
改进版[立桩量主图]之二
清除系统垃圾改进版0
环保酵素的做法 改进版
匹配固话正则改进版
清除系统垃圾改进版00
MACD指标中的柱状图分析 综合jy-
ORACLE柱状图与执行计划(转)
实战技巧:MACD技术指标中的柱状图
MACD指标中的柱状图分析 综合jy
DIY 漫步者 R1000TC北美版音箱改进、电路图和维修
杀气腾腾:江西昌飞武直终极改进版终于现身