xCHAN
xCHAN

Reputation: 118

C# - Start Pie Chart Values at the Top of the Pie

okay so I have this task to make a chart, that would start the data horizontally. Meaning 90degrees to the right(always). same as this in the picture below.

enter image description here

enter image description here

is this even possible? I accomplish the above picture using:

Chart1.ChartAreas["ChartArea1"].Area3DStyle.Rotation = 90;

but the problem is it only works for two data. Other than the 2 data, the pie rotates to its desired behaviour. Like in this image below. which produces 5 data in the chart.

enter image description here

UPDATE

In simple terms I would like to achieve this.

Upvotes: 1

Views: 2215

Answers (3)

Mert Atmaca
Mert Atmaca

Reputation: 73

The property you are looking for is actually available. On Form.cs (design window) right click on the chart and click properties.

then go to Series->Custom Properties->PieStartAngle. 

It's default 0 and it looks like 90. When you change it to 270 your problem will solve.

Btw, you can't write it like

chart1.Series[0].CustomProperties.PieStartAngle = 270;

You only can edit from the design window.

Upvotes: 0

theDrifter
theDrifter

Reputation: 1696

I found another solution here if your chart is not using 3D styles:

c.Series["s1"]["PieStartAngle"] = "270"

Upvotes: 0

xCHAN
xCHAN

Reputation: 118

Lucky me! i found the answer with my curiosity.

For the sake of those who are also facing this problem. So the easy answer I was looking for was

Chart1.ChartAreas["ChartArea1"].Area3DStyle.Rotation = -90;


NOTE:
Rotation accept values up until 180 range only. Because i had this exception error when i tried to put a 270 value.

Exception of type 'System.ArgumentOutOfRangeException' occurred in System.Web.DataVisualization.dll, but did not handle in the user code

Additional Information: angle of rotation must be specified in the range of -180 to 180 degrees.

Upvotes: 1

Related Questions