Author |
Topic |
|
blazermaniac
USA
27 Posts |
Posted - 21 Jul 2016 : 17:48:19
|
I found that if my chart has only a single point then the chart crashes with an 'Overflow error'.
I was able to reproduce this using the BatchVariableControlCharts sample BatchXBarRChart. |
|
quinncurtis
1586 Posts |
Posted - 22 Jul 2016 : 09:18:17
|
I would assume that you are calling the AutoCalculateControlLimits method, which according to the formulas for control limits require two or more sample intervals. In general you should assume that all charts require a minimum of two sample intervals before you try and plot them. |
|
|
blazermaniac
USA
27 Posts |
Posted - 22 Jul 2016 : 11:32:08
|
I am not calling AutoCalculateControlLimits.
When tested with BatchVariableControlCharts - BatchXBarRCharts, the program got an exception in the Draw method of ChartView the 4th iteration of DrawObject(g2, achartobj, drect);
This is exactly where it happens with my program as well. |
|
|
quinncurtis
1586 Posts |
Posted - 22 Jul 2016 : 13:14:54
|
I tested the BatchVariableControlCharts.BatchXBarRChart example, with one data point, in the current release, and cannot reproduce an error. So if it is critical in your application to display a chart with one data point (rather than waiting for two, since that is the only way control lines will be drawn), you should download the current version using your original download link(s).
|
|
|
blazermaniac
USA
27 Posts |
Posted - 22 Jul 2016 : 13:53:11
|
How I reproduced it in that example was to put a break point at the following line:
int numdatapointsinview = 17;
After executing that line I changed the value of numdatapointsinview to 1. Next I set a break point in SimulateData() and forced the loop to only execute once. Are these the same steps you used? |
|
|
quinncurtis
1586 Posts |
Posted - 22 Jul 2016 : 13:58:55
|
You absolutely cannot have the numdatapointsinview parameter used to define the display characteristics of the chart set to 1. It must be set to the final number of sample intervals you expect you expect to display at a time for chart. It cannot be adjusted on the fly. |
|
|
blazermaniac
USA
27 Posts |
Posted - 22 Jul 2016 : 14:55:54
|
In this particular exercise I did expect the final number of sample intervals to be 1 because I manipulated the logic in SimulateData() to only simulate data for a singe point.
However, you have solved my problem. I reran the test without adjusting numdatapointsinview and it didn't throw an exception. I took a closer look at the logic in my program and found the issue.
Normally I would set numdatapointsinview to a configured amount, however, if they are running a date range report I change numdatapointsinview to the number of rows returns from my query (If you're wondering, we do this in order to be able to capture a screen shot and save it to file). So in the case that only one row is returned from the query, setting numdatapointsinview to that value (1) causes the issue.
I will adjust my logic so that it never sets numdatapointsinview to less than 2.
Thanks for your help! |
|
|
|
Topic |
|