Click here to Skip to main content
6,595,444 members and growing! (19,377 online)
Email Password   helpLost your password?
Desktop Development » Miscellaneous » Miscellaneous Controls     Intermediate

Realtime Chart and Graph in One

By Roy Reznik

A basic Chart and Graph control.
C# 2.0, .NET, Win2KVS2005, Dev
Posted:24 Sep 2006
Updated:16 May 2007
Views:46,014
Bookmarked:71 times
Announcements
Loading...
 
Search    
Advanced Search
Add to IE Search
printPrint   add Share
      Discuss Discuss   Broken Article?Report  
7 votes for this article.
Popularity: 3.54 Rating: 4.19 out of 5

1
1 vote, 14.3%
2

3
3 votes, 42.9%
4
3 votes, 42.9%
5

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


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.
Location: Israel Israel

Other popular Miscellaneous articles:

Article Top
You must Sign In to use this message board.
FAQ FAQ 
 
Noise Tolerance  Layout  Per page   
 Msgs 1 to 14 of 14 (Total in Forum: 14) (Refresh)FirstPrevNext
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    Question Question    Answer Answer    Joke Joke    Rant Rant    Admin 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