Page 1 of 1
Tee Chart as Thumb Nail
Posted: Mon May 21, 2007 6:55 am
by 9527393
Hi,
I want to display the Tee Chart which I am already exporting as PNG Image as Thumb Nail version. Can some one tell me how can I do so?
Thanks,
Areef
Posted: Mon May 21, 2007 8:11 am
by narcis
Hi Areef,
When exporting a chart to an image you can specify the size of the image you want to generate, for example:
Code: Select all
TChart1.Export.asPNG.Height = 20
TChart1.Export.asPNG.Width = 50
Posted: Mon May 21, 2007 8:42 am
by 9527393
Hi NarcĂs,
It does NOT help me. My Tee Chart is best viewed at 720*360 (Width*Hieght) size. Now, I want the same Image to be available in smaller size of say 50*20. if I change the Width and Height as suggested by you here, the Image is LOST and only some portion of the Image is shown.
Thanks and Regards,
Areef
Posted: Mon May 21, 2007 8:48 am
by narcis
Hi Areef,
Then you could save the chart's size in temporary variables, resize it to 50*20, export the chart and resize the chart again to the original dimensions.
Posted: Mon May 21, 2007 8:58 am
by 9527393
I think I did't get exactly what you wanted me to do.
My code is as follows.
Code: Select all
tchart.Export.asPNG.Width = 720;
tchart.Export.asPNG.Height = 360;
return ((byte[]) tchart.Export.asPNG.SaveToStream());
I want this same code to be running in 2 modes, one mode while exporting as Full Image and another mode to export as Thumb Nail basically a smaller view of the same Image.
Could you help me in re-arranging the code so that I achieve my task?
Thanks again and Regards,
Areef
Posted: Mon May 21, 2007 9:08 am
by narcis
Hi Areef,
My suggestion was something like this:
Code: Select all
Dim tmpW, tmpH As Integer
tmpW = TChart1.Width
tmpH = TChart1.Height
'Export chart
TChart1.Export.asPNG.SaveToFile FileName
'Export thumbnail
TChart1.Width = 50
TChart1.Height = 20
TChart1.Export.asPNG.SaveToFile ThumbnailName
'Restore original chart dimensions
TChart1.Width = tmpW
TChart1.Height = tmpH
Posted: Mon May 21, 2007 9:21 am
by 9527393
When I am exporting in one style/mode I am not worried about the other style/mode.
When I am in Full Image Modei will export as Full Image only and not worried about Thumb Nail version and similarly when I am in Thumb Nail mode, I will export as Thumb Nail only and dont bother to resize back to normail Image mode.
So, my code snippet would be like this.
Code: Select all
If (ExportAsFullImage)
{
tchart.Export.asPNG.Width = 720;
tchart.Export.asPNG.Height = 360;
return ((byte[]) tchart.Export.asPNG.SaveToStream());
}
else if (ExportAsThumbNail)
{
tchart.Export.asPNG.Width = 70;
tchart.Export.asPNG.Height = 60;
return ((byte[]) tchart.Export.asPNG.SaveToStream());
}
If you observe here, I am not deling here with File Names at all and am exporting to stream and this stream is written to screen. I tried with this code only and when I am exporting as Thumbnail, the Image gets clipped rather than showing as a small Image.
I was wondering does the Zoom or CompressionLevel properties help me in any way?
Regards,
Areef
Posted: Mon May 21, 2007 9:31 am
by narcis
Hi Areef,
Please notice that the code I posted actually resizes the chart, not the exported image. Could you please try if it works fine at your end?
Thanks in advance.
Posted: Mon May 21, 2007 9:46 am
by 9527393
I tried with the code as follows:
Code: Select all
tchart.Width = 70;
tchart.Height = 60;
return ((byte[]) tchart.Export.asPNG.SaveToStream());
But, again here also the same result of clipping of the Image. is it correct what I am doing here?
Regards,
Areef
Posted: Thu May 31, 2007 4:03 pm
by Pep
Hi Areef,
yes, one way to accomplish it, as you said, would be using the Zoom. You will have to change the Zoom before to do the export :
TChart1.Aspect.Zoom = 150
or assign it to 100 depending on the choosed option.