When adding custom axes in Tchart, the alignment and positioning of the axis and particular the titles for these extra customAxes seems to be a little "off."
In those cases, for delphi, you have made a code that takes care of this, see below:
Should a similar code be used for .NET?
Code: Select all
procedure TFMainForm.PlaceAxes(nSeries: Integer=0; NextXLeft: Integer=0; NextXRight: Integer=0; MargLeft: Integer=10; MargRight: Integer=10);
const extraPos = 62;
const extraMargin = 100;
begin
AfBildningChart1.MarginLeft := 0;
AfBildningChart1.MarginRight := 0;
if (AfBildningChart1.CustomAxes.Count > 0) then
begin
if AfBildningChart1.CustomAxes.Items[nSeries].OtherSide and AfBildningChart1.CustomAxes.Items[nSeries].Visible then
begin
AfBildningChart1.CustomAxes.Items[nSeries].PositionPercent := NextXRight;
NextXRight := NextXRight - AfBildningChart1.CustomAxes.Items[nSeries].MaxLabelsWidth - AfBildningChart1.CustomAxes.Items[nSeries].TickLength - extraPos;
MargRight := MargRight + extraMargin;
end
else if AfBildningChart1.CustomAxes.Items[nSeries].Visible then
begin
AfBildningChart1.CustomAxes.Items[nSeries].PositionPercent := NextXLeft;
NextXLeft := NextXLeft - AfBildningChart1.CustomAxes.Items[nSeries].MaxLabelsWidth - AfBildningChart1.CustomAxes.Items[nSeries].TickLength - extraPos;
MargLeft := MargLeft + extraMargin;
end;
end;
AfBildningChart1.MarginLeft := MargLeft;
AfBildningChart1.MarginRight := MargRight;
AfBildningChart1.MarginBottom := 20;
nSeries := nSeries + 1;
if (nSeries < AfBildningChart1.CustomAxes.Count) then
begin
PlaceAxes(nSeries, NextXLeft, NextXRight, MargLeft, MargRight);
end;
// showmessage('MargLeft' + inttostr(MargLeft) + ' MargRight=' + inttostr(MargRight));
end;