Page 1 of 1

PieChart: how many items are shown in legend?

Posted: Tue Dec 20, 2005 10:28 am
by 8441073
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

Posted: Tue Dec 20, 2005 12:06 pm
by narcis
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.

Posted: Tue Dec 20, 2005 2:43 pm
by 8441073
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

Posted: Tue Dec 20, 2005 3:01 pm
by narcis
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".

Posted: Wed Dec 21, 2005 8:28 am
by 8441073
OK, thanks a lot!
Regards