Statistics ChartTool

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
Zach A
Newbie
Newbie
Posts: 6
Joined: Mon Oct 05, 2020 12:00 am

Statistics ChartTool

Post by Zach A » Fri Dec 03, 2021 6:38 pm

I am running into the following problem
a) I have created a new chart tool
b) I activate the charttool in code
c) I assigned a series to it
d) I have created a Tstring variable to hold results

when running the code I am getting an "access violation" error. See code below

Code: Select all

var
  sLines : TStrings;
  MyPoints: Array [0 .. 10] of TPointSeries;

      //code to format chart
      chartTool3.Active := true;
      chartTool3.Series := MyPoints[iseries];
     //code to populate  MyPoints[iseries] 
    chartTool3.Statistics(sLines); // access violation
Any help would be appreciated

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

Re: Statistics ChartTool

Post by Yeray » Tue Dec 07, 2021 10:14 am

Hello,

Give it a try at the example bellow, which seems to work fine for me here. Just drop a TChart and a TMemo into the form at design time.

Code: Select all

uses Series, TeeSeriesStats;

procedure TForm1.FormCreate(Sender: TObject);
var Series1: TLineSeries;
    SeriesStats: TSeriesStatsTool;
begin
  Chart1.View3D:=False;
  Chart1.Legend.Hide;
  Chart1.Gradient.Visible:=False;
  Chart1.Color:=clWhite;
  Chart1.Walls.Back.Gradient.Visible:=False;
  Chart1.Walls.Back.Color:=clWhite;

  Series1:=TLineSeries(Chart1.AddSeries(TLineSeries));
  Series1.FillSampleValues;

  SeriesStats:=TSeriesStatsTool.Create(self);
  with SeriesStats do
  begin
    Series:=Series1;
  end;
  Chart1.Tools.Add(SeriesStats);

  SeriesStats.Statistics(Memo1.Lines);
end;
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

Zach A
Newbie
Newbie
Posts: 6
Joined: Mon Oct 05, 2020 12:00 am

Re: Statistics ChartTool

Post by Zach A » Tue Dec 07, 2021 5:06 pm

That works. Thanks a lot.

Post Reply