Wednesday, April 11, 2012

WPF pie chart - slices not displayed on the chart

I'm trying to use a WPF pie chart. The problem is that only the last slice remains displayed. I can see that all slices are displayed and immediatly hidden except the last one. Any idea ?



<DVC:Chart Margin="25,268,0,0" Title="Pointe de tarte" LegendTitle="Les datas" Background="LightSteelBlue" HorizontalAlignment="Left" VerticalAlignment="Top" Height="324" Width="307">
<DVC:PieSeries Title="Les datas en tarte" Name="Tarte2"
ItemsSource="{StaticResource FruitCollection2}"
IndependentValueBinding="{Binding Path=sss}"
DependentValueBinding="{Binding Path=nnn}" >
</DVC:PieSeries>




private void button3_Click(object sender, RoutedEventArgs e)
{
FruitCollection2 fff = new FruitCollection2();
fff.Clear();
fff.Add(new Fruit02 { nnn = this.data001.listeNombres03[0], bbb = 1, ddd = 10, sss = "Item a" });
fff.Add(new Fruit02 { nnn = this.data001.listeNombres03[1], bbb = 2, ddd = 9, sss = "Item b" });
fff.Add(new Fruit02 { nnn = this.data001.listeNombres03[2], bbb = 3, ddd = 11, sss = "Item c" });
fff.Add(new Fruit02 { nnn = this.data001.listeNombres03[3], bbb = 1, ddd = 14, sss = "Item d" });
fff.Add(new Fruit02 { nnn = this.data001.listeNombres03[4], bbb = 4, ddd = 7, sss = "Item e" });
fff.Add(new Fruit02 { nnn = this.data001.listeNombres03[5], bbb = 5, ddd = 1, sss = "Item f" });
fff.Add(new Fruit02 { nnn = this.data001.listeNombres03[6], bbb = 6, ddd = 7, sss = "Item g" });
fff.Add(new Fruit02 { nnn = this.data001.listeNombres03[7], bbb = 3, ddd = 6, sss = "Item h" });
fff.Add(new Fruit02 { nnn = this.data001.listeNombres03[8], bbb = 3, ddd = 7, sss = "Item i" });
fff.Add(new Fruit02 { nnn = this.data001.listeNombres03[9], bbb = 4, ddd = 5, sss = "Item j" });


this.Tarte2.ItemsSource = fff;

}




No comments:

Post a Comment