Blue Theme Orange Theme Green Theme Red Theme
 
DevExpress Free UI Controls
Home | Forums | Videos | Advertise | Certifications | Downloads | Blogs | Interviews | Jobs | Beginners | Training
 | Consulting  
Submit an Article Submit a Blog 
 Jump to
Skip Navigation Links
TechnologyExpand Technology
WebsiteExpand Website
6 Months Free & No Setup Fees ASP.NET Hosting!
Search :       Advanced Search »
Home » GDI+ & Graphics » 2D Charting

2D Charting

I was amazed at what the VS.NET IDE does for a programmer as I was primarily used to Java via the command line.

Page Views : 9352
Downloads : 1036
Rating :
 Rate it
Level : Intermediate
   Print Read/Post comments Post a comment  Similar Articles  
   Email to a friend  Bookmark  Author's other articles  
Download Files:
SeabeckEnterprises.zip | ChartsTest.zip
 
 
Discover the top 5 tips for understanding .NET Interop
Become a Sponsor
DevExpress Free UI Controls
Become a Sponsor
 Tag Cloud
 Latest Jobs
More ... 
 Latest Interview Questions
More ... 

Updates: 8/20/2003

  • Fixed Flickering via Double Buffering - Thanks to Robert Rohde for pointing it out.
  • Added TickMark.Diamond and TickMark.Bowtie to TickMarks Enum.
  • Added VerticalBarChart (Beta) as a new Charting Control.

Introduction

I started this project a month or two ago while learning C# (being Unemployed helped with the free time).  I was amazed at what the VS.NET IDE does for a programmer as I was primarily used to Java via the command line.  I decided to make something fairly complex and useful so that all of my time learning would not be wasted, and so here we have SeabeckCharts.  I also initially intended to sell these controls, but I dont have the money at this time to start another company and procure the proper licenses etc. to do it legally here in the *great* State of Maryland, so I am giving it to you all for free (Donations are welcome though, but not expected.). 

Basics

Initially I intended to include many more chart types, and these may come in time, but for now I have only included a LineChart and a ScatterChart as Custom User Controls.  Features common to both Charts include:

Title

  • SubTitle
  • X and Y Labels
  • Legend
  • Data Series - Colors, TickMarks, Smoothing
  • Backgrounds
  • Text Properties - Font, Size, Color
  • Dynamic Charting - Add or Remove Series Interactively, Mouse Clickable to display Point Coordinates

Use

To use the charts, simply customize the toolbox (by right-clicking on it and choosing Customize Toolbox, then on the .NET Framework Components Tab choose Browse) and add SeabeckEnterprises.dll to it.  You should now have 2 more Controls in the toolbox, LineChart and ScatterChart.  You can drag these on to any form you create, and Customize them either by right-clicking on them and choosing Properties (In the Categorized Properties View, the properties will be listed under LineChart Properties or ScatterChart Properties for each respective Chart.), or in the Code View of the Form.

Next, all you have to do is add Data to the chart(s).  You can see how this is done in the ChartsTest.zip solution.  Here is a small Example :

//LineChart Data
double[] x1 = new double[101];
double[] y1 = new double[101];
double[] y2 = new double[101];
//ScatterChart Data
double[] x3 = new double[11];
double[] y3 = new double[11];
double[] y4 = new double[11];
//Values for LineChart
for(int i=0;i<x1.Length;i++)
{
x1[i] = Math.PI + (((double)i)*(Math.PI/100.0));
y1[i] = Math.Sin(x1[i]);
y2[i] = Math.Cos(x1[i]);
}
//Values for ScatterChart
for(int j=0;j<y3.Length;j++)
{
x3[j] = j;
y3[j] = Math.Exp(x3[j])+1000;
y4[j] = -Math.Exp(x3[j])-1000;
}
this.lineChart1.SetXValues(x1);
this.lineChart1.AddSeries("Sin(x)",Color.Blue,1.5f,false,true,TickMark.Dot,y1);
this.lineChart1.AddSeries("Cos(x)",Color.Red,1.55f,true,true,TickMark.Plus,y2);
this
.scatterChart1.SetXValues(x3);
this.scatterChart1.AddSeries("exp(x) + 1000",Color.Firebrick,2.5f,TickMark.Triangle,y3);
this.scatterChart1.AddSeries("-exp(x)-1000",Color.DarkOliveGreen,3.5f,TickMark.Dot,y4);

