06-10-2013 01:36 PM
Hi,
I am having a problem using a strip chart and two numeric controls.
I am running LabWindows/CVI 2010 Version 10.0.1 (434)
I have searched the database but did not find anything close to the problem I am having.
It's actually quite simple.
As you can see from the graph below I have a strip chart and two numeric controls.
The numeric controls are meant to adjust the starting and ending values
The numeric; "shot count start" works flawlessly.
The ending numeric called; "Shot Count End" has its value written into the starting X position of the strip chart when it changes. (The only time I change this X value is when the starting numeric changes. When the ending numeric value changes all I do is change the number of points to display.)
I have placed the steps I use for each case below the diagram
When a change is made to the starting numeric
1. Clear Chart Data ClearStripChart ( panel, TRI_PANEL_CHART)
2. Change set number of points SetCtrlAttribute( panel, TRI_PANEL_CHART, ATTR_POINTS_PER_SCREEN, numberOfPoints);
3. Set the new X offset SetCtrlAttribute( panel, TRI_PANEL_CHART, ATTR_XAXIS_OFFSET, (double)newStart);
4. Draw Chart
When a change is made to the ending numeric
1. Clear Chart Data ClearStripChart ( panel, TRI_PANEL_CHART)
2. Change set number of points SetCtrlAttribute( panel, TRI_PANEL_CHART, ATTR_POINTS_PER_SCREEN, numberOfPoints);
3. Draw Chart
I last thing I attempted was to make the callback for the numerics the same.
Here is a graph of the crazy update when change the ending numeric
Thanks in advance for any suggestions
06-11-2013 03:49 PM
Hello Stylo
Would you mind posting a CVI project/files that reproduce your issue, so we can play with it in order to try to find a solution/explanation to this odd behavior??
Regards
Mart G
06-11-2013 05:12 PM
I'm not sure how to do that. In fact what's the best way to do that? Zip up my whole project and download it. Please let me know unless I have figured it out first.
Thanks
06-11-2013 06:04 PM
Hi Mart,
I've removed some proprietory information and have zipped it up and attached it
The simple directions to see the error are as such
Unzip and Run the program
Click the load button and load stats.txt
Click on the Process button
Now Check a few items in the box on the left side. (Some items will not graph, they are all zero but no matter)
Click on the Chart button and you will see the numerics become visible
Click on the down arrow on the "Shot Count End" numeric to produce the problem
Notes - In this example the full range is from 4518 - 4907
Thanks so much for looking at this.
I wouldn't be surprised if it is something that I am doing but ....
06-18-2013 08:39 AM
I think that you are plotting too many points, when the end is less than the default value. My guess is that you don't want the strip chart to scroll. But if you plot more points than the value that you set for ATTR_POINTS_PER_SCREEN, the strip chart scrolls and the x-axis values increase, as a result.
You should modify the loop in your chartData function so that the terminating condition is ii < newMax - numeric_end_offset.
Luis
06-18-2013 08:46 AM
By the way, even given this bug, you might have expected that the strip chart would only have scrolled by a much smaller amount. In the example that you gave (end = 4906) you are only plotting a single extra point by mistake. However, because your chart is in Sweep mode, it can only advance by one "page" at a time, which causes the previous end (4906) to become the new start, and the new end to become start + numberOfPoints. Therefore, that one extra point is enough to advance the chart by a lot more than one point.
If the chart were in the default Continuous mode, it would have only advanced by one point.
Luis
06-18-2013 10:25 AM
Luis,
Thanks very much for your time and analysis.
I appreciate it very much