How to get xyz-Values from contour plots?

TeeChart for ActiveX, COM and ASP
Post Reply
Raimund
Newbie
Newbie
Posts: 2
Joined: Mon Jul 28, 2014 12:00 am

How to get xyz-Values from contour plots?

Post by Raimund » Mon Sep 29, 2014 4:14 pm

Hello together,

my program (c++ with teechart Activex) produces a contour plot from a huge xyz-array. I try to show the user these values if he click on the chart at runtime.

For 2d-series I do this with the event OnClickSeries(...), but it does not work with contour plots.

Could anyone explain me, how I could do this?

Regards
Raimund

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

Re: How to get xyz-Values from contour plots?

Post by Yeray » Tue Sep 30, 2014 8:37 am

Hi Raimund,

I've made a simple example in VB6 to check this:

Code: Select all

Private Sub Form_Load() 
  TChart1.Header.Text.Clear
  TChart1.Header.Text.Add TChart1.Version
  TChart1.Aspect.View3D = False

  TChart1.AddSeries scContour
  TChart1.Series(0).FillSampleValues
  TChart1.Series(0).Marks.Visible = True
  TChart1.Series(0).Marks.Transparent = True
  TChart1.Series(0).asContour.Filled = False
End Sub

Private Sub TChart1_OnClickSeries(ByVal SeriesIndex As Long, ByVal ValueIndex As Long, ByVal Button As TeeChart.EMouseButton, ByVal Shift As TeeChart.EShiftState, ByVal X As Long, ByVal Y As Long)
  If (SeriesIndex >= 0) And (TChart1.SeriesCount > 0) And (TChart1.Series(SeriesIndex).Count > 0) And (ValueIndex >= 0) Then
    Caption = Format$(TChart1.Series(SeriesIndex).asContour.Levels.Items(ValueIndex).UpToValue, "#0.###")
  End If
End Sub
ContourClick.png
ContourClick.png (42.15 KiB) Viewed 10976 times
And I've also made the same example in Delphi using TeeChart VCL (note TeeChart ActiveX is a wrapper from the VCL version):

Code: Select all

uses TeeSurfa;

var Chart1: TChart;

procedure TForm1.FormCreate(Sender: TObject);
begin
  Chart1:=TChart.Create(Self);
  Chart1.Parent:=Self;
  Chart1.Align:=alClient;

  Chart1.View3D:=false;

  with Chart1.AddSeries(TContourSeries) as TContourSeries do
  begin
    FillSampleValues;
    Marks.Visible:=true;
    OnClick:=ContourOnClick;
  end;
end;

procedure TForm1.ContourOnClick(Sender:TChartSeries; ValueIndex:Integer; Button:TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
  if (Sender<>nil) And (Sender.Count > 0) And (ValueIndex >= 0) Then
    Caption := 'Index: ' + IntToStr(ValueIndex) + ', Level: ' + FormatFloat( '#0.###', (Sender as TContourSeries).Levels.Items[ValueIndex].UpToValue);
end;
I see the event is fired when you click on the levels, not when you click on the filled area.
How would you expect it to work?
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

Raimund
Newbie
Newbie
Posts: 2
Joined: Mon Jul 28, 2014 12:00 am

Re: How to get xyz-Values from contour plots?

Post by Raimund » Tue Sep 30, 2014 2:01 pm

Hi Yeray,

OnClickSeries(...) only works, if I click on the countour line. My contour plot ist filed without drawn contour lines. I need the values also if the user clicks between two contour lines.

Regards
Raimund

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

Re: How to get xyz-Values from contour plots?

Post by Yeray » Tue Sep 30, 2014 3:17 pm

Hi Raimund,

Take a look at the discussion some time ago took place here.
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