1
I have the chart below where the first load works normally, but when I do a search and change the list it continues with the previous series.
Ex: in the first load I have 8 items in the list and it shows ok. According to a population search again with 21 items but the chart continues showing the 8 previous items.
<chart:ClusteredColumnChart
x:Name="chtEvolucaoDiaria"
Style="{StaticResource MinimalChartStyle}"
ChartTitle="Evolução Diária"
Grid.Row="1"
Grid.Column="3"
Width="auto"
Height="400"
Background="#444444"
Foreground="White"
Palette="{StaticResource Cores}"
ChartSubTitle=""
>
</chart:ClusteredColumnChart>
In the codebehind populo it this way:
chtEvolucaoDiaria.Series.Clear();
ChartSeries series = new ChartSeries();
series.Name = "dc" + dia;
series.DisplayMember = "Categoria";
series.ValueMember = "Valor";
series.SeriesTitle = dia.ToString();
series.Foreground = Brushes.White;
series.ItemsSource = ListaDcEvolucaoDiaria;
chtEvolucaoDiaria.Series.Add(series);
Editing
Apparently change the order of the following lines works:
Of:
series.ItemsSource = ListaDcEvolucaoDiaria;
chtEvolucaoDiaria.Series.Add(series);
To:
chtEvolucaoDiaria.Series.Add(series);
series.ItemsSource = ListaDcEvolucaoDiaria;