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

Chart saved with black background on Android

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

3 Replies

PS Parthiban Sundaram Syncfusion Team 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


ML Mareike Leja 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");

                                    



PS Parthiban Sundaram Syncfusion Team 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

Loader.
Up arrow icon