Page 1 of 1

Horz labels dropping

Posted: Mon Feb 03, 2020 7:43 pm
by 16587426
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


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

Re: Horz labels dropping

Posted: Thu Feb 06, 2020 8:34 am
by Marc
Hello Ed,

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;
  if (MaxLabelSize>0) and (IAxisSize>0) then
    if FLabels.Separation>0 then

  else tmp:=1;

and CalcLabelsIncrement goes on to check depending on datetimeformat, log-scale, etc.