Page 1 of 1

Single Custom Left Axes Does not behave the same as LeftAxis

Posted: Sat Nov 25, 2017 12:41 am
by 16579869
TeeChartPro v2017.22.170619 32Bit FMX
I have a requirement for multiple left axis with associated series with the user able to select which Axis and Series are to be shown.
To do this I implemented multiple Custom Axis with their associated series.
The problem is that if only custom axes are being displayed then I am unable to adjust or even under default conditions (LabelSize and TitleSize set to 0) get all the left axis labels and titles to show.
I have reduced this issue to
1. Create new project
2. Add TChart
3. Add the following code to be called from the forms constructor.

Code: Select all

procedure TfrmPondLevelTest.SetupChart;
var
  newSeries: TLineSeries;
  customAxis: TChartAxis;
begin
  Chart.ClearChart;
  Chart.View3D         := False;
  Chart.Legend.Visible := False;

  // Create new series
  newSeries := TLineSeries.Create(Chart);
  Chart.AddSeries(newSeries);
  newSeries.Title            := 'SERIES TITLE';

  if False then
  begin
    // Series uses left axis
    Chart.LeftAxis.Title.Caption := 'LEFT AXIS';
    Chart.LeftAxis.LabelsSize    := 25;
    Chart.LeftAxis.TitleSize     := 25;
  end;

  if True then
  begin
    // Series uses Custom Axis
    customAxis               := TChartAxis.Create(Chart.CustomAxes);
    customAxis.Title.Caption := 'CUSTOM AXIS';
    newSeries.CustomVertAxis := customAxis;
    customAxis.LabelsSize    := 25;
    customAxis.TitleSize     := 25;
  end;

  newSeries.FillSampleValues(20);
end;
If I use the LeftAxis if then code then I get the following
LeftAxis.png
LeftAxis.png (14.03 KiB) Viewed 14250 times
If I use the CustomAxis if then code then I get the following
CustomAxis.png
CustomAxis.png (11.07 KiB) Viewed 14249 times
The only difference in the above is which axes is being used, Left or Custom.
I would expect to get the same result in both cases but I am not and I cannot figure out how to get the custom axis to behave the same as the Left Axis.
Any help would be appreciated.

Re: Single Custom Left Axes Does not behave the same as LeftAxis

Posted: Mon Nov 27, 2017 9:05 am
by yeray
Hello,

Try adding some margins:

Code: Select all

  Chart1.MarginLeft:=60;
  Chart1.MarginRight:=20;
  Chart1.MarginBottom:=10;
  Chart1.MarginTop:=10;
  Chart1.MarginUnits:=muPixels;

Re: Single Custom Left Axes Does not behave the same as LeftAxis

Posted: Tue Nov 28, 2017 5:48 pm
by 16579869
Thought I had tried the margins. That does solve the problem for the Custom Axes and will work for my case.
However If I use the same code with the Left axis I get the Chart moved over by the margin entered as Expected of a margin.
Therefore if I happen to be mixing axes (Left and Custom) I would need to be aware of this and decide whether or not to add the margin.
I would expect both Custom and Left to work the same.

Re: Single Custom Left Axes Does not behave the same as LeftAxis

Posted: Wed Nov 29, 2017 1:02 pm
by yeray
Hello,

Your request sounds similar to #126.
Feel free to add your mail to the CC list to be notified when an update arrives.