Click here to Skip to main content
11,920,772 members (61,695 online)
Click here to Skip to main content
Add your own
alternative version


191 bookmarked

C# 3D Charting

, 24 May 2006
Rate this:
Please Sign up or sign in to vote.
A simple article for easy charting.


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.


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 Poke tongue | ;-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 = 
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 | 
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.


  • 2006-04-08
    • Thanks timbits214, changes have been done.
    • So, I've added a new mode for 'real time' rendering.
    • Chart.cs has a new method, ShiftLeft, to shift columns from one step to the left.
    • With these changes, ChartColumn integrates a default constructor and ResetValues.
  • 2006-03-31
    • The new version contains a new rendering mode: 3D with gradient.
    • Bug fixed: Left grid text starting at 0.
    • Bug fixed: Vertical axis auto-adjusts when min and max don't have the same digit numbers (100 and 1000, for example).
    • Bug fixed: Border drawings and optimization.
    • Bug fixed: Label on the column with negative values.
    • New function: DisplayBorders in ChartColumn.cs.
    • Some changes have been made in the function parameters list to support gradient drawing mode.
  • 2005-10-07
    • New version contains a new rendering mode. See the ChartRenderingMode enum.
    • Associated to this new mode, ChartCumulativeMode enum can define where a label on the column is placed.
    • Some changes have been made in the function parameters list.
  • 2005-10-08
    • Negative values are now managed.
    • The function AdjustVerticalAxis has been reviewed.


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

No Biography provided

You may also be interested in...

Comments and Discussions

