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.
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Chart saved with black background on Android

Thread ID:

Created:

Updated:

Platform:

Replies:

132857 Sep 25,2017 04:26 PM UTC Oct 6,2017 12:22 PM UTC Xamarin.Forms 3
loading
Tags: SfChart
Mareike Leja
Asked On September 25, 2017 04:26 PM UTC

Hey all,

I have troubles with the saveAsImage Method in Android.
My Chart has a white background and black axes explicitly set in code and is rendered correctly in the UI.
However, when saved it has a black background and white axes. 

In UWP it works just fine and the images lock as desired.
Since I need the images to put them in a PDF, the black background does not work for me.

How can I force it to keep the color?

Regards,
Mika

Parthiban Sundaram [Syncfusion]
Replied On September 26, 2017 12:17 PM UTC

Hi Mika,

Thanks for using Syncfusion products.

We were unable to reproduce the reported issue at our end and we have prepared the sample for this. Please update us modified sample or chart related code snippet based on your application to reproduce the issue which will be helpful for providing further assistance on this.

Sample: http://www.syncfusion.com/downloads/support/forum/132857/ze/SaveAsImage-1257935093

Also, we would like to inform you that the default background color of the Chart is white and default color of the axis is black.

Regards,
Parthiban S

Mareike Leja
Replied On October 4, 2017 04:57 PM UTC

 Hi Parthiban ,

here is the Code I use, I cut out the Axis and Legend initialisation to shorten it. 

By the way, the CustomColorPalette does not work as well, ChartColorCollection is not recognized but I found a workaround.

The images I get from this code are still with black background and white axes. 

Xamarin.Forms.Color[] Colors = new Xamarin.Forms.Color[] {

                                Xamarin.Forms.Color.Green, Xamarin.Forms.Color.Yellow, Xamarin.Forms.Color.Red, Xamarin.Forms.Color.Gray };

                                    SfChart ColumnChart = new SfChart()

                                    {

                                        WidthRequest = 50,

                                        HeightRequest = 250,

                                        BackgroundColor = UIResources.Color17, //this is white

                                        //ColorModel = new ChartColorModel()

                                        //{

                                        //    Palette = ChartColorPalette.Custom,

                                        //    CustomBrushes = new ChartColorCollection()

                                        //    {

                                        //     Color.Green

                                        //        Color.Yellow,

                                        //        Color.Red,

                                        //        Color.Gray,

                                        //    }

                                        //},

                                    };

                                 int i = 0;

                                    foreach (ObservableCollection<DiagrammWerte> col in pdfWert.DiagrammData.werte)

                                    {

                                        ColumnSeries series = new ColumnSeries()

                                        {

                                            ItemsSource = col,

                                            XBindingPath = "X",

                                            YBindingPath = "Y",

                                            Label = pdfWert.DiagrammData.legendenText[i],

                                            Color = Colors[i],

                                        };

                                        StackedChart.Series.Add(series);

                                        i++;

                                    }

                                    content.Children.Add(StackedChart);

                                    StackedChart.SaveAsImage("chart.jpg");

                                    


Parthiban Sundaram [Syncfusion]
Replied On October 6, 2017 12:22 PM UTC

Hi Mareike,

Thanks for the update.

We have created an incident under your Direct Trac account. So, we request to follow the incident for further details.

Our Direct Trac support system can be accessed from the following link:

https://www.syncfusion.com/account/login?ReturnUrl=%2fsupport%2fdirecttrac%2fincidents  

Regards,
Parthiban S

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;