TCountourSeries.OnClick has an error

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
WilliEbert
Newbie
Newbie
Posts: 26
Joined: Wed Aug 25, 2010 12:00 am

TCountourSeries.OnClick has an error

Post by WilliEbert » Fri Nov 12, 2010 5:41 pm

Hello,
we use TeeChartPro 2010 version 11004. The OnClick event of a TContourSeries does not work like expected. If we click on a TContourSeries in a Chart (3D is false) this procedure shows not allays values:

procedure TGraphForm.ContourSeries2Click(Sender: TChartSeries;
ValueIndex: Integer; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
var xk,yk, zk : Extended;
begin
xk := ContourSeries2.XValues [ ValueIndex ];
yk := ContourSeries2.YValues [ ValueIndex ];
zk := ContourSeries2.ZValues [ ValueIndex ];


StatusBar1.Panels[1].text := 'x = '+FloatToStr ( xk );
StatusBar1.Panels[2].text := 'y = '+FloatToStr ( yk );
StatusBar1.Panels[3].text := 'z = '+FloatToStr ( zk );
end;

There was an error in TLineSeries.OnCick in TeeChart 2010. too. Can it be there is another in TContourSeries.OnClick?

Your sincerely

Willi Ebert

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

Re: TCountourSeries.OnClick has an error

Post by Yeray » Tue Nov 16, 2010 9:28 am

Hi Willi,

I'm trying to reproduce it with the following code but I can't. Could you please try it and tell us if it works as you expected?
Could you please modify it so we can reproduce the problem here?

Code: Select all

uses TeeSurfa;

var Series1: TColorGridSeries;

procedure TForm1.FormCreate(Sender: TObject);
begin
  Chart1.View3D:=false;
  Chart1.Legend.Visible:=false;

  Series1:=Chart1.AddSeries(TColorGridSeries) as TColorGridSeries;
  Series1.FillSampleValues();
  Series1.Marks.Visible:=true;
  Series1.OnClick:=Series1Click;
end;

procedure TForm1.Series1Click(Sender: TChartSeries; ValueIndex: Integer;
  Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
var xk,yk, zk : Extended;
begin
  xk:=Series1.XValues[ValueIndex];
  yk:=Series1.YValues[ValueIndex];
  zk:=Series1.ZValues[ValueIndex];

  Chart1.Title.Text.Text:='(X: ' + FloatToStr(xk) + ', Y: ' + FormatFloat('#0.000',yk) + ', Z: ' + FloatToStr(zk) + ')';
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

WilliEbert
Newbie
Newbie
Posts: 26
Joined: Wed Aug 25, 2010 12:00 am

Re: TCountourSeries.OnClick has an error

Post by WilliEbert » Tue Nov 16, 2010 8:00 pm

Hello Yeray,
your sample didn't work, too. I will send you this sample without the .exe, because your limit of file size is to little.

Your sincerely

Willi
Attachments
Neuer Ordner.zip
(13.04 KiB) Downloaded 569 times

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

Re: TCountourSeries.OnClick has an error

Post by Yeray » Wed Nov 17, 2010 10:46 am

Hi Willi,

I see in your project's dfm that you've set the Left Axis to be non automatic. Adding the following line to your project, it seems to work as expected:

Code: Select all

Chart1.Axes.Left.Automatic:=true;
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

WilliEbert
Newbie
Newbie
Posts: 26
Joined: Wed Aug 25, 2010 12:00 am

Re: TCountourSeries.OnClick has an error

Post by WilliEbert » Wed Nov 17, 2010 2:33 pm

Hello Yeray,
with TColorGridSeries the error is gone. But my problem is with TContourSeries. Only about every fourth click changed the title like expected. I think every click in the Contour should change the tile.I will send you the changed source

Your sincerely

Willi
Attachments
Neuer Ordner.zip
(10.71 KiB) Downloaded 573 times

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

Re: TCountourSeries.OnClick has an error

Post by Yeray » Thu Nov 18, 2010 2:28 pm

Hi Willi,

Excuse me, it seems I read TColorGridSeries where you wrote TContourSeries. :oops:
WilliEbert wrote:Only about every fourth click changed the title like expected. I think every click in the Contour should change the tile.I will send you the changed source
Every time I click on a line, the title seems to be updated. Of course, if you click several times in the same level line, you won't see the update in the title.
You can check it adding a counter.

There can also be a problem with the precision. You can try making the lines wider.

Here it is the code modified:

Code: Select all

uses TeeSurfa;

var Series1: TContourSeries;
    n: Integer;

procedure TForm2.FormCreate(Sender: TObject);
begin
  Chart1.View3D:=false;
  Chart1.Legend.Visible:=false;

  Series1:=Chart1.AddSeries(TContourSeries) as TContourSeries;
  Series1.FillSampleValues();
  Series1.Marks.Visible:=true;
  Series1.OnClick:=Series1Click;

  Series1.Pen.Width:=5;
  n:=0;
end;

procedure TForm2.Series1Click(Sender: TChartSeries; ValueIndex: Integer;
  Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
var xk,yk, zk : Extended;
    SegmentIndex, PointIndex: Integer;
begin
  xk:=Series1.XValues[ValueIndex];
  yk:=Series1.YValues[ValueIndex];
  zk:=Series1.ZValues[ValueIndex];

  Inc(n);
  Chart1.Title.Text.Text:='n: ' + IntToStr(n) + ' (X: ' + FloatToStr(xk) + ', Y: ' + FormatFloat('#0.000',yk) + ', Z: ' + FloatToStr(zk) + ')';
  Chart1.Title.Text.Text:=Chart1.Title.Text.Text + ' Level UpToValue: ' + FormatFloat('#0.000', Series1.Levels[Series1.Levels.Clicked(X, Y, SegmentIndex, PointIndex)].UpToValue);
end;
Note that I've also used TContourLevels.Clicked function to get the Level UpToValue.
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

WilliEbert
Newbie
Newbie
Posts: 26
Joined: Wed Aug 25, 2010 12:00 am

Re: TCountourSeries.OnClick has an error

Post by WilliEbert » Thu Nov 18, 2010 3:14 pm

Hello Yeray,
i see the problem yet. Because in our Charts are about 100000 Points i can't make the lines thicker and i can't make the marks visible. And i was wrong, i though the click event is even generated if i click between the contour lines. Our customer wants the values of the of a specific sample chart (see picture) . So it is very hard to point to a single contour line to get the value. We need a event that give us the series value even our customer clicked between two contour lines. Is this possible?

Your sincerely

Willi
Attachments
test.png
test.png (61.98 KiB) Viewed 9045 times

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

Re: TCountourSeries.OnClick has an error

Post by Yeray » Thu Nov 18, 2010 4:06 pm

Hi Willi,

In that case I'm afraid that the TContourSeries.Clicked method can't retrieve if the space between the levels because it is not part of the Series itself.
However, have you tried with a TIsoSurfaceSeries?
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