- Home
- Forum
- Xamarin.iOS
- change color of Piechart
change color of Piechart
We can achieve your requirement by using the property ColorModel in the Series. Refer to the following code example which shows how to set ColorModel in series.
CodeExample:
SFPieSeries series = new SFPieSeries ();
series.ColorModel.Palette = SFChartColorPalette.Custom;
NSObject[] cusColors = new NSObject[] {UIColor.Blue,UIColor.Green,UIColor.Orange,UIColor.Red,UIColor.Cyan};
series.ColorModel.CustomColors = NSArray.FromNSObjects(cusColors);
series.DataMarker.ShowLabel = true;
return series;
We have prepared a sample based on your requirement. Please find the sample from the following location.
Sample: PieChart
Regards,
Manivannan.E
its works perfect
Thanks for the update. Please let us know if you have any query.
Regards,
Manivannan.E
Hi Lakhwinder,
We can achieve your requirement by using the property ColorModel in the Series. Refer to the following code example which shows how to set ColorModel in series.
CodeExample:
SFPieSeries series = new SFPieSeries ();
series.ColorModel.Palette = SFChartColorPalette.Custom;
NSObject[] cusColors = new NSObject[] {UIColor.Blue,UIColor.Green,UIColor.Orange,UIColor.Red,UIColor.Cyan};
series.ColorModel.CustomColors = NSArray.FromNSObjects(cusColors);
series.DataMarker.ShowLabel = true;
return series;
We have prepared a sample based on your requirement. Please find the sample from the following location.
Sample: PieChart
Regards,
Manivannan.E
I did it in XAML:
<chart:PieSeries ItemsSource="{Binding HighTemperature}" >
<chart:PieSeries.ColorModel>
<chart:ChartColorModel Palette="Custom" >
<chart:ChartColorModel.CustomBrushes>
<Color>
Red
</Color>
<Color>
Yellow
</Color>
<Color>
Green
</Color>
</chart:ChartColorModel.CustomBrushes>
</chart:ChartColorModel>
</chart:PieSeries.ColorModel>
<chart:PieSeries.DataMarker>
<chart:ChartDataMarker ShowLabel="True"></chart:ChartDataMarker>
</chart:PieSeries.DataMarker>
</chart:PieSeries>
|
<chart:PieSeries.ColorModel>
<chart:ChartColorModel Palette=" TomatoSpectrum" >
</chart:PieSeries.ColorModel> |
Parthiban S
- 6 Replies
- 5 Participants
-
LA lakhwinder
- Nov 2, 2015 07:02 AM UTC
- Sep 5, 2017 04:34 PM UTC