Click here to Skip to main content
Click here to Skip to main content

Realtime Chart and Graph in One

, 16 May 2007
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 PinmemberMember 1027882916-Sep-13 22:28 
QuestionMarco PinmemberMarco Antonio Rios Ramirez23-Nov-12 18:19 
QuestionReset chart data PinmemberMember 87076244-Apr-12 5:28 
QuestionRealTime graph Pinmembercicekbilal20023-Feb-12 23:51 
AnswerRe: RealTime graph PinmemberMazen el Senih6-Feb-12 8:46 
Generalreply! Pinmemberluongvn26-Feb-11 3:35 
GeneralRe: reply! PinmemberRoy Reznik14-May-11 8:54 
GeneralWeb Version Pinmembergirishmeena21-Sep-10 1:12 
QuestionHow could i adjust with all values when array exceed range of values? Pinmemberhuynhdangthai28-Jul-10 0:52 
QuestionI got some problem with it, help please.. Pinmemberrpurnama15-Feb-10 19:41 
Generalcannot run... Pinmemberyanadi30-May-09 7:02 
AnswerRe: cannot run... PinmemberRoy Reznik26-Jun-09 4:04 
GeneralMy Solution for the exception Pinmemberrcn2118-May-09 17:10 
GeneralRe: My Solution for the exception PinmemberRoy Reznik26-Jun-09 4:10 
GeneralRe: My Solution for the exception PinmemberNeoDimension5-Aug-09 3:15 
GeneralChange bar width Pinmemberelcharro10-Aug-07 6:59 
GeneralImplementing realtime graph [modified] Pinmemberjamezun18-Jun-07 22:30 
GeneralThanks for the update! PinmemberMarc Leger19-May-07 9:51 
QuestionLoad Array PinmemberGwannoes11-May-07 0:04 
AnswerRe: Load Array PinmemberRoy Rez16-May-07 11:10 
Generaltest application issues and chart control issues PinmemberToothRobber10-Nov-06 11:09 
GeneralRe: test application issues and chart control issues PinmemberRoy Rez10-Nov-06 11:19 
QuestionReal Time? PinmemberMBirchmeier6-Nov-06 11:19 
AnswerRe: Real Time? PinmemberRoy 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
Web04 | 2.8.150327.1 | Last Updated 16 May 2007
Article Copyright 2006 by Roy Reznik
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid