We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Get path to saved sfChart image

Hi all,

Loving sfChart so far!

I am using sfChart.SaveAsImage to save my chart as an image on the device. This works perfectly so far on Android - the image is saved to the device, and I can see it on the device at 

> root > sdcard > Pictures

Now I'd like to send an email with this image as an attachment. How do I find the path to the saved image?

I've tried var folder = Environment.GetFolderPath(Environment.SpecialFolder.X); where X is CommonDocuments, LocalApplicationData, Personal, CommonPictures, etc, but I haven't managed to find the correct one. Am I going about this the right way? What is the correct way to do this that will work on all Android devices?

Thanks,

David

6 Replies

MK Magesh Kumar Krishnan Syncfusion Team January 14, 2016 12:23 PM UTC

Hi David,

Thanks for using Syncfusion products.

We have prepared a sample to get the path of saved images for Android. Please find the sample from location given below.

http://www.syncfusion.com/downloads/support/forum/121651/ze/ChartSample_GetImagePath-554251726  

Regards,
Magesh Kumar K


DC David Conlisk January 14, 2016 01:06 PM UTC

Hi Magesh,

Thanks, works perfectly!

David


DC David Conlisk January 22, 2016 10:04 AM UTC

Hi Magesh,

Now I have the same issue on the iOS version. It says here http://help.syncfusion.com/xamarin/sfchart/export that on iOS the image is saved in the "Photos/Album" folder, so I've been trying code like this:

var path = Environment.GetFolderPath (Environment.SpecialFolder.Personal); 
var filePath = Path.Combine (path, "Photos/Album", attachmentName);
var graphImage = UIImage.FromFile (filePath);
 

But graphImage is always null. Any ideas?

Thanks,

David


ME Manivannan Elangovan Syncfusion Team January 25, 2016 11:40 AM UTC

Hi David,

We have prepared a sample for getting the saved image from the image path in iOS and it can be downloaded from the following location.

Sample: GetImagePath

Regards,
Manivannan.E


DC David Conlisk January 25, 2016 01:36 PM UTC

Hi Manivannan,

Thank you. That code works. 

Ideally I would just be able to use the chart.SaveAsImage command out of the box for both platforms, rather than having to basically write my own version for iOS, but it works so thank you!

David


ME Manivannan Elangovan Syncfusion Team January 26, 2016 08:04 AM UTC

Hi David,

Thanks for the update. Please let us know if you have any other queries.

Regards,
Manivannan E.

Loader.
Live Chat Icon For mobile
Up arrow icon