Another Project I used this graphing library for is a Memory and Cache Benchmark called MemBurn which can be found at http://www.seabeck-enterprises.com .  

Issues / Missing Features / Bugs

I havent found any issues or bugs so far that I havent already fixed.  Of Course Im sure some of you that use the Controls will find some, and I hope that you will email me at one of the addresses below to let me know.  Of course you can fix/change/add anything you want to the code, but Id appreciate it especially for bugs if youd let me know. 

There are some desirable features that arent implemented yet.  The Charts as they stand now ALWAYS auto-scale both Axes.  I understand that it is useful to be able to manually control the ranges of the Axes, and I may implement that soon if I continue to not have a job.  :)  Also, multiple Y-Axes are useful in some situations, and I will look into that as well as time permits.

Comment Request!
Thank you for reading this post. Please post your feedback, question, or comments about this post Here.
Login to add your contents and source code to this article
 [Top] Rate this article
 
 About the author
 
paul
Looking for C# Consulting?
C# Consulting is founded in 2002 by the founders of C# Corner. Unlike a traditional consulting company, our consultants are well-known experts in .NET and many of them are MVPs, authors, and trainers. We specialize in Microsoft .NET development and utilize Agile Development and Extreme Programming practices to provide fast pace quick turnaround results. Our software development model is a mix of Agile Development, traditional SDLC, and Waterfall models.
Click here to learn more about C# Consulting.
 
Introducing MaxV - one click. infinite control. Hyper-V Hosting from MaximumASP.
Finally – a virtual platform that delivers next-generation Windows Server 2008 Hyper-V virtualization technology from a managed hosting partner you can truly depend on. Visit www.maximumasp.com/max for a FREE 30 day trial. Hurry offer ends soon. Climb aboard the MaxV platform and take advantage of High Availability, Intelligent Monitoring, Recurrent Backups, and Scalability – with no hassle or hidden fees. As a managed hosting partner focused solely on Microsoft technologies since 2000, MaximumASP is uniquely qualified to provide the superior support that our business is built on. Unparalleled expertise with Microsoft technologies lead to working directly with Microsoft as first to offer IIS 7 and SQL 2008 betas in a hosted environment; partnering in the Go Live Program for Hyper-V; and product co-launches built on WS 2008 with Hyper-V technology.
Dynamic PDF
ceTE software specializes in components for dynamic PDF generation and manipulation. The DynamicPDF™ product line allows you to dynamically generate PDF documents, merge PDF documents and new content to existing PDF documents from within your applications.
Discover the top 5 tips for understanding .NET
Ricky Leeks presents the top 5 tips for understanding .NET Interoperability. Learn more.
Nevron Chart for .NET 2010.1 Now Available
The leading .NET charting control now features PDF, Flash and Silverlight export, visualization of large datasets and more. Deliver true charting functionality to your BI, Scorecard, Presentation or Scientific apps. Download evaluation now.
ASP.NET 4 Hosting
Get 2 Months Free of ASP.NET Hosting for Only $4.95/month! Receive FREE MS SQL and MySQL Databases Including ASP.NET 4/3.5, MVC 3.0, Silverlight 4, Windows 2008/IIS 7.0 Plus FREE IIS 7 Modules. Host UNLIMITED ASP.NET Web Sites – Click Here!
 
 Post a Feedback, Comment, or Question about this article
Subject:
Comment:
DevExpress Free UI Controls
Become a Sponsor
 Comments
6 Months Free & No Setup Fees ASP.NET Hosting!
 © 2012  contents copyright of their authors. Rest everything copyright Mindcracker. All rights reserved.