Solved

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

Posted on 2014-12-09
73 Views
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
Question by:PieFormer
[X]
###### Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

• Help others & share knowledge
• Earn cash & points
• 2

LVL 24

Accepted Solution

mankowitz earned 500 total points
ID: 40490409
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

ID: 41717663
I think this answers the question.
0

## Featured Post

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

zlib is a free compression library (a DLL) on which the popular gzip utility is built.  In this article, we'll see how to use the zlib functions to compress and decompress data in memory; that is, without needing to use a temporary file.  We'll be c…
This article surveys and compares options for encoding and decoding base64 data.  It includes source code in C++ as well as examples of how to use standard Windows API functions for these tasks. We'll look at the algorithms — how encoding and decodi…
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…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…
###### Suggested Courses
Course of the Month4 days, 7 hours left to enroll