How to find the series type in a chart.

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
Errol
Newbie
Newbie
Posts: 75
Joined: Thu Jul 11, 2013 12:00 am

How to find the series type in a chart.

Post by Errol » Sat Feb 06, 2016 4:24 am

My program creates a chart with a mixture of line series, fast line series, point series and bar series. I am using MultiBar := mbStacked (as I want to place my stacked bars at specified x-axis positions), which means that I have to generate a new series for each segment in the stacked bar.

When I select some new data, I want to clear only the bar series from the chart and leave the other series (which will be refreshed). How do I find the series type of each item in SeriesList, and how do I remove only bar series from the chart, without having to generate a parallel list of series types.

Thanks in advance

Errol

Yeray
Site Admin
Site Admin
Posts: 9612
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: How to find the series type in a chart.

Post by Yeray » Mon Feb 08, 2016 12:04 pm

Hello Errol,

You can loop your series list and check the class of a series with "is" keyword. Ie:

Code: Select all

  for i:=Chart1.SeriesCount-1 downto 0 do
    if Chart1[i] is TBarSeries then
      Chart1.RemoveSeries(i);
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

Post Reply