I have the graph 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 survey again with 21 items however the chart continues showing the previous 8 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 changing the order of the following lines works:
From:
series.ItemsSource = ListaDcEvolucaoDiaria;
chtEvolucaoDiaria.Series.Add(series);
To:
chtEvolucaoDiaria.Series.Add(series);
series.ItemsSource = ListaDcEvolucaoDiaria;