Click here to Skip to main content
Licence 
First Posted 24 Sep 2006
Views 71,004
Downloads 3,044
Bookmarked 78 times

Realtime Chart and Graph in One

By Roy Reznik | 16 May 2007
A basic Chart and Graph control.

1
1 vote, 14.3%
2

3
3 votes, 42.9%
4
3 votes, 42.9%
5
4.19/5 - 7 votes
μ 4.19, σa 1.87 [?]

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

About the Author

Roy Reznik



Israel Israel

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

Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board. (secure sign-in)
 
Search this forum  
 FAQ
    Noise  Layout  Per page   
  Refresh
QuestionRealTime graph Pinmembercicekbilal200223:51 3 Feb '12  
AnswerRe: RealTime graph PinmemberMazen el Senih8:46 6 Feb '12  
Generalreply! Pinmemberluongvn3:35 26 Feb '11  
GeneralRe: reply! PinmemberRoy Reznik8:54 14 May '11  
GeneralWeb Version Pinmembergirishmeena1:12 21 Sep '10  
QuestionHow could i adjust with all values when array exceed range of values? Pinmemberhuynhdangthai0:52 28 Jul '10  
QuestionI got some problem with it, help please.. Pinmemberrpurnama19:41 15 Feb '10  
Generalcannot run... Pinmemberyanadi7:02 30 May '09  
AnswerRe: cannot run... PinmemberRoy Reznik4:04 26 Jun '09  
GeneralMy Solution for the exception Pinmemberrcn2117:10 18 May '09  
GeneralRe: My Solution for the exception PinmemberRoy Reznik4:10 26 Jun '09  
GeneralRe: My Solution for the exception PinmemberNeoDimension3:15 5 Aug '09  
GeneralChange bar width Pinmemberelcharro6:59 10 Aug '07  
GeneralImplementing realtime graph [modified] Pinmemberjamezun22:30 18 Jun '07  
GeneralThanks for the update! PinmemberMarc Leger9:51 19 May '07  
QuestionLoad Array PinmemberGwannoes0:04 11 May '07  
AnswerRe: Load Array PinmemberRoy Rez11:10 16 May '07  
Generaltest application issues and chart control issues PinmemberToothRobber11:09 10 Nov '06  
GeneralRe: test application issues and chart control issues PinmemberRoy Rez11:19 10 Nov '06  
QuestionReal Time? PinmemberMBirchmeier11:19 6 Nov '06  
AnswerRe: Real Time? PinmemberRoy Rez11:17 10 Nov '06  

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.

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