PieChart: how many items are shown in legend?

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
NoName
Newbie
Newbie
Posts: 34
Joined: Fri Nov 15, 2002 12:00 am
Location: Italy

PieChart: how many items are shown in legend?

Post by NoName » Tue Dec 20, 2005 10:28 am

Hello,

I'm using TeeChart Pro v7.02 with Delphi 6.

I have a PieSeries, with 100 datas. I show all these datas in the legend, but, obviously, not all datas fit in.

So, I want to group values below a certain %, in order to show less values in the legend (and in the pie, too).

I thought to loop in a way like this (pseudo-code):


PieSeries1.OtherSlice.Value := 0;
while (legend.values.count >= 10) do
begin
PieSeries1.OtherSlice.Value := PieSeries1.OtherSlice.Value + 1;
end;


in this way, I will get at most 10 items in legend, resulting more readable.

My questions:
- which PieSeries function or property gives me how many items are shown in legend?
- after set PieSeries1.OtherSlice.value, should I refresh something for changes to immediately take effect?

Thank you

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 Dec 20, 2005 12:06 pm

Hi NoName,
My questions:
- which PieSeries function or property gives me how many items are shown in legend?
You can use Chart1.Legend.Items.Count.
- after set PieSeries1.OtherSlice.value, should I refresh something for changes to immediately take effect?


No, nothing has to be refreshed. I'd suggest you to have a look at the "Other Legend" example at TeeChart features demo available at TeeChart's program group. Just run the demo and search for the example name.
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

NoName
Newbie
Newbie
Posts: 34
Joined: Fri Nov 15, 2002 12:00 am
Location: Italy

Post by NoName » Tue Dec 20, 2005 2:43 pm

Hello Narcìs,

sorry, but "Items" is not member of chart.legend

I tried the following, but always return 0:
- chart.legend.TotalLegendItems
- chart.legend.NumCols
- chart.legend.NumRows

I can't find the example you suggested me, could you please attach it?

Thank you very much
Regards

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 Dec 20, 2005 3:01 pm

Hi NoName,
sorry, but "Items" is not member of chart.legend

I tried the following, but always return 0:
- chart.legend.TotalLegendItems
- chart.legend.NumCols
- chart.legend.NumRows
TChart.Legend.Items works fine here with v7.06 (release by the end of last week) and this code:

Code: Select all

procedure TForm1.FormCreate(Sender: TObject);
begin
  Series1.FillSampleValues();
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
  Chart1.Title.Text[0] := IntToStr(Chart1.Legend.Items.Count);
end;
I can't find the example you suggested me, could you please attach it?
You'll find it at "New Features Demo". This demo is at TeeChart's program group if you used the binary installer. If you used the source code installer you should download the binary installer or download the demo from here. However, if you don't use the binary installer you may not have the demo sources. The example in the demo can be found at "All Features\Welcome!\Chart Styles\Standard\Pie\Other Legend".
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

NoName
Newbie
Newbie
Posts: 34
Joined: Fri Nov 15, 2002 12:00 am
Location: Italy

Post by NoName » Wed Dec 21, 2005 8:28 am

OK, thanks a lot!
Regards

Post Reply