Solved

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

Posted on 2014-12-09
4
66 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
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

by:mankowitz
ID: 41717663
I think this answers the question.
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

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 …
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…

740 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