Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Pie chart off two Edit fields 1

Status
Not open for further replies.

ukusa

Programmer
Oct 8, 2001
49
AU
Well, I'm stumped as I haven't played around with charts in Delphi before. In my Import and Export Records funtion, I have two edit fields not adjoined to a table giving the Rejected and used counts. I don't want to use a table to record the values, is there any way I can just read the values on the form itself where the chart is and from those fields and have the Pie chart read them directly?

Thanks
Allen
 
Delphi provides a component called TChart (found in the 'Additional' components tab). You can just drop this on the form where you wanna see the graph. Double-click on the placed component to access the Chart Editor (which gives you a host of options). You'll need to add a series, selecting pie chart as the appropriate graph. Drop a button on the form, and in its' OnClick event write some code to populate the graph. Something like this should work (1st parameter is your numerical value, 2nd parameter is a label for that value):
Code:
with Series1 do
begin
  Add(Rejected_Number, 'Rejected');
  Add(Used_Number , 'Used');
end;

Hope this helps!
Happy charting! ;-)

Clive
 

Thank you Clive!

Works brilliantly.

Allen B-)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top