Page 1 of 1

Polar Series - color each point

Posted: Wed Sep 09, 2009 11:21 am
by 10546846
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;

Re: Polar Series - color each point

Posted: Wed Sep 09, 2009 11:35 am
by narcis
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.

Re: Polar Series - color each point

Posted: Wed Sep 09, 2009 1:55 pm
by 10546846
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;

Re: Polar Series - color each point

Posted: Wed Sep 09, 2009 2:58 pm
by narcis
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;

Re: Polar Series - color each point

Posted: Wed Sep 09, 2009 3:11 pm
by 10546846
thanks Narcis, that works