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

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
Hardee
Newbie
Newbie
Posts: 22
Joined: Tue Nov 21, 2006 12:00 am

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

Post by Hardee » Thu Aug 16, 2007 11:23 pm

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

Marjan
Site Admin
Site Admin
Posts: 745
Joined: Fri Nov 07, 2003 5:00 am
Location: Slovenia
Contact:

Post by Marjan » Fri Aug 17, 2007 7:32 am

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).
Marjan Slatinek,
http://www.steema.com

Hardee
Newbie
Newbie
Posts: 22
Joined: Tue Nov 21, 2006 12:00 am

Post by Hardee » Tue Aug 21, 2007 3:35 pm

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

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Tue Aug 21, 2007 3:58 pm

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.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Marjan
Site Admin
Site Admin
Posts: 745
Joined: Fri Nov 07, 2003 5:00 am
Location: Slovenia
Contact:

Post by Marjan » Wed Aug 22, 2007 1:03 pm

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;
Marjan Slatinek,
http://www.steema.com

Hardee
Newbie
Newbie
Posts: 22
Joined: Tue Nov 21, 2006 12:00 am

Post by Hardee » Wed Aug 22, 2007 5:18 pm

Thanks!

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

VGrillot
Newbie
Newbie
Posts: 5
Joined: Fri Nov 14, 2008 12:00 am

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

Post by VGrillot » Thu Nov 05, 2009 10:09 am

Nice tip, working well

TY.

Post Reply