Skip to main content
Email Password   helpLost your password?

Introduction

I want to begin with a special thanks to CodeProject for providing so many useful samples, and thanks especially to the author of this article: Customizing the .NET Panel control.

Background

If you know about the EBP products, then you'll remember their main board with a simple but cool isometric 3D chart. So, let's do the same here. All the code has been verified under Microsoft FxCop 1.35.

I'm not very comfortable in writing articles even in French, so English isn't better ;p.

Using the code

Let's see the creation code:

// Object declaration

Nolme.WinForms.Chart m_chartSample1;

// Create object

this.m_chartSample1 = new Nolme.WinForms.Chart(this.components);
this.m_chartSample1.BackColor = System.Drawing.Color.Silver;
this.m_chartSample1.BottomMargin = 20;
this.m_chartSample1.ColumnFont = new System.Drawing.Font(
                  "Arial", 8F, System.Drawing.FontStyle.Italic);
this.m_chartSample1.ColumnTitleFont = new System.Drawing.Font(
              "Arial", 10F, System.Drawing.FontStyle.Underline);
this.m_chartSample1.Curvature = 15;
this.m_chartSample1.DeltaDepth = 10;
this.m_chartSample1.DisplayHiddenSides = true;
this.m_chartSample1.DisplayTextOnColumns = true;
this.m_chartSample1.GradientMode = 
     System.Drawing.Drawing2D.LinearGradientMode.ForwardDiagonal;
this.m_chartSample1.LeftMargin = 50;
this.m_chartSample1.LegendFont = new System.Drawing.Font(
                    "Arial", 11F, System.Drawing.FontStyle.Bold);
this.m_chartSample1.Location = new System.Drawing.Point(8, 8);
this.m_chartSample1.MainTitle = "Main title";
this.m_chartSample1.MainTitleFont = new System.Drawing.Font(
    "Arial", 16F, 
    ((System.Drawing.FontStyle)((System.Drawing.FontStyle.Bold | 
                          System.Drawing.FontStyle.Underline))));
this.m_chartSample1.MarginBetweenColumn = 20;
this.m_chartSample1.Name = "m_chartSample1";
this.m_chartSample1.RightMargin = 20;
this.m_chartSample1.Size = new System.Drawing.Size(456, 304);
this.m_chartSample1.TabIndex = 4;
this.m_chartSample1.TopMargin = 20;
this.m_chartSample1.VerticalAxisMaxValue = 10000;
this.m_chartSample1.VerticalAxisStep = 1000;

Adding a column to the chart is done with the following code:

ChartColumn column1 = 
    m_chartSample1.AddColumn (1500, 210, 0, 500);

Each number represents a sub-value in the new column. You can pass an integer array if you have more values.

You can set the column title like this:

column1.Title = "January";

Other attributes like the margins, main title, etc., can be changed.

There were two choices on the legend of the graph. We could either integrate the legend into the current panel, or make another independent object. The main intention is to provide a centralized unique legend if multiple charts are used on the same page.

To summarize, a Chart (derived from CustomPanel) contains one or more CharColumns. A ChartLegend is composed of CharLegendItems. There are as many CharLegendItems as sub-values in a CharColumn.

Points of interest

I've tried to make the code as simple as possible so that anyone can upgrade it.

Bug report

Nothing actually.

History

You must Sign In to use this message board.
 
 
Per page   
 FirstPrevNext
GeneralIt's OK Pin
bluealert455
16:44 13 Aug '09  
General3d chart plotting Pin
Faysal
1:16 26 Mar '08  
GeneralRe: 3d chart plotting Pin
Vincent DUVERNET (Nolmë Informatique)
5:10 28 Mar '08  
GeneralRe: 3d chart plotting Pin
Faysal
16:08 28 Mar '08  
GeneralRe: 3d chart plotting Pin
Vincent DUVERNET (Nolmë Informatique)
4:40 29 Mar '08  
GeneralWonderful ! Pin
JulienV
3:02 3 Sep '07  
Generallmd Pin
kurnikov
7:36 11 Apr '07  
GeneralRe: lmd Pin
Vincent DUVERNET (Nolmë Informatique)
9:24 13 Apr '07  
GeneralAdding control to VS? Pin
mikemohr
8:30 3 Nov '06  
GeneralRe: Adding control to VS? Pin
Vincent DUVERNET (Nolmë Informatique)
12:30 3 Nov '06  
QuestionWhat about a web based solution? Pin
Marcus D
7:22 18 Oct '06  
AnswerRe: What about a web based solution? Pin
Vincent DUVERNET (Nolmë Informatique)
8:16 18 Oct '06  
GeneralOne Suggession Pin
jayvardhanpatil
23:48 28 Sep '06  
QuestionCool Pin
techno_adi
21:14 29 Aug '06  
AnswerRe: Cool Pin
Vincent DUVERNET (Nolmë Informatique)
22:09 29 Aug '06  
GeneralImpressive! Pin
Danilo Corallo
4:16 20 Jul '06  
GeneralNice Try Pin
Sendilkumar.M
19:27 24 May '06  
GeneralVery Nice Pin
Paul Conrad
17:53 24 May '06  
GeneralSave & Print Pin
Chestah
0:27 18 May '06  
GeneralRe: Save & Print Pin
Vincent DUVERNET (Nolmë Informatique)
1:26 18 May '06  
JokeRe: Save & Print Pin
Chestah
12:04 18 May '06  
Questionlicensing / usage query Pin
SimonS
6:18 11 Apr '06  
AnswerRe: licensing / usage query Pin
Vincent DUVERNET (Nolmë Informatique)
8:04 11 Apr '06  
GeneralRe: licensing / usage query Pin
SimonS
8:15 11 Apr '06  
GeneralRe: licensing / usage query Pin
Vincent DUVERNET (Nolmë Informatique)
8:38 11 Apr '06  


Last Updated 24 May 2006 | Advertise | Privacy | Terms of Use | Copyright © CodeProject, 1999-2009