PrepareCanvas should called after OnGetPointerStyle function

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
nitin
Newbie
Newbie
Posts: 51
Joined: Thu Aug 22, 2002 4:00 am

PrepareCanvas should called after OnGetPointerStyle function

Post by nitin » 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;

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Tue Nov 07, 2006 3:30 pm

Hello fnn,

Thanks for the suggestion, we changed this for v8, which is the version we are currently working with. The change is in Series.pas:

Code: Select all

Procedure TCustomSeries.DrawPointer(AX,AY:Integer; AColor:TColor; ValueIndex:Integer); var tmpStyle : TSeriesPointerStyle; begin
  // Set canvas properties to Pointer (Brush, Color, Pen)
  Pointer.PrepareCanvas(ParentChart.Canvas,AColor);

  // Call the OnGetPointerStyle event if assigned.
  tmpStyle:=DoGetPointerStyle(ValueIndex);

  // Repeat again setting Canvas parameters, thus allowing the developer
  // to use the OnGetPointerStyle event to modify other Pointer properties
  // like Color, Pen, etc.
  if Assigned(FOnGetPointerStyle) then
     Pointer.PrepareCanvas(ParentChart.Canvas,AColor);

  Pointer.Draw(AX,AY,AColor,tmpStyle);
end;
If you are interested in beta-testing v8 please read this.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Post Reply