The the attached demo, two TChartShape series are used to create the green area below. But I need a shape that will fill in the dotted area (dotted lines added with an editor) with green.
Can that be done?
I've attached a simple demo of the app.
Thank you,
Ed Dressel
Custom Chart Shape
-
- Advanced
- Posts: 228
- Joined: Tue Aug 28, 2007 12:00 am
- Location: Oregon, USA
Custom Chart Shape
- Attachments
-
- Shape Series.rar
- (1.58 KiB) Downloaded 544 times
Re: Custom Chart Shape
Hi Ed,
I can think on two alternatives.
1. Use a third TChartShape, with chasInvertTriangle Style. The problem here is that you'll be drawing a shape bigger than the area you highlighted. In this case it works, but won't work as you wish in a different situation.
2. Manually draw your shape at OnAfterDraw event. Ie:
I can think on two alternatives.
1. Use a third TChartShape, with chasInvertTriangle Style. The problem here is that you'll be drawing a shape bigger than the area you highlighted. In this case it works, but won't work as you wish in a different situation.
Code: Select all
lSrs := TChartShape.Create(self);
lSrs.ParentChart := Chart1;
lSrs.Style := chasInvertTriangle;
lSrs.SeriesColor := clGreen;
lSrs.Pen.Visible := false;
lSrs.X0 := 23;
lSrs.X1 := 37;
lSrs.Y0 := 15;
lSrs.Y1 := 25;
Code: Select all
procedure TForm1.Chart1AfterDraw(Sender: TObject);
var points: array of TPoint;
begin
setLength(points, 3);
with Chart1.Axes do
begin
points[0]:=Point(Bottom.CalcPosValue(23), Left.CalcPosValue(25));
points[1]:=Point(Bottom.CalcPosValue(30), Left.CalcPosValue(25));
points[2]:=Point(Bottom.CalcPosValue(30), Left.CalcPosValue(15));
end;
with Chart1.Canvas do
begin
Pen.Style:=psClear;
Brush.Style:=bsSolid;
Brush.Color:=clGreen;
Polygon(points);
end;
end;
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |