Mick Posted January 5, 2010 Report Posted January 5, 2010 I am filling data for a bar chart (in a sample project) in the code-behind of my xaml file with the following code: private void RandomizeChart() { myChart.Series.Clear(); // Create the series and add them to the chart SeriesAttributes sa1 = new SeriesAttributes { Gallery = Gallery.Bar }; myChart.Series.Add(sa1); Random random = new Random(); // Set the data for the series for (int i = 0; i < 10; i++) { myChart.Data[0, i] = random.Next(10, 20); } } Something I'm doing causes the following: 9 points instead of 10 (the first is missing) Legend entry for "Series 2" What is the proper way to generate this chart in the code behind. I ask about the code behind because I often don't have necessary data in database / xml / ItemsSource ... (i.e. bindable) format)? --- Thank you, Mick Quote
JuanC Posted January 6, 2010 Report Posted January 6, 2010 Your code works fine (only 1 series and 9 points) using our current build, can you check the version of the ChartFX.WPF.dll file? You can download our most recent hotfix here, this page uses a control that will try to update your ChartFX files so if you have UAC enabled you must run IE as an Administrator. JuanC Quote
Mick Posted January 6, 2010 Author Report Posted January 6, 2010 Can you verify that there are 9 points and not 10? for(int i=0; i<10; i++) { ... } Should run 10 times, right? Mick Quote
JuanC Posted January 6, 2010 Report Posted January 6, 2010 I meant to say I get a chart with 10 points (all of them visible) and only 1 series. JuanC Quote
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.