Click here to Skip to main content
15,390,470 members
Articles / Programming Languages / C#
Posted 24 Sep 2006


99 bookmarked

Realtime Chart and Graph in One

Rate me:
Please Sign up or sign in to vote.
4.59/5 (11 votes)
16 May 2007
A basic Chart and Graph control.

Sample Image - ChartGraph.png


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

Now we can start adding values.

//Adding Values to the control
float ValueAdd;
ValueAdd = 5.3;

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).


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


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

QuestionReal time data from serial port Pin
Member 128684421-Dec-16 1:22
MemberMember 128684421-Dec-16 1:22 
QuestionThe plot do not appear Pin
Member 120466279-Oct-15 7:30
MemberMember 120466279-Oct-15 7:30 
QuestionCharting tools Pin
Member 1027882916-Sep-13 21:28
MemberMember 1027882916-Sep-13 21:28 
QuestionMarco Pin
Marco Antonio Rios Ramirez23-Nov-12 17:19
MemberMarco Antonio Rios Ramirez23-Nov-12 17:19 
QuestionReset chart data Pin
Member 87076244-Apr-12 4:28
MemberMember 87076244-Apr-12 4:28 
QuestionRealTime graph Pin
cicekbilal20023-Feb-12 22:51
Membercicekbilal20023-Feb-12 22:51 
AnswerRe: RealTime graph Pin
Mazen el Senih6-Feb-12 7:46
professionalMazen el Senih6-Feb-12 7:46 
Generalreply! Pin
luongvn26-Feb-11 2:35
Memberluongvn26-Feb-11 2:35 
GeneralRe: reply! Pin
Roy Reznik14-May-11 7:54
MemberRoy Reznik14-May-11 7:54 
GeneralWeb Version Pin
girishmeena21-Sep-10 0:12
Membergirishmeena21-Sep-10 0:12 
Is Web version of this code also available. please provide if anyone have some thing related to web

QuestionHow could i adjust with all values when array exceed range of values? Pin
huynhdangthai27-Jul-10 23:52
Memberhuynhdangthai27-Jul-10 23:52 
QuestionI got some problem with it, help please.. Pin
rpurnama15-Feb-10 18:41
Memberrpurnama15-Feb-10 18:41 
Generalcannot run... Pin
yanadi30-May-09 6:02
Memberyanadi30-May-09 6:02 
AnswerRe: cannot run... Pin
Roy Reznik26-Jun-09 3:04
MemberRoy Reznik26-Jun-09 3:04 
GeneralMy Solution for the exception Pin
rcn2118-May-09 16:10
Memberrcn2118-May-09 16:10 
GeneralRe: My Solution for the exception Pin
Roy Reznik26-Jun-09 3:10
MemberRoy Reznik26-Jun-09 3:10 
GeneralRe: My Solution for the exception Pin
NeoDimension5-Aug-09 2:15
MemberNeoDimension5-Aug-09 2:15 
GeneralRe: My Solution for the exception Pin
astramiki23-Dec-17 11:19
Memberastramiki23-Dec-17 11:19 
GeneralChange bar width Pin
elcharro10-Aug-07 5:59
Memberelcharro10-Aug-07 5:59 
GeneralImplementing realtime graph [modified] Pin
jamezun18-Jun-07 21:30
Memberjamezun18-Jun-07 21:30 
GeneralThanks for the update! Pin
Marc Leger19-May-07 8:51
MemberMarc Leger19-May-07 8:51 
QuestionLoad Array Pin
Gwannoes10-May-07 23:04
MemberGwannoes10-May-07 23:04 
AnswerRe: Load Array Pin
Roy Reznik16-May-07 10:10
MemberRoy Reznik16-May-07 10:10 
Generaltest application issues and chart control issues Pin
ToothRobber10-Nov-06 10:09
professionalToothRobber10-Nov-06 10:09 
GeneralRe: test application issues and chart control issues Pin
Roy Reznik10-Nov-06 10:19
MemberRoy Reznik10-Nov-06 10:19 

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

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