假设我有这个XAML(使用Live ChartBuilder创建):
<Grid xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:sys="clr-namespace:System;assembly=mscorlib" xmlns:datavis="clr-namespace:System.Windows.Controls.DataVisualization;assembly=System.Windows.Controls.DataVisualization.Toolkit" xmlns:charting="clr-namespace:System.Windows.Controls.DataVisualization.Charting;assembly=System.Windows.Controls.DataVisualization.Toolkit" xmlns:utility="clr-namespace:Utility;assembly=ChartBuilder" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<charting:Chart>
<charting:Chart.Series>
<charting:BarSeries
Title="Series 1">
<charting:BarSeries.ItemsSource>
<utility:ObservableObjectCollection>
<sys:Double>1</sys:Double>
<sys:Double>2.33333325386047</sys:Double>
<sys:Double>3.66666674613953</sys:Double>
<sys:Double>5</sys:Double>
</utility:ObservableObjectCollection>
</charting:BarSeries.ItemsSource>
</charting:BarSeries>
<charting:BarSeries
Title="Series 2">
<charting:BarSeries.ItemsSource>
<utility:ObservableObjectCollection>
<sys:Double>1</sys:Double>
<sys:Double>2.33333325386047</sys:Double>
<sys:Double>3.66666674613953</sys:Double>
<sys:Double>5</sys:Double>
</utility:ObservableObjectCollection>
</charting:BarSeries.ItemsSource>
</charting:BarSeries>
</charting:Chart.Series>
</charting:Chart>
</Grid>
生成带有两个水平显示条形的条形图。我该如何堆叠?
答案 0 :(得分:4)
Silverlight图表还没有完全成熟的堆积条形图/柱形图。
请查看此link,了解自定义堆叠柱式图表系列的示例,这些图表系列可能适合您的需要,或者至少可以轻松修改。