procedure TChartBox.ConfigureAxisTransformation(var AChartPane: TChartPane);
var
paneIndex: Integer;
neighborPane: TChartPane;
dividerPane: TChartPane;
begin
if PaneCount = 1 then
begin
// A pane has already been added, i.e. Count is 1 for the first pane.
// The pane with index 0 does not contain a divider line.
AChartPane.AutoScaleAxisTransform.MinValue := HALF_GAP;
AChartPane.AutoScaleAxisTransform.MaxValue := DEFAULT_PANE_SIZE - HALF_GAP - CAPTION_SIZE;
exit;
end;
paneIndex := Panes.IndexOf(AChartPane);
// The pane has been added at the top of the pane stack. (Top of Chart)
if paneIndex = PaneCount-1 then
begin
neighborPane := GetChartPane(paneIndex-1);
AChartPane.AutoScaleAxisTransform.MinValue :=
neighborPane.AutoScaleAxisTransform.MaxValue + 2*HALF_GAP;
AChartPane.AutoScaleAxisTransform.MaxValue :=
AChartPane.AutoScaleAxisTransform.MinValue + DEFAULT_PANE_SIZE
- 2*HALF_GAP - CAPTION_SIZE;
// The divider line will be added in the current pane at the bottom.
dividerPane := AChartPane;
end else
// The pane has been added at the bottom of the pane stack. (Bottom of Chart)
if paneIndex = 0 then
begin
neighborPane := GetChartPane(paneIndex+1);
AChartPane.AutoScaleAxisTransform.MaxValue :=
neighborPane.AutoScaleAxisTransform.MinValue - 2*HALF_GAP - CAPTION_SIZE;
AChartPane.AutoScaleAxisTransform.MinValue :=
AChartPane.AutoScaleAxisTransform.MaxValue - DEFAULT_PANE_SIZE + 2*HALF_GAP;
// The divider line will be added at the bottom of the neighbor pane.
dividerPane := neighborPane;
end else
exit;
// Set up the divider line...
dividerPane.Divider := TConstantline.Create(FChart);
dividerPane.Divider.Legend.Visible := false;
dividerPane.Divider.Position := dividerPane.AutoScaleAxisTransform.MinValue - HALF_GAP;
FChart.AddSeries(dividerPane.Divider);
end;