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");