Page 1 of 1
AxisBehind and inverted axes
Posted: Tue Feb 12, 2019 12:59 pm
by 16584238
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
Re: AxisBehind and inverted axes
Posted: Mon Feb 18, 2019 11:06 am
by yeray
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 (13.81 KiB) Viewed 6493 times