• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1504
  • Last Modified:

Pie chart

Given a stringlist containing info that resembles this:
abc 25
def 13
ghi 18
...
I want to create a pie chart in my Delphi 3 program...

I have NO IDEA on how to use/create a  delphi pie chart, but I need one for my program.

If any of you experts out there are willing to guide me throught this step by step until completion... I'm willing to give 350 points (I'll upgrade the points before completion)

Thanks
0
rafy
Asked:
rafy
  • 3
  • 2
1 Solution
 
westy100697Commented:
I have some code that I used for the TChart component to build a bar graph. It is pretty simple and powerful once you get into it. It was exactly what I was after . i will put some code in here and see if that helps you.

var  {Global Variables}
    SeriesValB : TBarSeries ;
    SeriesValL : TLineSeries ;
    SeriesValP : TPointSeries ;
    i : Integer ;
    Xlabel : String ;
    XVal,YVal : Real ;
implementation

procedure TViewGraphForm.GetGraphData ;
begin
    SeriesValB := TBarSeries.Create(Self) ;
    SeriesValB.BarStyle := bsRectangle ;
   {Other options for styles}
     SeriesValB.BarStyle := bsPyramid ;
     XVal := xdata ;
     yVal := ydata      
     SeriesValB.AddXY(XVal,YVal,Xlabel,PointColor) ;

    SeriesValL := TLineSeries.Create(Self) ;
    XVal := xdata ;
    yVal := ydata;
    SeriesValL.AddXY(XVal,YVal,Xlabel,PointColor) ;
end;

procedure TViewGraphForm.ViewGBtnClick(Sender: TObject);
begin
  GetGraphData ;
  Chart1.View3D := true
  Chart1.AddSeries(SeriesValB) ;
  Chart1.GetASeries ;
end;


You will have to adapt it to suit a TCircleSeries (Pie Chart) but hope this helps a bit... :)

WESTY
0
 
rafyAuthor Commented:
Thanks... Your code was very helpful, I upped the points to 200... is that OK?? (Less than promised, but help wasn't exactly step by step... still had to do a lot on my own)

I'll grade the question and transfer the points to you after you confirm that this is OK with you...Fair enough??

Anyways thanks again...and yes you are right... this is very powerful once you figure out how to use it.
 
0
 
westy100697Commented:
rafy,
      No problems yeh I have just started to use all the Chart functions to their full and it kicks ass over D1 and D2. Thought I would just post up some of the code i used and let you delve into a bit deeper as you would probably learn more yourself. I have no probs with above and glad i could help. Nothing worse than getting stuck eh.

WESTY 8)
0
 
rafyAuthor Commented:
Cool... At least I know now that there's an expert that will be able to help me out with Charts if I get stuck again...
0
 
westy100697Commented:
Excellent, glad I could help. This delphi area is so good for getting quick responses eh.
Makes it worthwile to ask questions I reckon. Points aren't what its about.. more about getting the knowledge to take your programming further.

WESTY


0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now