资源简介
不需使用商业插件,直接使用vs2005提供的插件!显示的数据为柱状图!

代码片段和文件信息
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Drawing;
using System.IO;
public partial class Chart : System.Web.UI.Page
{
protected void Page_Load(object sender EventArgs e)
{
Graphics objGraphics;
Bitmap objBitmap = new Bitmap(600300);
objGraphics = Graphics.FromImage(objBitmap);
objGraphics.Clear(Color.White);
int[] arrValues ={ 0 0 0 0 0 0 };
arrValues[0]=50;
arrValues[1]=70;
arrValues[2]=90;
arrValues[3]=100;
arrValues[4]=140;
arrValues[5] = 220;
string[] arrValuesNames ={ “0“ “0“ “0“ “0“ “0“ “0“ };//月份
arrValuesNames[0]=“一月“;
arrValuesNames[1]=“二月“;
arrValuesNames[2]=“三月“;
arrValuesNames[3]=“四月“;
arrValuesNames[4]=“五月“;
arrValuesNames[5]=“六月“;
objGraphics.DrawString(“上半年销售情况统计“new Font(“宋体“16)Brushes.Blacknew PointF(00));
PointF symbolLeg = new PointF(33520);
PointF descleg = new PointF(36016);
for (int i = 0; i < arrValues.Length; i++)
{
objGraphics.FillRectangle(new SolidBrush(GetColor(i))symbolLeg.XsymbolLeg.Y2010);
objGraphics.DrawRectangle(Pens.Black symbolLeg.X symbolLeg.Y 20 10);
objGraphics.DrawString(arrValuesNames[i].ToString() new Font(“宋体“ 10)Brushes.Blackdescleg);
symbolLeg.Y += 15;
descleg.Y += 15;
}
//画出矩形
for (int j = 0; j < arrValues.Length; j++)
{
objGraphics.FillRectangle(new SolidBrush(GetColor(j)) (j * 35) + 15 200 - arrValues[j] - 15 20 arrValues[j] + 5);
objGraphics.DrawRectangle(Pens.Black (j * 35) + 15 200 - arrValues[j] - 15 20 arrValues[j] + 5);
}
///---------以下代码主要是用来画饼图---------------------////
float sglCurrentAngle;
float sglTotalAngle = 0;
for (int j = 0; j < arrValues.Length; j++)
{
sglTotalAngle+=arrValues[j];
}
for (int j = 0; j < arrValues.Length; j++)
{
sglCurrentAngle = arrValues[j] / sglTotalAngle * 360;
objGraphics.FillPie(new SolidBrush(GetColor(j)) 220 95100100 sglTotalAngle sglCurrentAngle);
//220,95控制饼图的中心点,100,100控制图的半径和形状
sglTotalAngle += sglCurrentAngle;
}
objBitmap.Save(Response.OutputStreamSystem.Drawing.Imaging.ImageFormat.Gif);
// System.Drawing.Image.
//objBitmap.Save();
}
private Color GetColor(int itemIndex)
{
Color objColor=new Color();
switch(itemIndex)
{
case 0:
obj
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 465 2009-08-13 14:54 chart3\Chart.aspx
文件 3709 2009-08-13 15:03 chart3\Chart.aspx.cs
文件 692 2009-08-13 10:01 chart3\Default.aspx
文件 380 2005-03-29 12:46 chart3\Default.aspx.cs
文件 1741 2009-08-13 10:54 chart3\Web.Config
目录 0 2009-08-13 15:03 chart3\App_Data
目录 0 2009-08-13 15:03 chart3
----------- --------- ---------- ----- ----
6987 7
相关资源
- 数据库系统基础教程答案第三版机械
- 软考数据库系统工程师复习资料(完
- MoNyog8.5+破解补丁
- ANSYS LS-DYNA
- 全国4级地址库,京东数据
- 一个超简单的企业管理系统(带ACCE
- 数据库课设:图书管理系统报告
- vc 柱形图 CBarChart
- 合同管理系统的源代码(附数据库)
- ado数据库MFC图书管理系统vs2010
- 数据库VFP课程设计
- 数据库实现学生成绩管理系统选课管
- 排队机叫号 源代码
- ReportMachine 交叉报表 学生成绩表
- Access数据库在线编辑器
- Php 导出数据为EXCEL程序
- 人大金仓数据库系统表
- 模拟ATM柜员机系统--连接数据库
- 用工厂模式开发多数据库连接类
- 图片存储到数据库保存二进制文件并
- 数据库水印嵌入提取数据库水印数据
- 数据库课程设计以及指导思想
- 加班网上管理 单位
- 数据库课程设计报告(关于房地产销
- teechart 源代码
- 数据库课程设计(改改直接交)
-
将数据库的表生成xm
l文件 - Ajax定时读取数据库(源代码发布)
- 浪潮数据库结构
- reportmachine帮助电子书
评论
共有 条评论