Gnats 5953: Plotting: Patterned lines sometimes look solid, esp. with thickness greater than one.
- Phil Weinstein, CADSWES, 4-18-2017, revised 4-19-2017.
RiverWare plot curves with a good number of data points (e.g. 500+) and a dotted or dashed line style sometimes appear as solid lines. This can occur with a thin line, but is more prevalent with a line width (thickness) of two or more pixels. The prevalence of this problem is also dependent on the curve style -- less so with 'Linear Interpolation' -- more with Spline, Points, or Step.
The following two plots show two series slot curves, each with 3440 points drawn with a dashed line style and a width (thickness) of two pixels. The red curve has the "stepped" curve style; the green curve has the "linear" curve style. (At this level of detail, the stepped and linear slot curves look similar). The first plot shows the problem (the curves appear to be solid). The second plot shows the fix devised for RiverWare 7.1.
SEE ALSO the more detailed screenshots shown on this webpage, illustrating the problem:
The fix involves a point filter (the Qwt "Weed Curve Fitter") which has the possibility of negatively impacting plot performance. We haven't actually seen a problem with the application of this point filter with long series (tested with 30,000-timestep series slots), but in case this does turn out to create a problem for particular users, we have provided a way to disable this filter through the use of a special environment variable. The filter is disabled if the following environment variable is defined and has a non-zero value (e.g. "1"):
Note: On Windows, environment variables are defined through the "System Properties" dialog. This may be accessible only by privileged accounts (e.g. an "Administrator"). That dialog is available through Control Panel >> System Settings >> Advanced System Settings. [This is on Windows 8.1].
If the filter is disabled (using this environment variable), the following message is written to RiverWare diagnostics when the first non-empty plot is shown:
Note that RiverWare (or Visual Studio, if RiverWare is run in the debugger) must be restarted for an environment variable change to have an effect.
The fix is effectively accomplished by removing points from the plotted curve which redundantly fall within a pixel or two of adjacent points -- at the current zoom level of the plot. (This doesn't remove point-symbols, if those are also shown for a curve). This is accomplished with the "QwtWeedingCurveFitter" class (part of the Qwt version 6.1.3 library used to implement RiverWare plots).
We have been warned that this filter could cause performance problems with long curves (having many points) if it is used in the canonical way (installed on the curve to be automatically applied to pixel coordinates each time the curve is drawn). The recommended alternative of applying it to application-unit points before handing the point series over to Qwt isn't really mathematically valid AND wouldn't reliably address the problem anyway. In our own testing with long series (e.g. 30,000 timesteps) we haven't seen any additional slowness, beyond what is experienced with such large curves in general.
See the discussion in these threads on the QtCentre/Qwt forum:
Each Qwt plot curve can be assigned a single "curve fitter" instance, of which there are two types: (a) QwtSplineCurveFitter, and (b) QwtWeedingCurveFitter. RiverWare had already been making use of the Spline Fitter -- this is how we provide the "Spline" curve style (as "Spline" is not a native Qwt curve style, as such). We had to sublcass QwtSplineCurveFitter in order to apply both fitters for spline curves. For this fix, we also subclassed QwtWeedingCurveFitter so that we could control the application of the actual fitter computation with RiverWare application-level provisions. See these two classes in the Q3GUI/SlotCurve module, and this Qwt API reference webpage:
Unfortunately, Qwt doesn't make use of its Curve Fitters for curves having the "Step" curve style. So, we needed to create our own "stepped" line data from slot data, and present that to Qwt with the "linear" (-interpolation) curve style. See this SlotCurve method:
--- (end) ---