Labels dropped in THorizBarSeries series

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
TestAlways
Advanced
Posts: 228
Joined: Tue Aug 28, 2007 12:00 am
Location: Oregon, USA

Labels dropped in THorizBarSeries series

Post by TestAlways » Mon Dec 01, 2008 6:51 pm

I am using 8.02 (I think--I just saw that 8.04 is available).

In a TChart with a single THorizBarSeries the label for a value in the series is dropped even when there is plenty of room for the label to be shown.

For example, here is an image full size (highlighting the labels that will be dropped in the next image):

Image


If the image is re-sized down a little, two labels are dropped (but again, there is plenty of room for them):

Image

I do set the THorizBarSeries.BarWidthPercent = 60. Increasing this (I even tried 100) did not fix the problem.

Here is the code for creating the series:

function CreateBarSeries: THorizBarSeries;
begin
result := THorizBarSeries.Create(self);
result.Marks.Visible := True;
result.BarWidthPercent := 60;
result.ColorEachPoint := True;
result.OnGetMarkText := GetMarkText;
result.MultiBar := mbSide;
result.BarPen.Visible := False;
chrtAvgValues.AddSeries(result);
end;


Thank you,

Ed Dressel

Sandra
Site Admin
Site Admin
Posts: 3132
Joined: Fri Nov 07, 2008 12:00 am

Hi!

Post by Sandra » Tue Dec 02, 2008 9:48 am

Hello TestAlways!

We can not reproduce it with v8.04 I recommeded that you install the version 8.04, but if your problem is not solved, 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
http://www.steema.net/upload/

Thanks in advance.

Best Regards
Sandra


Steema Support Central
http://support.steema.com

TestAlways
Advanced
Posts: 228
Joined: Tue Aug 28, 2007 12:00 am
Location: Oregon, USA

Post by TestAlways » Tue Dec 02, 2008 5:55 pm

I reproduced it in a demo:

http://www.TBinc.com/misc/HorzChartLabelIssue.zip

When the screen is first drawn, the labels are not all there--increasing the screen size and the labels will appear.

Ed Dressel

Sandra
Site Admin
Site Admin
Posts: 3132
Joined: Fri Nov 07, 2008 12:00 am

Post by Sandra » Wed Dec 03, 2008 8:45 am

Hi! TestAlways

Thanks for your example project. It works fine for us here using v8.04. Could you please check if this version solves the problem at your end?

Also notice that GetMarkText event is not assigned in your project, should it be assigned? If yes the variables you are assigning to MarkText are not defined either.

Thanks in advance.

Best Regards
Sandra



Steema Support Central
http://support.steema.com

TestAlways
Advanced
Posts: 228
Joined: Tue Aug 28, 2007 12:00 am
Location: Oregon, USA

Post by TestAlways » Wed Dec 03, 2008 4:39 pm

Thanks for your example project. It works fine for us here using v8.04. Could you please check if this version solves the problem at your end?
Yes, it is 8.04. The problem is there. I've updated the sample project to include the EXE that was created in D2007 with 8.04. (I tried to figure out how to get the version info from the chart to show in the EXE but I did not see it anywhere). My thought is that it may be tied to a resolution issue or other computer setting: if the EXE works fine on your machine--it must be a machine configuration setting.

I've also isolate part of the problem: if the Chart.LeftAxis.LabelsSeparation has a value at all, some of the labels may be dropped in a THorizBarSeries.

Ed Dressel

Sandra
Site Admin
Site Admin
Posts: 3132
Joined: Fri Nov 07, 2008 12:00 am

Post by Sandra » Thu Dec 04, 2008 9:47 am

Hello TestAlways!

We can run your project.exe and we can see your problem, but when we compile your project and execute it in our computers the problem can't be reproduced.

Problem could be with Chart.LeftAxis.LabelsSeparation, because if you assigned a value to this property, the label reserves specificed pixels and if another label tries to draw on another label area it's not being plotted as the chart considers they would overlap. Also notice that LabelsSeparation is not being used in the example you sent us.


Best Regards
Sandra


Steema Support Central
http://support.steema.com

TestAlways
Advanced
Posts: 228
Joined: Tue Aug 28, 2007 12:00 am
Location: Oregon, USA

Post by TestAlways » Thu Dec 04, 2008 2:21 pm

My apologies. (I had a plugin in D7 that would always save my code when I compiled--I'm trying to remember that i n D2007).

I've updated the source code in the download.

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

Post by Narcís » Thu Dec 04, 2008 2:44 pm

Hi Ed,

Thanks for updating project sources.

As Sandra said, LabelsSeparation is what is causing this. Commenting in line below solves the problem for me.

Code: Select all

  lAxis.LabelsSeparation := ifthen(aSwapAxis, 10, 100);
Alternativelly you could change it by this:

Code: Select all

  lAxis.LabelsSeparation := labelsWidth;
and calculate labels width like this:

Code: Select all

  aChart.Draw;
  if aSwapAxis then
  begin
    lAxis := aChart.BottomAxis;
    labelsWidth := aChart.Axes.Bottom.MaxLabelsWidth;
  end
  else
  begin
    lAxis := aChart.LeftAxis;
    labelsWidth := aChart.Axes.Left.MaxLabelsWidth;
  end;
However this is redundant as TeeChart already does this automatically.
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

Post Reply