Click here to Skip to main content
11,478,642 members (66,178 online)
Click here to Skip to main content

Realtime Chart and Graph in One

, 16 May 2007 96.4K 6.7K 92
Rate this:
Please Sign up or sign in to vote.
A basic Chart and Graph control.

Sample Image - ChartGraph.png

Introduction

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.

Using the code

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;

Additional Features

Loading from an array/list can easily be done by using the overloaded function LoadFromValues (may receive a float Array or an ArrayList).

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

Share

About the Author

Roy Reznik

Israel Israel
I've been into programming for the last 5 years, doing all sort of stuff, from the old dos borland c++ to C#.NET.

Comments and Discussions

 
QuestionCharting tools Pin
Member 1027882916-Sep-13 22:28
memberMember 1027882916-Sep-13 22:28 
QuestionMarco Pin
Marco Antonio Rios Ramirez23-Nov-12 18:19
memberMarco Antonio Rios Ramirez23-Nov-12 18:19 
QuestionReset chart data Pin
Member 87076244-Apr-12 5:28
memberMember 87076244-Apr-12 5:28 
QuestionRealTime graph Pin
cicekbilal20023-Feb-12 23:51
membercicekbilal20023-Feb-12 23:51 
AnswerRe: RealTime graph Pin
Mazen el Senih6-Feb-12 8:46
memberMazen el Senih6-Feb-12 8:46 
Generalreply! Pin
luongvn26-Feb-11 3:35
memberluongvn26-Feb-11 3:35 
GeneralRe: reply! Pin
Roy Reznik14-May-11 8:54
memberRoy Reznik14-May-11 8:54 
GeneralWeb Version Pin
girishmeena21-Sep-10 1:12
membergirishmeena21-Sep-10 1:12 
QuestionHow could i adjust with all values when array exceed range of values? Pin
huynhdangthai28-Jul-10 0:52
memberhuynhdangthai28-Jul-10 0:52 
QuestionI got some problem with it, help please.. Pin
rpurnama15-Feb-10 19:41
memberrpurnama15-Feb-10 19:41 
Generalcannot run... Pin
yanadi30-May-09 7:02
memberyanadi30-May-09 7:02 
AnswerRe: cannot run... Pin
Roy Reznik26-Jun-09 4:04
memberRoy Reznik26-Jun-09 4:04 
GeneralMy Solution for the exception Pin
rcn2118-May-09 17:10
memberrcn2118-May-09 17:10 
GeneralRe: My Solution for the exception Pin
Roy Reznik26-Jun-09 4:10
memberRoy Reznik26-Jun-09 4:10 
GeneralRe: My Solution for the exception Pin
NeoDimension5-Aug-09 3:15
memberNeoDimension5-Aug-09 3:15 
GeneralChange bar width Pin
elcharro10-Aug-07 6:59
memberelcharro10-Aug-07 6:59 
GeneralImplementing realtime graph [modified] Pin
jamezun18-Jun-07 22:30
memberjamezun18-Jun-07 22:30 
GeneralThanks for the update! Pin
Marc Leger19-May-07 9:51
memberMarc Leger19-May-07 9:51 
QuestionLoad Array Pin
Gwannoes11-May-07 0:04
memberGwannoes11-May-07 0:04 
AnswerRe: Load Array Pin
Roy Rez16-May-07 11:10
memberRoy Rez16-May-07 11:10 
Generaltest application issues and chart control issues Pin
ToothRobber10-Nov-06 11:09
memberToothRobber10-Nov-06 11:09 
GeneralRe: test application issues and chart control issues Pin
Roy Rez10-Nov-06 11:19
memberRoy Rez10-Nov-06 11:19 
QuestionReal Time? Pin
MBirchmeier6-Nov-06 11:19
memberMBirchmeier6-Nov-06 11:19 
AnswerRe: Real Time? Pin
Roy Rez10-Nov-06 11:17
memberRoy Rez10-Nov-06 11:17 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web03 | 2.8.150520.1 | Last Updated 16 May 2007
Article Copyright 2006 by Roy Reznik
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid