Hi
I'm trying to fill the points in a TPolarSeries but the fill always includes the centre position (0,0). How do I only fill the area enclosed by the points in the series?
There is a similar positing "Polar Brush always paints to 0,0" from 2008, it appears to be the same issue but I cannot find the solution.
Thanks
TPolarSeries, always fills to centre
Re: TPolarSeries, always fills to centre
Hello,
http://www.teechart.net/support/viewtop ... f=4&t=7592
I found a workaround using FOnDrawValue event. Ie:
Here the post you mention:wdsr wrote:There is a similar positing "Polar Brush always paints to 0,0" from 2008, it appears to be the same issue but I cannot find the solution.
http://www.teechart.net/support/viewtop ... f=4&t=7592
I found a workaround using FOnDrawValue event. Ie:
Code: Select all
uses //...
TeEngine;
//...
private
procedure ChartDrawValue(Series:TChartSeries; Index:Integer);
//...
uses Chart, TeePolar;
var Chart1: TChart;
polar: TPolarSeries;
type
TCustomChartAccess=class(TCustomAxisPanel);
TCustomPolarSeriesAccess=class(TCustomPolarSeries);
procedure TForm1.CBCustomBrushClick(Sender: TObject);
begin
Chart1.Draw;
end;
procedure TForm1.CBPolarBrushClick(Sender: TObject);
begin
if CBPolarBrush.Checked then
polar.Brush.Style:=bsSolid
else
polar.Brush.Clear;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
Chart1:=TChart.Create(Self);
Chart1.Parent:=Self;
Chart1.Align:=alClient;
Chart1.View3D := false;
Chart1.Axes.Left.SetMinMax(0, 40);
polar:=TPolarSeries(Chart1.AddSeries(TPolarSeries));
polar.Circled := true;
polar.CloseCircle := true;
polar.CircleLabels := true;
polar.ClockWiseLabels := true;
polar.RotationAngle := 90;
polar.RadiusIncrement := 10;
polar.AngleIncrement := 22.5;
polar.AddPolar(360 - 140, 10);
polar.AddPolar(360 - 160, 20);
polar.AddPolar(360 - 180, 30);
polar.AddPolar(360 - 160, 40);
TCustomChartAccess(Chart1).FOnDrawValue:=ChartDrawValue;
end;
procedure TForm1.ChartDrawValue(Series:TChartSeries; Index:Integer);
var i: Integer;
tmpP: TPoint;
ptsArr: array of TPoint;
begin
if (Index=0) and CBCustomBrush.Checked then
begin
SetLength(ptsArr, polar.Count);
for i:=0 to polar.Count-1 do
begin
tmpP.X:=polar.CalcXPos(i);
tmpP.Y:=polar.CalcYPos(i);
ptsArr[i]:=tmpP;
end;
Chart1.Canvas.Brush.Color:=polar.Color;
Chart1.Canvas.Polygon(ptsArr);
end;
TCustomPolarSeriesAccess(Series).DrawValue(Index);
end;
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |