I'm developing a mapping system for placing students. The map is the "backImage" of the chart, and then I simply plot Eastings/Northings using a scatterplot.
However. I want to measure distances on the map. I placed a TIMage exactly on top of the TChart component, and then used the mouse events to do rubber banding.
HOWEVER, no matter what I do (e.g manually or programatically sending the TCHart to back) the TImage is ALWAYS behind the TChart, so although the rubber banding works when the TImage is not behind the TChart, obviously it doesn't when behind TChart!!
Is there a fix for this problem - I simply can't see a way to "Rubber band" directly on the TChart. Is this possible? (I have tried using the TChart.canvas, but nothing appears)
Help!
Barry
Problem with placing a TImage on top of TeeChart
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi Barry,
From your post I note that you first placed the image as the backimage of the Chart (ie. Chart1.BackImage). You could trace mousemovements over that using the x and y of the TeeChart mousemove. If you require that the image completely hide Chart contents then you could alternatively plot the image to the Chart using the Canvas event OnAfterDraw:
However you have another option that would be using an Image tool, which places an image behind the series. You can find an example of ImageTool at TeeChart features demo, available at TeeChart program group. Once you have the image on the chart you could implement the "Rubber banding" drawing directly on the TChart canvas as shown in the code above. TChart has MouseDown, MouseMove and MouseUp events to implement that.
From your post I note that you first placed the image as the backimage of the Chart (ie. Chart1.BackImage). You could trace mousemovements over that using the x and y of the TeeChart mousemove. If you require that the image completely hide Chart contents then you could alternatively plot the image to the Chart using the Canvas event OnAfterDraw:
Code: Select all
procedure TForm1.Chart1AfterDraw(Sender: TObject);
begin
with Chart1.Canvas do
begin
Draw(0,0,Image1.Picture.Graphic);
Pen.Color:=clRed;
MoveTo(0,0);
LineTo(100,100);
end;
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 Barry,
I'm glad to hear you could get it working. You are right, I forgot to tell you to disable zoom or else your chart would be zoomed.
I'm glad to hear you could get it working. You are right, I forgot to tell you to disable zoom or else your chart would be zoomed.
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 |