Hello, is it possible to use BarSeries.ColorEachPoint and have a gradient?
Thanks.
ColorEachPoint and Gradient?
Re: ColorEachPoint and Gradient?
Hi,
Yes, you can. Ie:
Yes, you can. Ie:
Code: Select all
with Chart1.AddSeries(TBarSeries) as TBarSeries do
begin
FillSampleValues;
ColorEachPoint:=true;
BarStyle:=bsRectGradient;
end;
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
Re: ColorEachPoint and Gradient?
Yeray, I should have mentioned that I'm specifying the colors - positive values in green and negative in red, but a gradient version of each color. So I have:
Where would you supply the 2nd color for the gradient?
Thanks,
Jim
Code: Select all
if series.ColorEachPoint then
if y < y0 then
color := clRed
else
color := clGreen
else
color := clDefault;
series.AddXY(x, y, '', color);
Thanks,
Jim
Re: ColorEachPoint and Gradient?
Hi Jim,
However this is a color for the whole series. If you want to set a different StartColor for each point, you could use the OnGetPointerStyle/OnGetBarStyle event to change that color each time a point/bar is going to be drawn.
You should set the series' Gradient.StartColor property.Jim Green wrote:Where would you supply the 2nd color for the gradient?
However this is a color for the whole series. If you want to set a different StartColor for each point, you could use the OnGetPointerStyle/OnGetBarStyle event to change that color each time a point/bar is going to be drawn.
Code: Select all
Procedure TForm1.GetBarStyle(Sender:TCustomBarSeries; ValueIndex:Integer; var TheBarStyle:TBarStyle);
begin
Sender.Gradient.StartColor:=ApplyBright(Sender.ValueColor[ValueIndex], 128);
end;
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |