Hi,
I want to set pattern for specific slice in Donut chart. Is its possible ?
I found UsePatterns property but if set they draw all slices with pattern. But I need specific ones.
So, how to select pattern type, foreground and background colors for specific slise ? Maybe using some event ?
Result should looks like this (made by hand):
Thanks for help !
How to set pattern for specific donut slice ?
Re: How to set pattern for specific donut slice ?
Hello,
You can do something similar to the explained here:
You can do something similar to the explained here:
Code: Select all
type TDonutSeriesAccess=class(TDonutSeries);
procedure TForm1.FormCreate(Sender: TObject);
begin
Chart1.AddSeries(TDonutSeries).FillSampleValues(5);
Chart1.OnAfterDraw:=PatternInDonutSliceAfterDraw;
end;
procedure TForm1.PatternInDonutSliceAfterDraw(Sender: TObject);
var donut: TDonutSeriesAccess;
begin
if (Chart1.SeriesCount>0) and (Chart1[0] is TDonutSeries) then
begin
donut:=TDonutSeriesAccess(Chart1[0]);
if pie.Count>1 then
begin
Chart1.Canvas.Brush.Color:=donut.GetValueColor(1);
Chart1.Canvas.Brush.Style:=bsFDiagonal;
donut.DrawPie(1);
end;
end;
end;
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
Re: How to set pattern for specific donut slice ?
Thank you very mush ! I will try !
Re: How to set pattern for specific donut slice ?
Its working perfect ! Thank you very much !