I'm drawing rectangles on a chart in the OnBeforeDrawSeries event. To draw a rectangle with a solid fill, I define a brush with (for example)
Chart1.Canvas.Brush.Color:=clRed;
and then draw a rectangle in the OnBeforeDrawSeries event with (for example)
Chart1.Canvas.Rectangle(X0,Y0,X1,Y1).
If I want a gradient fill in the rectangle, say clRed at the top right and clYellow at the bottom left, how would I achieve that?
I'm using the latest TeeChart Pro for VCL. Thank you.
How to make a gradient fill
Re: How to make a gradient fill
Hello,
You could use gradients as follows:
You could use gradients as follows:
Code: Select all
Chart1.Canvas.Gradient.Visible:=true;
Chart1.Canvas.Gradient.StartColor:=clYellow;
Chart1.Canvas.Gradient.EndColor:=clRed;
Chart1.Canvas.Gradient.Direction:=gdDiagonalUp;
Chart1.Canvas.Rectangle(X0,Y0,X1,Y1);
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |