AxisBehind and inverted axes

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
Toreba
Newbie
Newbie
Posts: 3
Joined: Fri Aug 10, 2018 12:00 am

AxisBehind and inverted axes

Post by Toreba » Tue Feb 12, 2019 12:59 pm

Hi,

Is there a setting somewhere that allows the axes to be drawn over the series lines, but the grid lines to remain under the series?

Regards

Toreba

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

Re: AxisBehind and inverted axes

Post by Yeray » Mon Feb 18, 2019 11:06 am

Hello,

You could set the axes to be drawn on top setting DrawBehind to False. Then, you could Hide the Grids and manually draw them at OnBeforeDrawSeries event. Ie:

Code: Select all

uses Series;

procedure TForm1.FormCreate(Sender: TObject);
begin
  Chart1.View3D:=False;
  Chart1.Legend.Hide;

  Chart1.Axes.Behind:=False;
  Chart1.Axes.Left.PositionPercent:=50;
  Chart1.Axes.Left.Grid.Hide;
  Chart1.Axes.Bottom.PositionPercent:=50;
  Chart1.Axes.Bottom.Grid.Hide;

  Chart1.AddSeries(TBarSeries).FillSampleValues(3);

  Chart1.Draw;
end;

type TChartAxisAccess = class(TChartAxis);

procedure TForm1.Chart1BeforeDrawSeries(Sender: TObject);
begin
  Chart1.Axes.Left.Grid.Show;
  TChartAxisAccess(Chart1.Axes.Left).DrawGrids(Chart1.Axes.Left.Items.Count);
  Chart1.Axes.Left.Grid.Hide;

  Chart1.Axes.Bottom.Grid.Show;
  TChartAxisAccess(Chart1.Axes.Bottom).DrawGrids(Chart1.Axes.Bottom.Items.Count);
  Chart1.Axes.Bottom.Grid.Hide;
end;
Project1_2019-02-18_12-03-59.png
Project1_2019-02-18_12-03-59.png (13.81 KiB) Viewed 6508 times
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