Hello!
We provide an option to our users to show/hide certain series. This is done by setting visibility of particular series to Visible/Collapsed.
Their ItemsSource is set to ObservableCollection, and sometimes this collection changes. And the problem happens when doing this:
1) User hides one of the series (sets Visibility to Collapsed)
2) Series changes
3) User sets Visibility to Visible
After this, series isn't visible! This problem happens only with the series that have been hidden, others are changing fine.
In fact, data is bound correctly, but the chart doesn't draw this series for some reason. This is confirmed by the fact that forcing the chart to refresh (e.g. zooming) instantly shows that missing series.
So, why is this happening? Is there any way to force XamDataChart to refresh explicitly?
Currently, I use a workaround: I set visibility to Collapsed, give time to draw a series using Windows.Forms.Application.DoEvents() (without this it wouldn't work), change series, and then set Visibility to Collapsed, but it isn't acceptable because the missing series "blinks" for a moment during this.
Best regards, Vasily.
Hi Vasily,
I was able to reproduce the behavior you described with the series not becoming visible after updating the visibility property in code behind and using the steps you described in your last post.
I am in the process of logging a development issue for you and I will contact you directly thru a case I am creating for you.
Thanks for your reply!
I said that I have a problem when changing data of the series that I am hiding, so I changed your sample that way:
private void btn2_Click(object sender, RoutedEventArgs e) { foreach (Data d in vm.ChartData) { d.Total += 5; } chart1.UpdateLayout(); }
private void btn2_Click(object sender, RoutedEventArgs e)
{
foreach (Data d in vm.ChartData)
d.Total += 5;
}
chart1.UpdateLayout();
Steps to reproduce:
1) Click "toggle"
2) Click "chnge series2"
3) Click "toggle"
By the way, a problem can be reproduced even with the original version of this sample that you sent to me:
1) Click "chnge series2" 3 times
2) Click "toggle"
3) Click "chnge series2"
4) Click "toggle"
As you can see, in both ways series just isn't visible, if you resize a window, it appears back.
HI Vasily,
I am attaching a sample project I wrote.
The sample has two button, one to toggle the visiblity of the first series. The other button changes the data on the 2nd series.
Can you provide me the steps to reproduce this issue uing the attached sample.
Sincerely, Matt Developer Support Engineer