public void Render(string title, string subTitle, int width, int height, DataSet chartData, Stream target)
{
const int SIDE_LENGTH = 400;
const int CHART_TOP = 75;
const int CHART_HEIGHT = 220;
const int CHART_LEFT = 50;
const int CHART_WIDTH = 300;
DataTable dt = chartData.Tables[0];
//calculate highest data point
float highPoint = 0;
foreach(DataRow dr in dt.Rows)
{
if(highPoint<Convert.ToSingle(dr[1]))
{
highPoint = Convert.ToSingle(dr[1]);
}
}
//create a new image
Bitmap bm = new Bitmap(width,height);
Graphics g = Graphics.FromImage(bm);
using System;
using System.IO;
using System.Data;
using System.Drawing;
using System.Drawing.Text;
using System.Drawing.Drawing2D;
using System.Drawing.Imaging;
namespace xxx
{
/// <summary>
/// chart 的摘要说明。
/// </summary>
public class PieChart
{
public PieChart()
{
}
public void Render(string title, string subTitle, int width, int height, DataSet chartData, Stream target)
{
const int SIDE_LENGTH = 400;
const int PIE_DIAMETER = 245;
DataTable dt = chartData.Tables[0];
//calculate total amount of units in the pie, based on the data passed in
float sumData = 0;
foreach(DataRow dr in dt.Rows)
{
sumData += Convert.ToSingle(dr[1]);
}
//create a new image
Bitmap bm = new Bitmap(width,height);
Graphics g = Graphics.FromImage(bm);