Draw chart grid lines crossing points

TeeChart FireMonkey (Windows,OSX,iOS & Android) for Embarcadero RAD Studio, Delphi and C++ Builder (XE5+)
Post Reply
InfraTec
Newbie
Newbie
Posts: 16
Joined: Tue May 09, 2023 12:00 am

Draw chart grid lines crossing points

Post by InfraTec » Fri Nov 03, 2023 12:59 pm

Hello, is it possible to draw the crossing points of the axes grid lines only?

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

Re: Draw chart grid lines crossing points

Post by Yeray » Fri Nov 03, 2023 2:51 pm

Hello,

You could draw it manually at the OnBeforeDrawSeries event as follows:

Code: Select all

procedure TForm1.Chart1BeforeDrawSeries(Sender:TObject);
var i, j: Integer;
begin
  Chart1.Canvas.AssignVisiblePen(Chart1.Axes.Left.Grid);
  Chart1.Canvas.Pen.Style:=psSolid;
  for i:=0 to Length(Chart1.Axes.Left.Tick)-1 do
    for j:=0 to Length(Chart1.Axes.Bottom.Tick)-1 do
    begin
      Chart1.Canvas.HorizLine3D(Chart1.Axes.Bottom.Tick[j]-2, Chart1.Axes.Bottom.Tick[j]+2, Chart1.Axes.Left.Tick[i], Chart1.Width3D);
      Chart1.Canvas.VertLine3D(Chart1.Axes.Bottom.Tick[j], Chart1.Axes.Left.Tick[i]-2, Chart1.Axes.Left.Tick[i]+2, Chart1.Width3D);
    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

InfraTec
Newbie
Newbie
Posts: 16
Joined: Tue May 09, 2023 12:00 am

Re: Draw chart grid lines crossing points

Post by InfraTec » Mon Nov 06, 2023 4:08 pm

Thank you for the code, it works fine!

Post Reply