Horz labels dropping

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
EdDressel
Newbie
Newbie
Posts: 35
Joined: Mon Nov 25, 2019 12:00 am

Horz labels dropping

Post by EdDressel » Mon Feb 03, 2020 7:43 pm

I have a horizontal bar series with two-line labels in the axis--but if there is too much data, then the labels can get dropped. (Se

Image

Two questions:

1) What setting is the margin between the labels? It seems a bit to aggressive here.

2) Is there a way of knowing if any of the labels are dropped? If they are, I want to change the value to a mark.

Thank you,

Ed Dressel
Ed Dressel
President
RetireReady Solutions

Marc
Site Admin
Site Admin
Posts: 1209
Joined: Thu Oct 16, 2003 4:00 am
Location: Girona
Contact:

Re: Horz labels dropping

Post by Marc » Thu Feb 06, 2020 8:34 am

Hello Ed,

Re.1.
You can manually override the auto-separation with the increment property.

eg. (you'll notice the effect of this test more on a horizontal axis but the result is the same on a vertical axis where you have multiline labels):

Code: Select all

  Series1.Add(4,'first long long label');
  Series1.Add(5,'second long long label');
  Series1.Add(3,'third long long label');
  Series1.Add(3.5,'fourth long long label');

  Chart1.Axes.Bottom.LabelsSeparation := 0;
Re 2.
TeeChart takes the length of the longest label (multiline height in this case) and calculates what spacing would be required for the fit. Default is the value 10%. You'd need to run the calculation prior to the Chart doing so, to know what fit is likely.

The chart starts here:

Code: Select all

Function TChartAxis.CalcXYIncrement(MaxLabelSize:Integer):TAxisValue;
var tmp : Integer;
begin
  if (MaxLabelSize>0) and (IAxisSize>0) then
  begin
    if FLabels.Separation>0 then
       Inc(MaxLabelSize,Round(0.01*FLabels.Separation*MaxLabelSize));

    tmp:=Round((1.0*IAxisSize)/MaxLabelSize)
  end
  else tmp:=1;

  result:=CalcLabelsIncrement(tmp)
end;
and CalcLabelsIncrement goes on to check depending on datetimeformat, log-scale, etc.

Regards,
Marc
Steema Support

Post Reply