GeneralMy vote of 5 Pin
RAJI @Codeproject11-Jul-11 20:28
memberRAJI @Codeproject11-Jul-11 20:28 
Generalnice chart !it works Pin
batsword11-Nov-10 16:34
memberbatsword11-Nov-10 16:34 
GeneralIt's OK Pin
bluealert45513-Aug-09 16:44
memberbluealert45513-Aug-09 16:44 
General3d chart plotting Pin
Faysal26-Mar-08 1:16
memberFaysal26-Mar-08 1:16 
GeneralRe: 3d chart plotting Pin
Vincent DUVERNET (Nolmë Informatique)28-Mar-08 5:10
memberVincent DUVERNET (Nolmë Informatique)28-Mar-08 5:10 
GeneralRe: 3d chart plotting Pin
Faysal28-Mar-08 16:08
memberFaysal28-Mar-08 16:08 
GeneralRe: 3d chart plotting Pin
Vincent DUVERNET (Nolmë Informatique)29-Mar-08 4:40
memberVincent DUVERNET (Nolmë Informatique)29-Mar-08 4:40 
GeneralWonderful ! Pin
JulienV3-Sep-07 3:02
memberJulienV3-Sep-07 3:02 
Generallmd Pin
kurnikov11-Apr-07 7:36
memberkurnikov11-Apr-07 7:36 
GeneralRe: lmd Pin
Vincent DUVERNET (Nolmë Informatique)13-Apr-07 9:24
memberVincent DUVERNET (Nolmë Informatique)13-Apr-07 9:24 
QuestionAdding control to VS? Pin
mikemohr3-Nov-06 8:30
membermikemohr3-Nov-06 8:30 
AnswerRe: Adding control to VS? Pin
Vincent DUVERNET (Nolmë Informatique)3-Nov-06 12:30
memberVincent DUVERNET (Nolmë Informatique)3-Nov-06 12:30 
QuestionWhat about a web based solution? Pin
Marcus D18-Oct-06 7:22
memberMarcus D18-Oct-06 7:22 
AnswerRe: What about a web based solution? Pin
Vincent DUVERNET (Nolmë Informatique)18-Oct-06 8:16
memberVincent DUVERNET (Nolmë Informatique)18-Oct-06 8:16 
GeneralOne Suggession Pin
jayvardhanpatil28-Sep-06 23:48
memberjayvardhanpatil28-Sep-06 23:48 
QuestionCool Pin
techno_adi29-Aug-06 21:14
membertechno_adi29-Aug-06 21:14 
AnswerRe: Cool Pin
Vincent DUVERNET (Nolmë Informatique)29-Aug-06 22:09
memberVincent DUVERNET (Nolmë Informatique)29-Aug-06 22:09 
GeneralImpressive! Pin
Danilo Corallo20-Jul-06 4:16
memberDanilo Corallo20-Jul-06 4:16 
GeneralNice Try Pin
Sendilkumar.M24-May-06 19:27
memberSendilkumar.M24-May-06 19:27 
GeneralVery Nice Pin
Paul Conrad24-May-06 17:53
memberPaul Conrad24-May-06 17:53 
GeneralSave & Print Pin
Chestah18-May-06 0:27
memberChestah18-May-06 0:27 
GeneralRe: Save & Print Pin
Vincent DUVERNET (Nolmë Informatique)18-May-06 1:26
memberVincent DUVERNET (Nolmë Informatique)18-May-06 1:26 
JokeRe: Save & Print Pin
Chestah18-May-06 12:04
memberChestah18-May-06 12:04 
Questionlicensing / usage query Pin
SimonS11-Apr-06 6:18
memberSimonS11-Apr-06 6:18 
AnswerRe: licensing / usage query Pin
Vincent DUVERNET (Nolmë Informatique)11-Apr-06 8:04
memberVincent DUVERNET (Nolmë Informatique)11-Apr-06 8:04 
GeneralRe: licensing / usage query Pin
SimonS11-Apr-06 8:15
memberSimonS11-Apr-06 8:15 
GeneralRe: licensing / usage query Pin
Vincent DUVERNET (Nolmë Informatique)11-Apr-06 8:38
memberVincent DUVERNET (Nolmë Informatique)11-Apr-06 8:38 
GeneralFlickering Pin
timbits2147-Apr-06 21:54
membertimbits2147-Apr-06 21:54 
GeneralThanks Pin
Alex Danvy4-Apr-06 8:10
memberAlex Danvy4-Apr-06 8:10 
GeneralExcellent control (possible bug?) Pin
Dieter Buecherl30-Mar-06 2:14
memberDieter Buecherl30-Mar-06 2:14 
GeneralRe: Excellent control (possible bug?) Pin
Vincent DUVERNET (Nolmë Informatique)30-Mar-06 22:22
memberVincent DUVERNET (Nolmë Informatique)30-Mar-06 22:22 
GeneralRe: Excellent control (possible bug?) Pin
Dieter Buecherl30-Mar-06 22:47
memberDieter Buecherl30-Mar-06 22:47 
GeneralASP.NET Pin
DeKale19-Oct-05 0:17
memberDeKale19-Oct-05 0:17 
GeneralRe: ASP.NET Pin
Vincent DUVERNET (Nolmë Informatique)19-Oct-05 8:05
memberVincent DUVERNET (Nolmë Informatique)19-Oct-05 8:05 
GeneralGreat Work Pin
Sidhartha Shenoy13-Oct-05 19:05
memberSidhartha Shenoy13-Oct-05 19:05 
Generalvery nice job Pin
Bnaya Eshet12-Oct-05 21:41
sussBnaya Eshet12-Oct-05 21:41 
GeneralMerci! Pin
Dave Veeneman11-Oct-05 8:09
memberDave Veeneman11-Oct-05 8:09 
General3D Surface Pin
Majid Shahabfar11-Oct-05 2:33
memberMajid Shahabfar11-Oct-05 2:33 
GeneralRe: 3D Surface Pin
Vincent DUVERNET (Nolmë Informatique)11-Oct-05 2:42
memberVincent DUVERNET (Nolmë Informatique)11-Oct-05 2:42 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web03 | 2.8.151120.1 | Last Updated 24 May 2006
Article Copyright 2005 by Vincent DUVERNET (Nolmë Informatique)
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid