Page 1 of 1

Draw chart grid lines crossing points

Posted: Fri Nov 03, 2023 12:59 pm
by 18695778
Hello, is it possible to draw the crossing points of the axes grid lines only?

Re: Draw chart grid lines crossing points

Posted: Fri Nov 03, 2023 2:51 pm
by yeray
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;

Re: Draw chart grid lines crossing points

Posted: Mon Nov 06, 2023 4:08 pm
by 18695778
Thank you for the code, it works fine!