How to change the view angle and label value of a chart .NET C#

Posted by George on Stack Overflow See other posts from Stack Overflow or by George
Published on 2011-02-22T15:09:42Z Indexed on 2011/02/22 15:24 UTC
Read the original article Hit count: 340

Filed under:
|
|
|
|

Short Description

I am using charts for a specific application where i need to change the view angle of the rendered 3D Pie chart and value of automatic labels from pie label names to corresponding pie values.

This how the chart looks: Pie Chart


Initialization

This is how i initialize it:

    Dictionary<string, decimal> secondPersonsWithValues = HistoryModel.getSecondPersonWithValues();
    decimal[] yValues = new decimal[secondPersonsWithValues.Values.Count]; //VALUES
    string[] xValues = new string[secondPersonsWithValues.Keys.Count]; //LABELS
    secondPersonsWithValues.Keys.CopyTo(xValues, 0);
    secondPersonsWithValues.Values.CopyTo(yValues, 0);
    incomeExpenseChart.Series["Default"].ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Pie;
    incomeExpenseChart.Series["Default"].Points.DataBindXY(xValues, yValues);
    incomeExpenseChart.ChartAreas["Default"].Area3DStyle.Enable3D = true;
    incomeExpenseChart.Series["Default"].CustomProperties = "PieLabelStyle=Outside";
    incomeExpenseChart.Legends["Default"].Enabled = true;
    incomeExpenseChart.ChartAreas["Default"].Area3DStyle.LightStyle = System.Windows.Forms.DataVisualization.Charting.LightStyle.Realistic;
    incomeExpenseChart.Series["Default"]["PieDrawingStyle"] = "SoftEdge";

Basically i am querying data from database using the HistoryModel.getSecondPersonWithValues(); to get pairs as Dictionary<string, decimal> where key is the person and value is ammount.


Problem #1

What i need is to be able to change the marked labels from person names to the ammounts or add another label of ammounts with the same colors (See Image). enter image description here


Problem #2

Another problem is that i need to change the view angle of 3D Pie chart. Maybe it's very simple and I just don't know the needed property or maybe i need to override some paint event. Either ways any kind of ways would be appriciated.

Thanks in advance George.

© Stack Overflow or respective owner

Related posts about c#

Related posts about 3d