Polar Series - color each point

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
Sean Murphy
Newbie
Newbie
Posts: 19
Joined: Thu Sep 27, 2007 12:00 am
Location: UK
Contact:

Polar Series - color each point

Post by Sean Murphy » Wed Sep 09, 2009 11:21 am

TCHart 8.01 Delphi6
I have A Polar series on a chart, pen.visible set to false and want to draw a scatter type plot with many points, the points being drawn at (Radius,Angle) as expected with Polar chart, but I want to color the points individually according to a third variable. I've done similar with Tlineseries on charts, and with those I set the coloreverypoint to true then in the getpointerstyle event I use the series.valuecolor[valueindex] to set the color of each point. With the Polar series it seems all points take on the last color (the legend gets the correct colors). Even if I add 3 points to the series and hard code the colors as below, all three draw as claqua on thechart, but in legend they are colored blue/fuchsia/aqua. Is there something I'm missing please. thaks, Sean

with Polarseries do
begin
clear;
pointer.Pen.Visible:=false;
pen.Visible:=false;
addxy(-30,2000);
addxy(-60,1500);
addxy(-100,1000);
valuecolor[0]:=clblue;
valuecolor[1]:=clfuchsia;
valuecolor[2]:=claqua;
end;

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

Re: Polar Series - color each point

Post by Narcís » Wed Sep 09, 2009 11:35 am

Hi Sean,

This works fine for me here using v8.06, which was release last week. Can you please check if v8.06 solves the problem at your end?

Thanks in advance.
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

Sean Murphy
Newbie
Newbie
Posts: 19
Joined: Thu Sep 27, 2007 12:00 am
Location: UK
Contact:

Re: Polar Series - color each point

Post by Sean Murphy » Wed Sep 09, 2009 1:55 pm

thanks Narcis,

installed 8.06, created simple app with just a rosechart with roseseries on. Works with follwing in formcreate

with roseseries do
begin
clear;
pointer.Pen.Visible:=false;
pointer.Style:=pscircle;
pen.Visible:=false;
addxy(-30,2000);
addxy(-60,1500);
addxy(-100,1000);
valuecolor[0]:=clblue;
valuecolor[1]:=clfuchsia;
valuecolor[2]:=claqua;}
end;

but if I use the getpointerstyle as below it doesn't work

function TForm1.roseseriesGetPointerStyle(Sender: TChartSeries;
ValueIndex: Integer): TSeriesPointerStyle;
begin
with sender as Tpolarseries do
case valueindex of
0 : valuecolor[valueindex]:=clblue;
1 : valuecolor[valueindex]:=clfuchsia;
2 : valuecolor[valueindex]:=claqua;
end;
end;

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

Re: Polar Series - color each point

Post by Narcís » Wed Sep 09, 2009 2:58 pm

Hi Sean,

To change pointer's colour in the OnGetPointerStyle event you need to do this:

Code: Select all

procedure TForm4.FormCreate(Sender: TObject);
begin
  with Series1 do
  begin
    clear;
    pointer.Pen.Visible:=false;
    pen.Visible:=false;
    addxy(-30,2000);
    addxy(-60,1500);
    addxy(-100,1000);
    valuecolor[0]:=clblue;
    valuecolor[1]:=clfuchsia;
    valuecolor[2]:=claqua;
  end;
end;

function TForm4.Series1GetPointerStyle(Sender: TChartSeries;
  ValueIndex: Integer): TSeriesPointerStyle;
begin
  with sender as Tpolarseries do
  case valueindex of
  0 : Pointer.Color:=clblue;
  1 : Pointer.Color:=clfuchsia;
  2 : Pointer.Color:=claqua;
  end;

  result:=psRectangle;
end;
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

Sean Murphy
Newbie
Newbie
Posts: 19
Joined: Thu Sep 27, 2007 12:00 am
Location: UK
Contact:

Re: Polar Series - color each point

Post by Sean Murphy » Wed Sep 09, 2009 3:11 pm

thanks Narcis, that works

Post Reply