5,699,997 members and growing! (13,269 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, C#, .NET, Windows, Win2KVS2005, Visual Studio, Dev

Posted: 24 Sep 2006
Updated: 16 May 2007
Views: 36,198
Bookmarked: 59 times
Announcements
Loading...



Search    
Advanced Search
Sitemap
6 votes for this Article.
Popularity: 3.23 Rating: 4.15 out of 5
0 votes, 0.0%
1
1 vote, 16.7%
2
0 votes, 0.0%
3
3 votes, 50.0%
4
2 votes, 33.3%
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


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
Sign Up to vote for this article
You must Sign In to use this message board.
FAQ FAQ Noise ToleranceSearch Search Messages 
 Layout  Per page   
 Msgs 1 to 9 of 9 (Total in Forum: 9) (Refresh)FirstPrevNext
GeneralChange bar widthmemberelcharro6:59 10 Aug '07  
GeneralImplementing realtime graph [modified]memberjamezun22:30 18 Jun '07  
GeneralThanks for the update!memberMarc Leger9:51 19 May '07  
QuestionLoad ArraymemberGwannoes0:04 11 May '07  
AnswerRe: Load ArraymemberRoy Rez11:10 16 May '07  
Generaltest application issues and chart control issuesmemberToothRobber11:09 10 Nov '06  
GeneralRe: test application issues and chart control issuesmemberRoy Rez11:19 10 Nov '06  
QuestionReal Time?memberMBirchmeier11:19 6 Nov '06  
AnswerRe: Real Time?memberRoy 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-2008
Web12 | Advertise on the Code Project