Page 1 of 1

Legends

Posted: Mon Sep 19, 2005 3:13 pm
by 9340948
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

Posted: Tue Sep 20, 2005 7:25 am
by narcis
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;

LegendScrollbar

Posted: Tue Sep 20, 2005 8:38 am
by 9340948
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

Posted: Tue Sep 20, 2005 10:02 am
by narcis
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;

Posted: Tue Sep 20, 2005 11:03 am
by 9340948
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

Posted: Tue Sep 20, 2005 11:09 am
by narcis
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?

Viewing over multiple pages

Posted: Tue Sep 20, 2005 3:20 pm
by 9340948
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!

Posted: Wed Sep 21, 2005 2:31 pm
by Pep
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;