Hi,
This is my issue, I am using the imagetool from teechart tools menu to draw a image on the background. However one issue is there is no way to specify where to draw the image, i.e the co-ordinates or starting point. The image tool just draws a image associated with a series. Is there a way to specify the limits from where to start drawing ?
Now I see that there is another method associated with the canvas called draw, However draw needs the image as a LPUNKNOWN type, How do I generate this type ?
Tchartctrl1.GetCanvas().Draw(x,y,(LPUNKNOWN) ??);
My requirement is to be able to exactly coincide the background image with respect to a series, how can I achieve this ?
Thanks,
Drawing canvas backimage
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Re: Drawing canvas backimage
Hi ActiveX7,
I'm sorry but I'm not a Visual C++ specialist. Probably searching on the internet you'll find usage examples. Alternatively you can use canvas' AssignImage and Rectangle methods:
You could try custom drawing on the chart canvas assigning an image to the canvas.brush and draw a rectangle in the position you wish. This should be done in TChart's OnAfterDraw event or if you need the image being painted behind the series you could try with other chart or series drawing events.This is my issue, I am using the imagetool from teechart tools menu to draw a image on the background. However one issue is there is no way to specify where to draw the image, i.e the co-ordinates or starting point. The image tool just draws a image associated with a series. Is there a way to specify the limits from where to start drawing ?
LPUNKNOWN is the same as "IUnknown *", or a pointer to an object which supports the IUnknown interface. This interface is the base class for every COM and ActiveX class. You would use it to pass a reference to a COM or ActiveX object when you don't know or don't care what interfaces it actually supports. It is for reference counting and finding other interfaces an object supports.Now I see that there is another method associated with the canvas called draw, However draw needs the image as a LPUNKNOWN type, How do I generate this type ?
Tchartctrl1.GetCanvas().Draw(x,y,(LPUNKNOWN) ??);
I'm sorry but I'm not a Visual C++ specialist. Probably searching on the internet you'll find usage examples. Alternatively you can use canvas' AssignImage and Rectangle methods:
Code: Select all
m_Chart1.GetCanvas().GetBrush().AssignImage(ImageHandle);
m_Chart1.GetCanvas().Rectangle(Left, Top, Right, Bottom);
This will slightly vary depending on the series style you are using but you should calculate series screen coordinates using its CalcXPos and CalcYPos methods.My requirement is to be able to exactly coincide the background image with respect to a series, how can I achieve this ?
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 |
Re: Drawing canvas backimage
m_Chart1.GetCanvas().GetBrush().AssignImage(ImageHandle);
The assign image method above takes a long (ImageHandle) as a parameter, is this only meant for images in the resource file ? I want to load image from a file. Do you have an example ?
Thanks,
The assign image method above takes a long (ImageHandle) as a parameter, is this only meant for images in the resource file ? I want to load image from a file. Do you have an example ?
Thanks,
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Re: Drawing canvas backimage
Hi Activex7,
To load images from a file you can use LoadImage method:
An example can be found here.
To load images from a file you can use LoadImage method:
Code: Select all
m_Chart1.GetCanvas().GetBrush().LoadImage(fileName);
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 |
Re: Drawing canvas backimage
Hi Narcis.
Thanks for your help in this issue. I have a couple of questions
a)When I use the canvas to draw a image, I cannot zoom it ? like the behavior of the chartimage tool ?
b) Also the image drawn using the canvas is drawn over the series, Can I make to draw below the series ?
Thanks,
Thanks for your help in this issue. I have a couple of questions
a)When I use the canvas to draw a image, I cannot zoom it ? like the behavior of the chartimage tool ?
b) Also the image drawn using the canvas is drawn over the series, Can I make to draw below the series ?
Thanks,
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Re: Drawing canvas backimage
Hi Activex7,
I'm afraid not.a)When I use the canvas to draw a image, I cannot zoom it ? like the behavior of the chartimage tool ?
You could try using chart's OnBeforeDraw or OnBeforeDrawSeries events instead of OnAfterDraw.b) Also the image drawn using the canvas is drawn over the series, Can I make to draw below the series ?
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 |
Re: Drawing canvas backimage
Thanks narcis, So for my purposes I would have to stick with the chartimage tool.
The question I have is, what kind of image manipulation does it take to make a image fit well, if the series is a point series. Also can I get the resolution from Teechart ? I am guessing if I can get the resolution/width of the chart and can modify the image accordingly I might be able to get a more better fit ?
For example, say if have a series (point) with some data points and then I have a image with bubbles in it, where each of the bubbles should coincide with a point from the series, I am using the chart image tool as I want the zoom functionality, what can I do to make this image fit better ? assuming the image and series are in the same boundaries.
Thanks,
The question I have is, what kind of image manipulation does it take to make a image fit well, if the series is a point series. Also can I get the resolution from Teechart ? I am guessing if I can get the resolution/width of the chart and can modify the image accordingly I might be able to get a more better fit ?
For example, say if have a series (point) with some data points and then I have a image with bubbles in it, where each of the bubbles should coincide with a point from the series, I am using the chart image tool as I want the zoom functionality, what can I do to make this image fit better ? assuming the image and series are in the same boundaries.
Thanks,
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Re: Drawing canvas backimage
Hi Activex7,
You can get ChartRect boundaries but you won't be able to resize the Image tool unless you format the image outside TeeChart and add it already formated.The question I have is, what kind of image manipulation does it take to make a image fit well, if the series is a point series. Also can I get the resolution from Teechart ? I am guessing if I can get the resolution/width of the chart and can modify the image accordingly I might be able to get a more better fit ?
An alternative could be use ImagePoint series where you can set a pointer image and a point series on top with same values. Would this fit your needs?For example, say if have a series (point) with some data points and then I have a image with bubbles in it, where each of the bubbles should coincide with a point from the series, I am using the chart image tool as I want the zoom functionality, what can I do to make this image fit better ? assuming the image and series are in the same boundaries.
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 |