
Index
Subject: Re: Creating a Series at runtime
From: zafer@dijital.com.tr (Newsgroups) Steema Software SL
Newsgroup: public.teechart5.delphi
Date: Tue, 03 Oct 2006 10:25:16 +0200
Ron wrote:
> Thanks Martin - that gave me the direction I wanted. I have adapted with
> the following code :-
> TableList := TComponentList.Create(true);
> // Add new series
> for i := 0 to Length(Form1.SectIDArray)-1 do
> begin
> TableList.Add(TTable.Create(Self));
> SerCntr := i;
> with TableList.Items[SerCntr] As TTable do
> begin
> DatabaseName := 'SECINDEX';
> TableName := Form1.SectIDArray[SerCntr][1]+'SECDLY';
> Active := True;
> end;
> DBChart1.AddSeries(TLineSeries.Create(Self));
> DBChart1.Series[SerCntr].DataSource := TableList.Items[SerCntr] As
> TTable;
> DBChart1.Series[SerCntr].YValues.ValueSource := 'CHANGEPC';
> DBChart1.Series[SerCntr].xValues.ValueSource := 'SECDTIME';
> DBChart1.Series[SerCntr].xValues.DateTime := True;
> end;
> Now I have a chart with 32 line series - witht the above component method
> can you please indicate if I can code for a mouse click event on any of the
> series. Rather than 'Series4Click' is there a way to respond with a
> generic click procedure where the Sender indicates which series and then act
> accordingly. How do I code for an onevent relating to the series list? I
> hope my question is clear.
> Thanks
> Ron Etherington
> "Marjan Slatinek" wrote in message
> news:dOx$j2AkEHA.1744@TEEPC.Steema.local...
> > Hi, Ron.
> >
> > > chart? I am using the TeeChart that came with Delphi5 and have looked
> in
> > > the help but I cant find a 'create' action for the series.
> >
> >
> > If you're using TeeChart v4 (version shipped with Delphi), then the
> > following code might work:
> >
> > // Add two series
> > DBChart1.AddSeries(TBarSeries.Create(Self));
> > DBChart1.AddSeries(TBarSeries.Create(Self));
> > // type cast to bar series, then set bar series properties
> > (DBChart1.Series[0] as TBarSeries).MultiBar := mbStacked;
> > (DBChart1.Series[1] as TBarSeries).MultiBar := mbStacked;
> > // connect series to datasource:
> > DBChart1.Series[0].DataSource := Table1;
> > DBChart1.Series[0].YValues.ValueSource := 'YFieldName';
> > DBChart1.Series[1]->DataSource := Table2;
> > DBChart1.Series[1].YValues.ValueSource := 'YFieldName';
> >
> >
> >
> > --
> > Regards,
> >
> > Marjan Slatinek
> > TeeChart Support
> > marjan@steema.com
> > --------------------------------------
> > "Ron" wrote in message
> > news:szxOO8$jEHA.1744@TEEPC.Steema.local...
> > > I want to add several TLineSeries to a dbchart at runtime. So I have
> > > created a chart with no series at design time - how do I create each of
> > the
> > > series at runtime specifying the type of series and attaching it to the
> > > chart? I am using the TeeChart that came with Delphi5 and have looked
> in
> > > the help but I cant find a 'create' action for the series.
> > >
> > > Thanks
> > > Ron Etherington
> > >
> > >
> >
> >