Page 1 of 1

The same procedure yields different axes properties

Posted: Sun Jan 07, 2018 5:15 am
by 16582574
To draw two PolarSeries Charts, and using TSubChartTool draws the second Chart. The two Charts (named TheChart and SubChart) have the same sizes and arrange horizontally (see the Fig. attached).

1. To keep the axes properties of the two Charts are the same, I write a procedure as follows:

Code: Select all

procedure TfrmPolar2D.GraphSetting_Axes(aChart: TChart);
var
  i: integer;
begin
  with aChart do
    begin
      for i := 0 to Axes.Count - 1 do
        begin
          with Axes[i] do
            begin
              Automatic := true;
              MinimumRound := true;
              MaximumRound := true;
              Axis.Width := 2;
              Axis.Color := clBlack;
              Title.Font.DefaultFont := false;
              Title.Font.Name := 'Arial';
              Title.Font.Size := 8;
              Title.Font.Style := [];
              LabelsFont.DefaultFont := false;
              LabelsSeparation := 1; 
              LabelsFont.Name := 'Arial'; 
              LabelsFont.Size := 6;
              LabelsFont.Style := [];
              MinorTickCount := 3;
              PositionUnits := muPercent;
              AxisValuesFormat := '###0.###'; 
            end;
        end;
    end;
end;
and, call the procedure twice in the FormCreate event:

Code: Select all

  GraphSetting_Axes(TheChart);
  GraphSetting_Axes(SubChart.Charts[0].Chart);
However, the Fonts of Axes’s Titles and Labels appears differently. Why is that?

2. To make the circle grid lines of the two Charts be the same, I execute the codes in the FormShow event:

Code: Select all

      (TrajectoryGroup.Series[0] as TPolarSeries).RadiusIncrement := 20; { TrajectoryGroup := TheChart.SeriesList.AddGroup('MainChart') }
      for i := 0 to TheChart.Axes.Count - 1 do
        TheChart.Axes[i].Increment := 20;
      if SubChart <> nil then
        begin
          (SubTrajectoryGroup.Series[0] as TPolarSeries).RadiusIncrement := 20; { SubTrajectoryGroup := SubChart.Charts[0].Chart.SeriesList.AddGroup('SubChart') }
          for i := 0 to SubChart.Charts[0].Chart.Axes.Count - 1 do
            SubChart.Charts[0].Chart.Axes[i].Increment := 20;
        end;
But, the number of the circle grid lines of the two Charts are different.
I understand that the increment is calculated automatically according the space there is to draw labels, it depends always from size of chart.
In this case, the sizes and axes properties of the two Charts should be the same, why are the numbers of the circle grid lines of the two Charts are different?
I guess that there must be something different except Axes’s Increment and LabelsFont. i.e. Label Margin, Separation, etc. How to solve this problem?

Re: The same procedure yields different axes properties

Posted: Mon Jan 08, 2018 11:50 am
by yeray
Hello,

Difficult to say without reproducing the issues here.
Could you please arrange a simple example project we can run as-is to reproduce the problems here?
Have you tried using two independent TCharts instead of using a TSubChartTool?