This is a migrated thread and some comments may be shown as answers.
Xamarin Telerik - How to use the custom palette for ios
3 Answers 24 Views
This is a migrated thread and some comments may be shown as answers.
Chong
Top achievements
Rank 1
Chong asked on 06 Apr 2016, 10:05 AM

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

3 Answers, 1 is accepted

Sort by
0
Pavel R. Pavlov
Telerik team
answered on 08 Apr 2016, 07:16 AM
Hello Chong,

I tried to reproduce the reported behavior on our side and the code seems to be working as expected. I prepared a sample application using the RadPieChart with one PieSeries with 10 business data points and a custom palette. The custom palette is created as described in the referenced article. The only difference is your particular entries (in other words - the colors you use). The result under iOS is as the attached picture shows.

In order to assist you we will need you to elaborate more on your scenario. What is the exact code for creating the business data points of the PieSeries? Also, we would like to ask you to provide us with a picture showing the final result.

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
0
Chong
Top achievements
Rank 1
answered on 14 Apr 2016, 04:07 AM
Hi pavel, i am glad u support this, the above is my code, however the result is the below, may i have your source code file? or entire solution file
0
Pavel R. Pavlov
Telerik team
answered on 15 Apr 2016, 07:02 AM
Hi Chong,

I am sending you the setup that I used to achieve the referenced result on our side. Please take a look at the attached solution and let us know if you have any other questions.

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
Asked by
Chong
Top achievements
Rank 1
Answers by
Pavel R. Pavlov
Telerik team
Chong
Top achievements
Rank 1
Share this question
or