Hello again,
i have a pie chart with more than 7 slices and assigned a theme with my own color pallet. If i don't assign the theme it doesnt crashes.
Here is my sample
public IGPieChartThemeDefinition CreateThemePieChart10Colors()
{
IGPieChartThemeDefinition def = new IGPieChartThemeDefinition();
def.Font = UIFont.FromName("Helvetica", 12);
def.FontColor = new IGBrush(0, 0, 0, 1);
def.LegendFont = UIFont.FromName("Helvetica", 12);
def.LegendFontColor = new IGBrush(0, 0, 0, 1);
def.LegendBorderThickness = 1;
def.LegendPalette = new IGChartPaletteItem();
def.LegendPalette.Color = new IGBrush(UIColor.White);
IGChartPaletteItem item1 = new IGChartPaletteItem
Color = new IGBrush(24.0f / 255.0f, 116.0f / 205.0f, 1, 1),
OutlineColor = new IGBrush(0, 0, 0, 1)
};
def.SlicePalettes.Add(item1);
IGChartPaletteItem item2 = new IGChartPaletteItem
Color = new IGBrush(205.0f /255.0f, 102.0f / 255.0f, 0, 1),
def.SlicePalettes.Add(item2);
.....
IGChartPaletteItem item10 = new IGChartPaletteItem
Color = new IGBrush(205.0f / 255.0f, 0, 0, 1),
def.SlicePalettes.Add(item10);
return def;
}
....
PieChart = new IGPieChartView;
PieChart.Theme = CreateThemePieChart10Colors():
Did i forget something in the theme definition? It also crashed if i define only 5 items or using predefined colors from UIColor-enum.
Thanks,
Johann
Thanks Hristo,
it works fine both the Brushes and the Theme.
Hello,
In order to create custom them you should implement is as is shown on our online documentation:
http://help.infragistics.com/iOS/2014.1/?page=IGPieChartView_Themes.html
Also I’ve implemented simple sample in order to demonstrate you how you could achieve this. Also it is not necessary to implement your own theme in order to change the back color of the slices, instead you could generate array of IGBrush objects, and to assign it to Brushes property of IGChart, then the chart will ignores the colors defined in the them definition and will applies (cycle) brushes of that array. Uncomment _infraChart.Brushes = …; code in my sample in order to see this approach.
Please let me know if you have any further questions.