i add two annotations on one chart,when click one annotation,how to response with one funciton.
showMessage('this is one annation') or do other things
thanks a lot
how to let one Annotation responsed to Click or doubleclick
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi Richard,
You can use its OnClick event, for example:
You can use its OnClick event, for example:
Code: Select all
procedure TForm1.ChartTool1Click(Sender: TAnnotationTool;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
ShowMessageUser('this is my annotation!');
end;
Best Regards,
Narcís Calvet / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi Richard,
Yes, you can also assign the event dynamically as shown here:
Yes, you can also assign the event dynamically as shown here:
Code: Select all
procedure TForm1.FormCreate(Sender: TObject);
begin
ChartTool1.OnClick:=ChartTool1Click;
end;
procedure TForm1.ChartTool1Click(Sender: TAnnotationTool;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
ShowMessageUser(Sender.Text);
end;
Best Regards,
Narcís Calvet / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |
Code: Select all
procedure TForm1.FormCreate(Sender: TObject);
begin
Chart1.RemoveAllSeries;
Chart1.Tools.Clear;
chart1.tools.add(Tannotationtool);
chart1.tools.add(Tannotationtool);
chart1.tools.add(Tannotationtool);
chart1.tools.add(Tannotationtool);
end;
how to reponse with mouseEvent. thanks a lot.
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi Richard,
I'm sorry but I'm not sure about what you are trying to achieve here. Could you please give us some more details about it?
Thanks in advance.
I'm sorry but I'm not sure about what you are trying to achieve here. Could you please give us some more details about it?
Thanks in advance.
Best Regards,
Narcís Calvet / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |
Code: Select all
procedure TMainForm.ResetChart;
var tmpEmpty:TChart;
begin
Chart1.RemoveAllSeries;
Chart1.Tools.Clear;
tmpEmpty:=TChart.Create(nil);
try
tmpEmpty.AllowZoom:=False;
tmpEmpty.AllowPanning:=pmNone;
tmpEmpty.Color:=clWhite;
Chart1.Assign(tmpEmpty);
finally
tmpEmpty.Free;
end;
end;
procedure TMainForm.Button2Click(Sender: TObject);
var
tmpChart:TCustomChart;
begin
ResetChart;
tmpChart:=TCustomChart(Chart1);
LoadchartFromfile(tmpchart,'test.tee');
Chart1:=TChart(tmpChart);
Chart1.BackImage.LoadFromFile('turbine.gif');
chart1.BackImageMode:=pbmCenter;
//chart1.Tools.items[0].onClick ?
end;
chart1.Tools.items[0].onClick ?
There's no this function
thanks a lot for your focusing on this.
I have used the TeeChart office to edit the customized chart(test.tee file),and when I loaded the file ,and I now want to set the Tannotationtool's click property to realize some functions. Can you tee me how to do this.
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi Richard,
In that case you need to typecast the tools like this:
Hope this helps!
In that case you need to typecast the tools like this:
Code: Select all
for i:=0 to Chart1.Tools.Count-1 do
if Chart1.Tools.Items[i] is TAnnotationTool then
(Chart1.Tools.Items[i] as TAnnotationTool).OnClick:=ChartTool1Click;
Best Regards,
Narcís Calvet / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |