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

SfChart.SaveAsImage does nothing

While developing a Cross-Platform App for iOS, Android and UWP using Xamarin Forms for Visual Studio and Essential Studio, I encountered some problems with the save as Image Method.
It just does nothing, it doesn't throw an error, but the pictures are nowhere to be found.
Permissions to write in the personal folders are set, creating and displaying the chart works like a charm.
I tested it on Windows 10 and Android 5.0.1

Here is the code:

SfChart chart = createChart();
chart.SaveAsImage("Ver.jpg");

What could be the Problem?
Cheers, 
Mika

7 Replies

YP Yuvaraj Palanisamy Syncfusion Team December 14, 2016 02:23 PM UTC

Hi Mareike Leja,

Thanks for contacting Syncfusion support.

We have prepared a sample as per your requirement. Please find the sample from the following location.

Sample: http://www.syncfusion.com/downloads/support/forum/127849/ze/SimpleSample-406004572  

Note: For iOS project, we will update you more details within one businessday( 15/12/2016 ).

Regards,
Yuvaraj 



ML Mareike Leja December 14, 2016 03:55 PM UTC

Thanks for your effort, but you just gave me the code I already have. Creating the chart and calling the SaveAsImage method works fine.
There is just no picture, I searched the whole device, starting with the pictures directory, and there is no saved chart.

Question was: As the SaveAsImage method doesn't throw an error and pretends to work, what else could cause the problem?


PS Parthiban Sundaram Syncfusion Team December 16, 2016 12:45 AM UTC

Hi Mareike,

Thanks for the patience.

Please download the sample for iOS from following location.

Sample: http://www.syncfusion.com/downloads/support/forum/127849/ze/SaveAsImage-462574007  

Regarding “Storage location

The exported image will be saved in different location across the platforms.

Android – The image will be saved inside the Pictures directory. You can find it using the file explorer application.

iOS – The image will be saved inside the “Photos/Album” directory.

UWP – A Save as dialog box will appear to choose the storage location.

Regards,
Parthiban S
 



MZ Mark Zhukovsky March 2, 2017 02:28 PM UTC

For UWP, is there a way to bypass the dialog and just save the image somewhere, say a temp folder, or alternatively, get a Stream from SfChart as it seems GetStream isn't supported for UWP? I find for iOS and Android the GetStream method very convenient for generating a PPT export of the exact same charts that users see in the app, and would like to achieve the same effect for UWP... please assist.


DA Devi Aruna Maharasi Murugan Syncfusion Team March 3, 2017 11:25 AM UTC

Hi Mark, 
  
Thanks for contacting Syncfusion Support. 
  
We have achieved your requirement by using CustomRenderer with ChartDependencyService for UWP. We have prepared a demo sample based on this requirement and it can be downloaded from below link, 
  
  
Regards, 
Devi 






GA Gasser April 4, 2017 07:03 AM UTC

Hello,
First of all, I want to than you all at Syncfusion for the great support.

Can you juste please explain me why you did put "await Task.Delay(1000);" before the call of "Save" function of the NativeChart object in the "SaveChart" UWP implementation of customRenderer.

Thank you in advance for your answer


DA Devi Aruna Maharasi Murugan Syncfusion Team April 5, 2017 01:07 PM UTC

Hi Gasser, 
  
Thanks for your update. 
  
We would like to inform you that using delay task is not necessary for all the cases. In some scenario, chart’s save method will be called before created the stream. So, to avoid this, have used delay (await Task.Delay()) before saving the chart. 
  
Regards, 
Devi 


Loader.
Up arrow icon