bobt Posted August 10, 2008 Report Share Posted August 10, 2008 I am using the ChartFX 8 WPF Beta. I have two questions about data binding. 1) How do I remove or clear the default data that shows up with the chart? Even if I have not bound data to the chart, there is still data, but upon object inspection using the debugger, I did not see the values in the Chart.Data or Chart.Points properties. 2) Why does the Bar gallery naturally show multiple series, but the Line gallery does not? I am adding multiple SeriesAttribute object to the Chart.Series collection at run time upon notification of OnDataContextChanged. The same code snippet below works for the Bar gallery, but not the Line gallery. What should I do differently? Many thanks. for (int j = 0; j < argCurveFamily.Curves.Count; j++) { SeriesData sd = argCurveFamily.Curves[j];SeriesAttributes sa = new SeriesAttributes(); MyChart.Series.Add(sa); sa.ItemsSource = sd.Points;sa.BindingPath = "Y"; sa.BindingPathX = "X";} Quote Link to comment Share on other sites More sharing options...
JuanC Posted August 11, 2008 Report Share Posted August 11, 2008 1) You can remove our random data or your own data doing this chart1.Series.Clear();chart1.ItemsSource = null;2) Bar can also show multiple series but we do not support X values in bars by default, you can see this by commenting out the BindingPathX setting. We have a new build where you can optionally turn on X support for bars, to do this you have to specify a single width your bars will have. If you want to use this functionality please drop an email to wpf at softwarefx dot com. Regards, JuanC Quote Link to comment Share on other sites More sharing options...
bobt Posted August 11, 2008 Author Report Share Posted August 11, 2008 I tried calling a Reset() method with the 2 lines of code you suggested; however, manually setting ItemsSource to null forces the whole chart to be blank, although I subsequently add the data through the SeriesAttributeCollection property. Interestingly, ItemsSource is already null so resetting this dependency property to null is refiring some background events that white out other default properties. Thoughts? Quote Link to comment Share on other sites More sharing options...
JuanC Posted August 19, 2008 Report Share Posted August 19, 2008 Can you explain more your scenario? - What do you want to see when your window/page is displayed? empty chart? -At what point are you ready to pass data to the chart? Window Constructor? OnLoaded? Timer? Also if you could post a small sample app it would make it easier for us to either duplicate the issues you are experiencing or suggest changes. Regards, JuanC Quote Link to comment Share on other sites More sharing options...
bobt Posted August 19, 2008 Author Report Share Posted August 19, 2008 I appreciate your follow up. I was able to solve the problem by _not_ setting the Chart.Series.Count before adding the series themselves. I simply call Chart.Series.Clear() as you suggested. Data is passed to the chart during the OnDataContextChanged dependency properties event. Thanks, Bishr Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.