i am using xamarin and i am going to create a chart, the third party component that i using for the chart is the telerik. The chart is the pie chart. I am following the document of the telerik which is
http://docs.telerik.com/devtools/xamarin/controls/chart/how-to/chart-how-to-create-custom-palette
In the end, the android work well. However when i debug in the simulator, the chart only show me one color which is the first colour of my palette. Is the telerik not support the custom palette for IOS?
The following is my code
var series = new PieSeries();
series.ValueBinding = new Telerik.XamarinForms.Chart.PropertyNameDataPointBinding{PropertyName = "Value"};
series.ItemsSource = data1;
series.ShowLabels = true;
series.ValueBinding = new PropertyNameDataPointBinding("Value");
chart.Series.Add(series);
chart.HeightRequest = 400;
chart.Palette = CustomPalettes.CustomWhite;
chartlayout.Children.Add(chart);
Palette code:
class CustomPalettes{
static CustomPalettes(){
CreateCustomWhitePalette();
}
public static ChartPalette CustomWhite { get; private set; }
private static void CreateCustomWhitePalette(){
ChartPalette palette = new ChartPalette();
palette.Entries.Add(new PaletteEntry() { FillColor = Color.FromRgb(255, 35, 255), StrokeColor = Color.FromRgb(255, 255, 255) });
palette.Entries.Add(new PaletteEntry() { FillColor = Color.FromRgb(0, 255, 255), StrokeColor = Color.FromRgb(255, 255, 255) });
palette.Entries.Add(new PaletteEntry() { FillColor = Color.FromRgb(116, 255, 0), StrokeColor = Color.FromRgb(255, 255, 255) });
palette.Entries.Add(new PaletteEntry() { FillColor = Color.FromRgb(255, 156, 0), StrokeColor = Color.FromRgb(255, 255, 255) });
palette.Entries.Add(new PaletteEntry() { FillColor = Color.FromRgb(255, 0, 255), StrokeColor = Color.FromRgb(255, 255, 255) });
palette.Entries.Add(new PaletteEntry() { FillColor = Color.FromRgb(255, 0, 153), StrokeColor = Color.FromRgb(255, 255, 255) });
palette.Entries.Add(new PaletteEntry() { FillColor = Color.FromRgb(0, 173, 204), StrokeColor = Color.FromRgb(255, 255, 255) });
palette.Entries.Add(new PaletteEntry() { FillColor = Color.FromRgb(255, 51, 51), StrokeColor = Color.FromRgb(255, 255, 255) });
palette.Entries.Add(new PaletteEntry() { FillColor = Color.FromRgb(255, 255, 51), StrokeColor = Color.FromRgb(255, 255, 255) });
CustomWhite = palette;}}
http://docs.telerik.com/devtools/xamarin/controls/chart/how-to/chart-how-to-create-custom-palette
In the end, the android work well. However when i debug in the simulator, the chart only show me one color which is the first colour of my palette. Is the telerik not support the custom palette for IOS?
The following is my code
var series = new PieSeries();
series.ValueBinding = new Telerik.XamarinForms.Chart.PropertyNameDataPointBinding{PropertyName = "Value"};
series.ItemsSource = data1;
series.ShowLabels = true;
series.ValueBinding = new PropertyNameDataPointBinding("Value");
chart.Series.Add(series);
chart.HeightRequest = 400;
chart.Palette = CustomPalettes.CustomWhite;
chartlayout.Children.Add(chart);
Palette code:
class CustomPalettes{
static CustomPalettes(){
CreateCustomWhitePalette();
}
public static ChartPalette CustomWhite { get; private set; }
private static void CreateCustomWhitePalette(){
ChartPalette palette = new ChartPalette();
palette.Entries.Add(new PaletteEntry() { FillColor = Color.FromRgb(255, 35, 255), StrokeColor = Color.FromRgb(255, 255, 255) });
palette.Entries.Add(new PaletteEntry() { FillColor = Color.FromRgb(0, 255, 255), StrokeColor = Color.FromRgb(255, 255, 255) });
palette.Entries.Add(new PaletteEntry() { FillColor = Color.FromRgb(116, 255, 0), StrokeColor = Color.FromRgb(255, 255, 255) });
palette.Entries.Add(new PaletteEntry() { FillColor = Color.FromRgb(255, 156, 0), StrokeColor = Color.FromRgb(255, 255, 255) });
palette.Entries.Add(new PaletteEntry() { FillColor = Color.FromRgb(255, 0, 255), StrokeColor = Color.FromRgb(255, 255, 255) });
palette.Entries.Add(new PaletteEntry() { FillColor = Color.FromRgb(255, 0, 153), StrokeColor = Color.FromRgb(255, 255, 255) });
palette.Entries.Add(new PaletteEntry() { FillColor = Color.FromRgb(0, 173, 204), StrokeColor = Color.FromRgb(255, 255, 255) });
palette.Entries.Add(new PaletteEntry() { FillColor = Color.FromRgb(255, 51, 51), StrokeColor = Color.FromRgb(255, 255, 255) });
palette.Entries.Add(new PaletteEntry() { FillColor = Color.FromRgb(255, 255, 51), StrokeColor = Color.FromRgb(255, 255, 255) });
CustomWhite = palette;}}