Can we generate a bubble chart with bubbles colored in a pie chart fashion.
I am currently using version: NetAdvantage 2010.3
Is it not the latest one.
Hi,
Which version of the product are you running? XamPieChart was only introduced more recently. If you upgrade to the latest volume release it should be available. You could also try to substitute the pie chart from the XamWebChart, but that would be less ideal.
Thanks for the information.
One more thing I wanted to clarify. The xamPieChart used in the example is a custom component or is it a infragistics component.
As I was trying to run the code on my machine then it shows compile error saying:
The tag 'XamPieChart' does not exist in XML namespace 'http://infragistics.com/Chart'
I tried adding following namespace
xmlns
:igChart=http://schemas.infragistics.com/xaml or
xmlns:igChart=http://schemas.infragistics.com/Chart
but still xamPieChart was not displayed.
I would caution against displaying this many metrics in one chart, but if you want to do it, have at it! :)
<UserControl.Resources> <local:TestData x:Key="data" /> <DataTemplate x:Name="pieChartMarker"> <Grid> <igChart:XamPieChart ItemsSource="{Binding Item.Breakdown}" LabelMemberPath="Label" ValueMemberPath="Value" LabelsPosition="BestFit"> </igChart:XamPieChart> </Grid> </DataTemplate> </UserControl.Resources> <Grid x:Name="LayoutRoot" Background="White"> <Grid.ColumnDefinitions> <ColumnDefinition /> <ColumnDefinition Width="Auto" /> </Grid.ColumnDefinitions> <igChart:XamDataChart> <igChart:XamDataChart.Axes> <igChart:NumericXAxis x:Name="xAxis" MinimumValue="0" MaximumValue="15" /> <igChart:NumericYAxis x:Name="yAxis" MinimumValue="0" MaximumValue="15" /> </igChart:XamDataChart.Axes> <igChart:XamDataChart.Series> <igChart:BubbleSeries XAxis="{Binding ElementName=xAxis}" YAxis="{Binding ElementName=yAxis}" ItemsSource="{StaticResource data}" XMemberPath="X" YMemberPath="Y" RadiusMemberPath="Total" MarkerTemplate="{StaticResource pieChartMarker}" LabelMemberPath="Label" > <igChart:BubbleSeries.RadiusScale> <igChart:SizeScale MinimumValue="70" MaximumValue="100"> </igChart:SizeScale> </igChart:BubbleSeries.RadiusScale> </igChart:BubbleSeries> </igChart:XamDataChart.Series> </igChart:XamDataChart> </Grid>
And code behind:
public partial class MainPage : UserControl { public MainPage() { InitializeComponent(); //DataContext = new TestData(); } } public class TestData : ObservableCollection<TestDataItem> { public TestData() { Add(new TestDataItem() { Label = "North America", Total = 10, X = 6, Y = 3, Breakdown = new Breakdown() { new BreakDownItem() { Label = "Hats", Value = 3 }, new BreakDownItem() { Label = "Shoes", Value = 5 }, new BreakDownItem() { Label = "Bags", Value = 2 } } }); Add(new TestDataItem() { Label = "South America", Total = 3, X = 9, Y = 4, Breakdown = new Breakdown() { new BreakDownItem() { Label = "Hats", Value = 1 }, new BreakDownItem() { Label = "Shoes", Value = 1 }, new BreakDownItem() { Label = "Bags", Value = 1 } } }); Add(new TestDataItem() { Label = "Europe", Total = 7, X = 3, Y = 8, Breakdown = new Breakdown() { new BreakDownItem() { Label = "Hats", Value = 3 }, new BreakDownItem() { Label = "Shoes", Value = 1 }, new BreakDownItem() { Label = "Bags", Value = 3 } } }); Add(new TestDataItem() { Label = "Australia", Total = 15, X = 6, Y = 7, Breakdown = new Breakdown() { new BreakDownItem() { Label = "Hats", Value = 2 }, new BreakDownItem() { Label = "Shoes", Value = 7 }, new BreakDownItem() { Label = "Bags", Value = 6 } } }); Add(new TestDataItem() { Label = "Africa", Total = 2, X = 10, Y = 11, Breakdown = new Breakdown() { new BreakDownItem() { Label = "Hats", Value = 1 }, new BreakDownItem() { Label = "Shoes", Value = 1 }, new BreakDownItem() { Label = "Bags", Value = 0 } } }); } } public class TestDataItem { public string Label { get; set; } public double Total { get; set; } public double X { get; set; } public double Y { get; set; } public Breakdown Breakdown { get; set; } } public class Breakdown : ObservableCollection<BreakDownItem> { } public class BreakDownItem { public string Label { get; set; } public double Value { get; set; } }
Hope this helps!Here's what it looks like:
-Graham
Oh, you mean divided like a pie chart! That would certainly look pretty interesting. Technically you could try to do this by creating a custom MarkerTemplate for the bubble series that contained a XamPieChart. It could bind against some data on the original item, which you can access via the Item property from the template. However, if you have a lot of bubbles, you might need a lighter weight pie chart in order to avoid any performance degradation. I'm uncertain if the performance will be satisfactory if you ended up rendering 300 pie charts in the chart, for example.
I may see if I can give you some sort of sample.