Posting marks left or right for a TPoint3DSeries

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
Jan Lutgert
Newbie
Newbie
Posts: 1
Joined: Mon Jan 02, 2023 12:00 am

Posting marks left or right for a TPoint3DSeries

Post by Jan Lutgert » Wed Sep 13, 2023 1:32 pm

I am visualyzing subsurface borehole data (X,Y,Z) using a TPoint3DSeries. That works fine. However, when I want to display marks with the series that show some text I can only post them above the points. There doesn't seem to be a default option to draw them left or right of a point like there is in Excel (2D) charts.

As most of the boreholes are near vertical this means that the majority of the labels are overlapping and are plotted on top of previous points or labels. Is there a way to solve this?

I have scrutinized answers in the VCL forum but I couldn't find anything that seems to address my particular (3D) problem. Is there a menu setting, or a property setting that I have overlooked? Or is there a way to achieve this in code? If the latter applies, can you point me to an example?

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

Re: Posting marks left or right for a TPoint3DSeries

Post by Yeray » Thu Sep 14, 2023 8:20 am

Hello Jan,

I'm not sure how are you exactly drawing your TPoint3DSeries but here it is an example showing a simple one with all the points with the same XValue.
Here what I'm getting:
VerticalPoint3D_Marks.png
VerticalPoint3D_Marks.png (17.96 KiB) Viewed 15312 times

Code: Select all

uses TeEngine, Chart,  TeePoin3;

var Chart1: TChart;

procedure TForm1.FormCreate(Sender: TObject);
var i: Integer;
begin
  Chart1:=TChart.Create(Self);

  with Chart1 do
  begin
    Parent:=Self;
    Align:=alClient;
    Color:=clWhite;
    Gradient.Visible:=False;
    Walls.Back.Color:=clWhite;
    Walls.Back.Gradient.Visible:=False;
    Legend.Hide;
    //View3D:=False;
    Chart3DPercent:=100;
    View3DOptions.Orthogonal:=False;
    View3DOptions.Zoom:=80;
    View3DOptions.Rotation:=360;
    View3DOptions.Elevation:=360;
  end;

  with TPoint3DSeries(Chart1.AddSeries(TPoint3DSeries)) do
  begin
    Marks.Show;
    Marks.Automatic.Move:=False;
    Marks.ArrowLength:=10;
    LinePen.Hide;

    for i:=0 to 19 do
      AddXYZ(0, i, random*3);

    Chart1.Draw;
    OnGetMarkText:=SeriesGetMarkText;
  end;
end;

Procedure TForm1.SeriesGetMarkText(Sender:TChartSeries; ValueIndex:Integer; var MarkText:String);
var
  APosition: TSeriesMarkPosition;
  XPos,YPos: Integer;
const XOff=0;
const YOff=0;
begin
  inherited;

  with Sender do
  begin
    APosition:=Marks.Positions[ValueIndex];

    if APosition=nil then
    begin
      APosition:=TSeriesMarkPosition.Create;
      APosition.Custom:=True;
    end;

    XPos:=CalcXPos(ValueIndex);
    YPos:=CalcYPos(ValueIndex);
    APosition.LeftTop.X:=XPos+Marks.ArrowLength+Round(XOff);
    APosition.LeftTop.Y:=YPos-(APosition.Height div 2)+Round(YOff);
    APosition.ArrowFrom:=Point(XPos,YPos);
    APosition.ArrowTo:=Point(APosition.LeftTop.X+(APosition.Width div 2),APosition.LeftTop.Y+(APosition.Height div 2));
    Marks.Positions[ValueIndex]:=APosition;
  end;
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

Post Reply