![]() |
Desktop Development »
Miscellaneous »
Miscellaneous Controls
Intermediate
Realtime Chart and Graph in OneBy Roy ReznikA basic Chart and Graph control. |
C# 2.0, .NET, Win2KVS2005, Dev
|
|
Advanced Search Add to IE Search |
|
|
|
||||||||||||||||

I worked on a project in which I needed a graph control. Later on, I was also required to use a chart control. So I thought, hey, let's just combine them both into one nice and simple control.
This control is very simple to use. First, we must create the control and initialize it.
//Creating the control
private ChartControl.ChartControlForm chartControlForm1;
chartControlForm1 = new ChartControl.ChartControlForm();
//Initializing the Control
chartControlForm1.InitChart();
Now we can start adding values.
//Adding Values to the control
float ValueAdd;
ValueAdd = 5.3;
chartControlForm1.AddValue(ValueAdd);
As we add the values, the control automatically redraws itself, so there is no need to call any function.
The variable in charge of the Graph/Chart mode is OpenType. Please note that its default value is ChartControlOpenType.Bar.
Change to Graph mode:
chartControlForm1.OpenType = ChartControl.ChartControlOpenType.Graph;
Change to Chart mode:
chartControlForm1.OpenType = ChartControl.ChartControlOpenType.Bar;
Loading from an array/list can easily be done by using the overloaded function LoadFromValues (may receive a float Array or an ArrayList).
| You must Sign In to use this message board. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
General
News
Question
Answer
Joke
Rant
Admin
|
PermaLink |
Privacy |
Terms of Use
Last Updated: 16 May 2007 Editor: Sean Ewington |
Copyright 2006 by Roy Reznik Everything else Copyright © CodeProject, 1999-2009 Web16 | Advertise on the Code Project |