Legends

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
Maz2312
Newbie
Newbie
Posts: 9
Joined: Wed Feb 09, 2005 5:00 am

Legends

Post by Maz2312 » Mon Sep 19, 2005 3:13 pm

How do I activate the scrollbar in a legend at runtime?

How do I change the position of the legend - do I need to use custom postion?

When I add a scrollbar and another legend in the tools menu and set the active property to true I get a constant flicker and the scrollbar does not work.

Thanks

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 Sep 20, 2005 7:25 am

Hi,

Please have a look at the snippet below which shows you how to create TLegendScrollBar at run-time. It also adds an extra legend which doesn't behave as you reported. Could you please test if this code works for you? Which TeeChart version are you using?

Code: Select all

procedure TForm1.FormCreate(Sender: TObject);
var
  i: Integer;
  LegendScroll: TLegendScrollBar;
  ExtraLegend: TExtraLegendTool;
begin
  LegendScroll:=TLegendScrollBar.Create(self);
  LegendScroll.ParentChart:=Chart1;

  ExtraLegend:=TExtraLegendTool.Create(self);
  ExtraLegend.Series:=Chart1[0];

//or

//  Chart1.Tools.Add(TExtraLegendTool.Create(self));
//  (Chart1.Tools.Items[0] as TExtraLegendTool).Series:=Series1;

//  Chart1.Tools.Add(TLegendScrollBar.Create(self));

  for i:=0 to Chart1.SeriesCount-1 do Chart1[i].FillSampleValues();
end;
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

Maz2312
Newbie
Newbie
Posts: 9
Joined: Wed Feb 09, 2005 5:00 am

LegendScrollbar

Post by Maz2312 » Tue Sep 20, 2005 8:38 am

Code works in as much as it creates the scrollbar but it is still not active even though I set the active property to true.

Anyway of setting the position of the legend without using custom position, can I set it to either top, bottom, right or left at runtime which you can do at design time.

Thanks

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 Sep 20, 2005 10:02 am

Hi,
Code works in as much as it creates the scrollbar but it is still not active even though I set the active property to true.
This is most likely because you don't have enough items to the legend so it already fits on your chart area and it's not worth scrolling. You could also try doing something similar to what it's done at "Scrolling legend" example at the TeeChart features demo (All Features\ Welcome!\ Miscellaneous\ Legend), available at the TeeChart program group.
Anyway of setting the position of the legend without using custom position, can I set it to either top, bottom, right or left at runtime which you can do at design time.
Sorry, I forgot to answer that before. You can use:

Code: Select all

  Chart1.Legend.Alignment:=laTop;
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

Maz2312
Newbie
Newbie
Posts: 9
Joined: Wed Feb 09, 2005 5:00 am

Post by Maz2312 » Tue Sep 20, 2005 11:03 am

There are 40+ bars on the graph but only 29 items in the legend hence the need for a scroll bar in the legend. The following code is used to create the scrollbar:
LegendScroll:=TLegendScrollBar.Create(self);
LegendScroll.ParentChart:=Form2.QrChart1.chart;
LegendScroll.Active:=True;

Doesn't matter whether I create this at design time or runtime the scrollbar is still inactive.

Thanks

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 Sep 20, 2005 11:09 am

Hi,

Could you please send us an example we can run "as-is" to reproduce the problem here? You can post your files at [url]news://www.steema.net/steema.public.attachments[/url] newsgroup.

BTW: Which TeeChart version are you using?
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

Maz2312
Newbie
Newbie
Posts: 9
Joined: Wed Feb 09, 2005 5:00 am

Viewing over multiple pages

Post by Maz2312 » Tue Sep 20, 2005 3:20 pm

Hi

I am using QuickReport and the QrChart Component to view the data. I would like to see a limit to the number of points per page - 10. I set the points per page property in the paging tab and this works but I only see one page. I have added a TChartPageNavigator and set the Chart property to the Chart Component but no joy. Please tell me what I'm doing wrong!

Pep
Site Admin
Site Admin
Posts: 3299
Joined: Fri Nov 14, 2003 5:00 am
Contact:

Post by Pep » Wed Sep 21, 2005 2:31 pm

Hi,

without using the TChartPageNavigator you should be albe to navigate through the pages using the following code :

Code: Select all

procedure TForm1.BitBtn1Click(Sender: TObject);
begin
QRChart1.Chart.NextPage;
end;

procedure TForm1.BitBtn2Click(Sender: TObject);
begin
QRChart1.Chart.PreviousPage;
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
Series1.FillSampleValues(100);
QRChart1.Chart.MaxPointsPerPage:=10;
end;
Using the TChartPageNavigator you will have to use :

Code: Select all

procedure TForm1.FormCreate(Sender: TObject);
begin
Series1.FillSampleValues(100);
QRChart1.Chart.MaxPointsPerPage:=10;
ChartPageNavigator1.Chart := qrChart1.Chart;
end;

Post Reply