Solved

How to calculate the percentage in a pie chart using vb.net

Posted on 2014-12-09
4
45 Views
Last Modified: 2016-07-18
Number not in pie slices
For i As Integer = 1 To values.Length
  col = (100 + 10 * Math.Cos(angles(i)))
  If angles(i) > pi / 2 And angles(i) < 3 * pi / 2 Then col = col - 6
  row = (100 - 100 * Math.Sin(angles(i)))
  If angles(i) >= pi Then row = row - 100
  gr.DrawString(values(i - 1), Me.Font, Brushes.Black, (col + 200) / 2, (row + 300) / 2)
Next
0
Comment
Question by:PieFormer
  • 2
4 Comments
 
LVL 24

Accepted Solution

by:
mankowitz earned 500 total points
Comment Utility
It looks as if you have already computed the angles for each pie wedge, so if you need to figure out the percentage, it should just be the angle/2pi,

percentage = angles(i)/(2*pi)*100
0
 
LVL 24

Expert Comment

by:mankowitz
Comment Utility
I think this answers the question.
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

This article describes how to add a user-defined command button to the Windows 7 Explorer toolbar.  In the previous article (http://www.experts-exchange.com/A_2172.html), we saw how to put the Delete button back there where it belongs.  "Delete" is …
For most people, the WrapPanel seems like a magic when they switch from WinForms to WPF. Most of us will think that the code that is used to write a control like that would be difficult. However, most of the work is done by the WPF engine, and the W…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
This video discusses moving either the default database or any database to a new volume.

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

7 Experts available now in Live!

Get 1:1 Help Now