In the attached demo, you can select if the line for the pie series is visible or not, and if it is, if it is white or black.
THis part works fine.
I would like to keep the symbols in the legend large--without the border around them (like the chart when no series pen is visible).
Can this be done?
Thank you,
Ed Dressel
Keeping the Legend Symbols the same size
Keeping the Legend Symbols the same size
- Attachments
-
- Donut and Legend.zip
- (6.88 KiB) Downloaded 2038 times
Ed Dressel
President
RetireReady Solutions
President
RetireReady Solutions
Re: Keeping the Legend Symbols the same size
I tried the following code but it colors each symbol with the same color (of course). I don't know how to get the color for each slice.
Thank you for your help.
Ed Dressel
Code: Select all
Chart1.Legend.Symbol.OnDraw := ChartLegendDraw;
procedure TForm1.ChartLegendDraw(Sender: TObject; aSeries:TChartSeries; ValueIndex:Integer; R:TRect);
var
lBarSeries: TBarSeries;
lCanvas: TCanvas3D;
lBlend: TTeeBlend;
begin
lCanvas := aSeries.ParentChart.Canvas;
lCanvas.Brush.Color := aSeries.Color;
lCanvas.Pen.Color := lCanvas.Brush.Color;
lCanvas.Rectangle(R);
end;
Ed Dressel
Ed Dressel
President
RetireReady Solutions
President
RetireReady Solutions
Re: Keeping the Legend Symbols the same size
I posted this in the wrong group, but in case you are wondering, here is the solution:
This concerns me about FMX though--no one here.
procedure TForm1.ChartLegendDraw(Sender: TObject; aSeries:TChartSeries; aValueIndex:Integer; aR:TRect);
var
lCanvas: TCanvas3D;
lClr: TColor;
begin
lCanvas := aSeries.ParentChart.Canvas;
lClr := aSeries.LegendItemColor(aValueIndex);
lCanvas.Brush.Color := lClr;
lCanvas.Pen.Color := lClr;
lCanvas.Rectangle(aR);
end;
This concerns me about FMX though--no one here.
Ed Dressel
President
RetireReady Solutions
President
RetireReady Solutions
Re: Keeping the Legend Symbols the same size
Hello Ed,
Yes, we were slow to react to your post. Workload doesn't always allow us to get to every post straight away; we should have noticed your post on the TeeGrid forum and moved it to TeeChart.
Regards,
Marc
Code: Select all
This concerns me about FMX though--no one here.
Regards,
Marc
Steema Support
Re: Keeping the Legend Symbols the same size
Hello,
An alternative would be to hide the pie series from the legend and use a point series for each item you want to be in the legend. Ie:
An alternative would be to hide the pie series from the legend and use a point series for each item you want to be in the legend. Ie:
Code: Select all
var i: Integer;
begin
for i:=0 to Series1.Count-1 do
with TPointSeries(Chart1.AddSeries(TPointSeries)) do
begin
Pointer.Pen.Visible:=False;
Pointer.Size:=6;
Title:=Series1.LegendString(i,Chart1.Legend.TextStyle);
Color:=Series1.ValueColor[i];
end;
Series1.ShowInLegend:=False;
Chart1.Walls.Hide;
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |