nbsp; private float yTickSize; private float yMax; private float yMin; private string[] xAxisTitles ; private ChartLineList lines = new ChartLineList(); private Color gridColor=Color.Blue; private bool showHGridLines=true; private bool showVGridLines=true; //Properties public float YTickSize { get { return yTickSize ; } set { yTickSize = value ; } } public float YMax { get { return yMax ; } set { yMax = value ; } }
public float YMin { get { return yMin ; } set { yMin = value ; } } public string[] XAxisTitles { get { return xAxisTitles ; } set { xAxisTitles = value ; } } public ChartLineList Lines { get { return lines ; } set { lines = value ; } } public Color GridColor { get { return gridColor ; } set { gridColor = value ; } } public bool ShowHGridLines { get { return showHGridLines ; } set { showHGridLines = value ; } } public bool ShowVGridLines { get { return showVGridLines ; } set { showVGridLines = value ; } } //Collection of Chart Lines public class ChartLineList : TypedCollectionBase { public ChartLine this[int index] { get { return (ChartLine)(List[index]); } set { List[index] = value; } } public int Add(ChartLine value) { return List.Add(value); } public void Insert(int index, ChartLine value) { List.Insert(index, value); } public int IndexOf(ChartLine value) { return List.IndexOf(value); } public bool Contains(ChartLine value) { return List.Contains(value); } public void Remove(ChartLine value) { List.Remove(value); } public void CopyTo(ChartLine[] array, int index) { List.CopyTo(array, index); } } }
//Charting Engine - draws a chart based on the given ChartData public class ChartEngine { private ChartData chartData ; private float left; private float right; private float top; private float bottom; private float tickCount; private float yCount; private float hspacing; private float vspacing; private Graphics g; private Rectangle r; private Color backColor; private Color foreColor; private Font baseFont; private Font legendFont; private RectangleF legendRect; public ChartEngine() { } public Bitmap DrawChart(int width, int height, ChartData chartData) { Bitmap newBitmap = new Bitmap(width,height,PixelFormat.Format32bppARGB); Graphics g = Graphics.FromImage(newBitmap); Rectangle r = new Rectangle(0, 0, width, height); Color myForeColor = Color.Black; Color myBackColor&n