The same procedure yields different axes properties

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
liuxs
Newbie
Newbie
Posts: 20
Joined: Fri Dec 15, 2017 12:00 am

The same procedure yields different axes properties

Post by liuxs » Sun Jan 07, 2018 5:15 am

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?
Attachments
fig2.jpg
fig2.jpg (110.1 KiB) Viewed 6989 times

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

Re: The same procedure yields different axes properties

Post by Yeray » Mon Jan 08, 2018 11:50 am

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?
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