PrepareCanvas should called after OnGetPointerStyle function
Posted: Mon Nov 06, 2006 4:41 pm
Hello,
in TCustomSeries.DrawPointer:
OnGetPointerStyle function determines pointer style. But, it is possible to do more. For example, pointer.color,..
//I want to change both color and pointer.style
function Tfrm_graph.SeriesGetPointerStyle(Sender: TChartSeries;
ValueIndex: Integer): TSeriesPointerStyle;
begin
if odd(ValueIndex) then
begin
result:=psCircle ;
sender.pointer.color:=clred;
end
else
begin
sender.pointer.color:=clblue;
result:=psCircle;
end;
end;
I changed in series.pas as below:
Procedure TCustomSeries.DrawPointer(AX,AY:Integer; AColor:TColor; ValueIndex:Integer);
var tmpStyle : TSeriesPointerStyle;
begin
if Assigned(FOnGetPointerStyle) then tmpStyle:=FOnGetPointerStyle(Self,ValueIndex)
else tmpStyle:=Pointer.Style;
Pointer.PrepareCanvas(ParentChart.Canvas,AColor);
Pointer.Draw(AX,AY,AColor,tmpStyle);
end;
in TCustomSeries.DrawPointer:
OnGetPointerStyle function determines pointer style. But, it is possible to do more. For example, pointer.color,..
//I want to change both color and pointer.style
function Tfrm_graph.SeriesGetPointerStyle(Sender: TChartSeries;
ValueIndex: Integer): TSeriesPointerStyle;
begin
if odd(ValueIndex) then
begin
result:=psCircle ;
sender.pointer.color:=clred;
end
else
begin
sender.pointer.color:=clblue;
result:=psCircle;
end;
end;
I changed in series.pas as below:
Procedure TCustomSeries.DrawPointer(AX,AY:Integer; AColor:TColor; ValueIndex:Integer);
var tmpStyle : TSeriesPointerStyle;
begin
if Assigned(FOnGetPointerStyle) then tmpStyle:=FOnGetPointerStyle(Self,ValueIndex)
else tmpStyle:=Pointer.Style;
Pointer.PrepareCanvas(ParentChart.Canvas,AColor);
Pointer.Draw(AX,AY,AColor,tmpStyle);
end;