Page 1 of 1

All TBoxSeries.XLabel do not appear on the chart along the X

Posted: Thu Aug 16, 2007 11:23 pm
by 9348135
Hello,

I have a single Chart where I am creating Box Chart Plots. I have two functions that construct the series and assign them to the charts. I have 15 series in each chart which I create in a loop. Also in the loop I give values to the XLabel property. The functions are almost identical. The looping is identical.

In the chart created from one function all the XLabel values appear under the ticks under the box plots. But in the other chart, the last 5 XLabels do not appear. The Box plots appear, but not the labels. The X axis is identical in both charts. Same number of series, same label values.

Can you give me some suggestions on what might be causing this. I've been over and over it and can see no reason why all 15 Labels appear on the X axis for one chart and the last five disappear on the other chart.

Thanks very much.

Hardee Mahoney
Washington, DC

Posted: Fri Aug 17, 2007 7:32 am
by Marjan
Hi.

It's hard to tell but I'd say the problem is horizontal axis pixel size is not the same in both cases and drawing algorithm decides to skip some labels to avoid overlapping. To fix this problem, try settingh the axis LabelSeparation property to small value (for example, 1). This should force TeeChart into displaying all labels. Another thing you might try is rotate axis labels to 90 deg to reduce the number of pixels per axis label (in horizontal direction).

Posted: Tue Aug 21, 2007 3:35 pm
by 9348135
I am still not able to get all the labels on the bottom axis for a series of box charts to print. I've tried setting the labelSeparation property to 1, and setting the labels to alternate. On the chart the first 10 labels print and not the last four. Visually it seems there is plenty of room for the last four labels. There is just blank space. Even though it works fine on one set of data and not on another I wonder if I understand the XLabel for a Box plot properly. I am using code that looks like this (simplified)

Code: Select all

  for GridNo := 0 to FAPVResults.NumPoolingWindows - 1 do
  begin

      BoxSeries := TBoxSeries.Create(self);
      BoxSeries.ParentChart := Chart1;
      BoxSeries.Position := GridNo;

      BoxSeries.Clear;
      for i := 0 to 100 do
      begin             
           ...
      end;

      BoxSeries.UseCustomValues := true;

      BoxSeries.AdjacentPoint1 := 
      BoxSeries.AdjacentPoint3 := 
      BoxSeries.Quartile1 := 
      BoxSeries.Quartile3 := 
      BoxSeries.Median := 
      BoxSeries.Innerfence1 := 
      BoxSeries.Innerfence3 := 
      BoxSeries.Outerfence1 := 
      BoxSeries.Outerfence3 := 
      BoxSeries.ExtrOut.Visible := false;
      BoxSeries.MildOut.Visible := false;

      BoxSeries.Title := SeriesLabel(GridNo);
      BoxSeries.XLabel[GridNo] := SeriesLabel(GridNo);
  end;


Also, I have another chart where the title of the left axis is written on top of the axis tick labels. I can't seem to find out how to move the title.

Thanks

Hardee Mahoney
Washington, DC

Posted: Tue Aug 21, 2007 3:58 pm
by narcis
Hi Hardee,

Could you please send us a simple example project we can run "as-is" to reproduce the problem here?

You can either post your files at news://www.steema.net/steema.public.attachments newsgroup or at our upload page.

Thanks in advance.

Posted: Wed Aug 22, 2007 1:03 pm
by Marjan
Hi.

The XLabels are associated to single series and if this series has less points than XLabels, you'll end up with wrong result. Single boxplot series displays one single box at speicific x position meaning you'll only be able to control single axis label. The correct way to display series titles as bottom axis labels would be to use the following code:

Code: Select all

var i: Integer;
begin
  // assuming all series in chart SeriesList are box series
  with Chart1.Axes.Bottom.Items do
  begin
    Clear;
    for i := 0 to Chart1.SeriesCount -1 do
      Add((Chart1[i] as TBoxSeries).Position,Chart1[i].Title);
  end;
end;

Posted: Wed Aug 22, 2007 5:18 pm
by 9348135
Thanks!

I thought I might not be using the XLabels property correctly.

Re: All TBoxSeries.XLabel do not appear on the chart along the X

Posted: Thu Nov 05, 2009 10:09 am
by 10550843
Nice tip, working well

TY.