Page 1 of 1

Labels dropped in THorizBarSeries series

Posted: Mon Dec 01, 2008 6:51 pm
by 10546565
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

Hi!

Posted: Tue Dec 02, 2008 9:48 am
by 10050769
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

Posted: Tue Dec 02, 2008 5:55 pm
by 10546565
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

Posted: Wed Dec 03, 2008 8:45 am
by 10050769
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

Posted: Wed Dec 03, 2008 4:39 pm
by 10546565
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

Posted: Thu Dec 04, 2008 9:47 am
by 10050769
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

Posted: Thu Dec 04, 2008 2:21 pm
by 10546565
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.

Posted: Thu Dec 04, 2008 2:44 pm
by narcis
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.