aligning left axis of multiple charts

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
joepasquariello
Newbie
Newbie
Posts: 14
Joined: Thu Oct 09, 2014 12:00 am

Re: aligning left axis of multiple charts

Post by joepasquariello » Fri Dec 12, 2014 12:49 am

Yeray,

The problem with TLegendScrollBar was caused by this line from my program. This does modify the Legend Text, but for some reason it affects the scroll bar.

Dest->Legend->Item->Text = Origin->Series->Name;

If I do this instead, the problem is solved. Title overrides Name in the Legend display.

Dest->Series->Title = Origin->Series->Name;

Joe

joepasquariello
Newbie
Newbie
Posts: 14
Joined: Thu Oct 09, 2014 12:00 am

Re: aligning left axis of multiple charts

Post by joepasquariello » Fri Dec 12, 2014 1:47 am

Yeray,

The problem with TLegendScrollBar was in how I was setting the Legend text for each Series. This causes a problem. I'm not sure why.

Dest->Legend->Item->Text = Origin->Series->Name;

This fixes the problem:

Origin->Series->Title = Origin->Series->Name; // Title overrides Name
Dest->Series->Title = Origin->Series->Title; // okay to use same Title in multiple charts

Thanks very much.

Joe

Yeray
Site Admin
Site Admin
Posts: 9514
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: aligning left axis of multiple charts

Post by Yeray » Fri Dec 12, 2014 2:34 pm

Hi Joe,
joepasquariello wrote:I think OnBeforeDrawAxes is better than OnAfterDraw for my purpose. The label widths are known in OnBeforeDrawAxes, and they can be modified before the draw occurs.
Then I'm not sure to understand if you are happy with the solutions provided or if you still find problems with this.
joepasquariello wrote:Some examples where Help is missing or incomplete are ChartRect (no Help), CloneChart (no description), and TLegendScrollBar (no Help).
Thanks. We'll check that.
joepasquariello wrote:I am trying to use CloneChart() to make a copy of a chart. The two charts will have the same set of series (with different names), but the Series in chart 1 and chart 2 will share the same data from a single TDataSet. Both charts have a Legend (lsSeries) and a TLegendScrollBar. In the first chart, as I move the scroll bar slider up and down, the slider remains the same size, and there are no problems. In the 2nd chart, as I move the slider down, it gets smaller and smaller, until an exception occurs. The problem only occurs if use CloneChart() or CloneChartSeries(). If I create the series for the two charts independently (not cloned), then both TLegendScrollBars work okay. Do you have any idea what I'm doing wrong?
joepasquariello wrote:The problem with TLegendScrollBar was in how I was setting the Legend text for each Series. This causes a problem. I'm not sure why.

Code: Select all

Dest->Legend->Item[i]->Text = Origin->Series[i]->Name;
This fixes the problem:

Code: Select all

Origin->Series[i]->Title = Origin->Series[i]->Name; // Title overrides Name
Dest->Series[i]->Title = Origin->Series[i]->Title; // okay to use same Title in multiple charts
I've been able to reproduce the problem without needing to clone any chart:
http://bugs.teechart.net/show_bug.cgi?id=1041
I've also implemented a fix for the same so it will be available with the next maintenance release.
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

Yeray
Site Admin
Site Admin
Posts: 9514
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: aligning left axis of multiple charts

Post by Yeray » Fri Dec 12, 2014 2:42 pm

Hi Joe,
Yeray wrote: I've been able to reproduce the problem without needing to clone any chart:
http://bugs.teechart.net/show_bug.cgi?id=1041
I've also implemented a fix for the same so it will be available with the next maintenance release.
I see you have the sources. Since the fix is quite simple, you can apply it to your sources. At TeeLegendScrollBar.pas, change the function TLegendScrollBar.TotalCount for this one:

Code: Select all

function TLegendScrollBar.TotalCount:Integer;
begin
  if HasPaging then
     result:=ParentChart.Pages.Count
  else
    if L.Items.Custom then
      result:=L.TotalLegendItems
    else
      result:=L.TotalLegendItems+L.FirstValue;
end;
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

Yeray
Site Admin
Site Admin
Posts: 9514
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: aligning left axis of multiple charts

Post by Yeray » Fri Dec 12, 2014 3:01 pm

Hi Joe,
Yeray wrote:
joepasquariello wrote:Some examples where Help is missing or incomplete are ChartRect (no Help), CloneChart (no description), and TLegendScrollBar (no Help).
Thanks. We'll check that.
We are revising the first two: ChartRect and CloneChart.
Regarding TLegendScrollBar, I find this in the help:
TLegendScrollBar
Hierarchy Properties Methods Events

Unit
TeeLegendScrollBar

Description
Chart Tool used to display an scrollbar inside the Chart Legend.

This scrollbar can be used to scroll among the legend items.

When chart paging is active (Chart1.MaxPointsPerPage property), the scrollbar scrolls page by page instead of point by point.
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

joepasquariello
Newbie
Newbie
Posts: 14
Joined: Thu Oct 09, 2014 12:00 am

Re: aligning left axis of multiple charts

Post by joepasquariello » Fri Dec 12, 2014 10:16 pm

Hi Yeray,

Thank you for the fix on Legend.Text. Using Series.Title instead is a good work-around for me, so I will probably not apply that patch until I install XE7 Update 1.

Thanks also for looking at the Help. The online Help is more complete. The IDE Help has no Help for TLegendScrollBar. Will the IDE help be brought up to the same level as the Online Help? Since it's all HTML, it could be the same? I hope so, because there is a good search capability in the IDE Help, which is very important. I will try to keep a list of items where Help is missing or could be improved.

Joe

Yeray
Site Admin
Site Admin
Posts: 9514
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: aligning left axis of multiple charts

Post by Yeray » Tue Dec 16, 2014 3:13 pm

Hi Joe,
joepasquariello wrote:Thanks also for looking at the Help. The online Help is more complete. The IDE Help has no Help for TLegendScrollBar. Will the IDE help be brought up to the same level as the Online Help? Since it's all HTML, it could be the same? I hope so, because there is a good search capability in the IDE Help, which is very important. I will try to keep a list of items where Help is missing or could be improved.
We've noted to check these concrete properties when we'll synchronize both helps the for the next maintenance release.
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

Post Reply