Solved

Pascal pie charts

Posted on 1997-12-01
2
506 Views
Last Modified: 2012-06-21
Can anybody tell me how to create a pie chart in pascal.  The user must enter in the numbers to be represented> Thanks.
0
Comment
Question by:Pundit
  • 2
2 Comments
 
LVL 2

Accepted Solution

by:
mitchell042997 earned 70 total points
ID: 1216934
Do you know how to do basic graphics in pascal?  You will use graph.tpu, so you will need to add:

   uses graph;

now, look in help for the command titled arc.

The basics behind drawing a pie chart are as follows.  You must first determine the probability of each of your "wedges".  For example, if you had a pie chart representing a group's hobbies, and the sample was taken from 10 people, and 4 said reading, 2 said walking, 1 said modelling, and 3 said programming, then get probabilities for all activities (3/10, for programmers, 4/10 for reading, etc.)  Now, take that decimal number, and multiply it times 2*pi.  This is the amount of radians each will take up.  If you need it in degrees, multiply each decimal by 360.  Then just do a simple loop which starts at 0 degrees or 0 radians, and steps through each activity, drawing from the current radian to the current radian plus the activities allocated radians.  Once drawn, adjust the current radian setting to the current radian setting previously, plus the current activity's alloted radians.
0
 
LVL 2

Expert Comment

by:mitchell042997
ID: 1216935
Has this been helpful?  If so, please grade the answer, else tell me what further information you need and I will gladly supply it!  :)  Happy programming...
0

Featured Post

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Suppress UAC Prompt using shellapi 6 485
How do you invoke TCharHelper 1 1,969
Programmatically drawing the lines in a delphi drawgrid and merge cells 9 1,302
Convert date 6 404
In this article we will learn how to backup a VMware farm using Nakivo Backup & Replication. In this tutorial we will install the software on a Windows 2012 R2 Server.
Each year, investment in cloud platforms grows more than 20% (https://www.immun.io/hubfs/Immunio_2016/Content/Marketing/Cloud-Security-Report-2016.pdf?submissionGuid=a8d80a00-6fee-4b85-81db-a4e28f681762) as an increasing number of companies begin to…
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

777 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