This thread looks to be a little on the old side and therefore may no longer be relevant. Please see if there is a newer thread on the subject and ensure you're using the most recent build of any software if your question regards a particular product.
This thread has been locked and is no longer accepting new posts, if you have a question regarding this topic please email us at support@mindscape.co.nz
|
I am trying to find a WPF chart control that can do what I call strip-charting. If you know what strip-charting is I apologize now.
Let's say I set the x-axis to 100 points. I then add 10 points to the chart and they get displayed. I then add another 10 points and the chart now shows 20 points. I keep adding and adding and then when I get to over 100 points the graph just shows the last 100 points. I then hope I can manually scroll back on the graph to see the data to the left that has scrolled off the graph.
Can you chart control do this? |
|
|
Hi, Thanks for your call earlier today - I gave Jason a call who's out of the office at the moment but is generally our WPF chat expert to get an answer for you. His feedback was that there is no explicit option to enable this but that the infrastructure to achieve it is there already - it's just a case of making sure that you can scroll back across the old data. He has suggested that he can provide a sample for you early next week to demonstrate what you're looking to achieve. Apologies for the delay on replying to this thread, I hope that a sample early next week isn't going to impact your timelines. John-Daniel Trask
|
|
|
Hello I have attached a sample that demonstrates how to use the Mindscape WPF chart control to achieve the behaviour you have described. To run the sample, make sure to include a reference to your copy of the Mindscape.WpfElements.dll. When you run the sample, you will see the chart filling with data. Once the X axis is full, the viewport of the chart will automatically start scrolling to keep the latest 100 points on the screen. If you hold down the Ctrl key and drag the chart with the mouse, you can scroll back to see any part of the data. Now the chart does not automatically scroll, but data is still being dynamically added to the chart. By scrolling back to the end of the data, automatic scrolling can continue. Overall, not much code was needed to create strip-charting. In the root of MainWindow.xaml is a chart control containing a single line series. The XAxis has been setup to start with a minimum of 0 and a maximum of 100. No Y axis has been specified which means that the minimum and maximum values of the Y axis will be automatically updated as data is added to the chart. (If you need to specify a Y axis to set some of its properties such as the title, you can still get automatic value updates by not setting the Minimum and Maximum properties on the Y axis.) In MainWindow.xaml.cs, I've used a DispatcherTimer to add a random data point to the chart 10 times a second. On line 32 you can see the ItemsSource of the line series has been initialized to be an ObservableCollection. Lines 42 to 46 is a condition to see if the chart should automatically scroll when the next data point is added. lines 48 to 51 creates and adds the data point to the line series. Line 54 updates the Maximum of the X axis to accomidate the new data point if required. Setting this property will automatically update the ActualMaximum property, so lines 53 and 55 are used to store and then restore the ActualMaximum property. This is so dynamically adding data does not disrupt any user scrolling. Finally, lines 57 to 61 perform the automatic scrolling if allowed. The Minimum and Maximum axis properties refer to the total extent that the axis can display. Where as the ActualMinimum and ActualMaximum axis properties represents the logical start and end of the viewport of what the chart actually displays. Any of these properties can be set which is how I have implemented the strip-charting behaviour in this demo. Please let us know if there are any questions you have about implementing this. |
|