Xamarin Telerik - How to use the custom palette for ios

2 posts, 0 answers
  1. Chong
    Chong avatar
    4 posts
    Member since:
    Apr 2016

    Posted 06 Apr Link to this post

    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;}}

  2. Pavel R. Pavlov
    Admin
    Pavel R. Pavlov avatar
    1182 posts

    Posted 08 Apr Link to this post

    Hi Chong,

    We already answered to this question in the other thread you opened. Please refer to it and keep the communication there.

    Thank you for understanding.

    Regards,
    Pavel R. Pavlov
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  3. DevCraft banner
Back to Top