I would like to add an annotation to a chart, which is pretty easy. But I need a few more features:
1) I need to add an arrow from the annotation to a specific location on the chart with the arrow connected to the closes point of the annotation; and
2) I would like to allow the user to move the annotation by dragging it to a new location.
Can items #1 and #2 be done?
Thank you,
Ed Dressel
Annotation and an Arrow
-
- Advanced
- Posts: 228
- Joined: Tue Aug 28, 2007 12:00 am
- Location: Oregon, USA
Hi Ed,
One solution could be allowing drag to your annotation, look at here. But I'm afraid that you should control your arrow position manually.
Another solution could be using a dummy point series with pointers hided and with DragMarks tool associated. This could be an example:
If you don't like this, I'm afraid I can't think on anything easiest than drawing directly to the canvas.
One solution could be allowing drag to your annotation, look at here. But I'm afraid that you should control your arrow position manually.
Another solution could be using a dummy point series with pointers hided and with DragMarks tool associated. This could be an example:
Code: Select all
procedure TForm1.FormCreate(Sender: TObject);
var APosition: TSeriesMarkPosition;
i: Integer;
begin
Chart1.View3D := false;
for i:=0 to 24 do
Series1.Add(random*200);
ChartTool1.Series := Series2;
Series2.AddXY(10,100,'Your custom text');
Series2.Marks.Visible := true;
Chart1.Draw;
Series2.Pointer.Visible := false;
Series2.ShowInLegend := false;
Series2.Marks.Arrow.Color := clRed;
with Series2.Marks.Positions[0] do
begin
Custom := true;
LeftTop.X := LeftTop.X+100;
LeftTop.Y := LeftTop.Y-100;
ArrowTo.X := ArrowTo.X+100;
ArrowTo.Y := ArrowTo.Y-100;
end;
Chart1.Axes.Bottom.LabelStyle := talValue;
end;
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
-
- Advanced
- Posts: 228
- Joined: Tue Aug 28, 2007 12:00 am
- Location: Oregon, USA
Hi Ed,
Here you have another possibility: The Rectangle Tool that is pretty similar than the Annotation but it allows dragging "out of the box".
If you still don't like it, I'll try to do a "custom drawing solution".
Here you have another possibility: The Rectangle Tool that is pretty similar than the Annotation but it allows dragging "out of the box".
Code: Select all
uses series, TeeTools;
procedure TForm1.FormCreate(Sender: TObject);
begin
Chart1.AddSeries(TPointSeries.Create(self));
Chart1[0].FillSampleValues(50);
Chart1.Tools.Add(TRectangleTool.Create(self));
with (Chart1.Tools[0] as TRectangleTool) do
begin
Text := 'My custom text';
Left := 200;
Top := 200;
Callout.Arrow.Visible := true;
Callout.Arrow.Color := clRed;
Callout.XPosition := 100;
Callout.YPosition := 100;
end;
end;
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |