kmarkley wrote:I have two small feature requests:
1. Convert boolean data to 0/1 so it can be plotted. Would be nice if it also handled several of the common text-boolean-equivalents (up/down, on/off, locked/unlocked, true/false, etc).
2. Linear transformations with multiplier and offset (e.g. <datum> * X + Y). Offset would be especially helpful for plotting multiple boolean values. Multiplier is nice for unit conversion or just getting two plotlines in the same neighborhood if actual value is less important than trend or correlation.
I made this plot with variables and a whole mess of triggers, but it would be cleaner if it could be done in the plugin.
Thanks.
It's taken me longer than I expected, but both of these suggestions will be in the next update.
I've added a converter so that these values will be converted to chartable boolean values:
- Code: Select all
converter = {'true': 1,
'false': 0,
'open': 1,
'closed': 0,
'on': 1,
'off': 0,
'locked': 1,
'unlocked': 0,
'up': 1,
'down': 0,
'1': 1,
'0': 0,
'-99': 'NaN'}
A note on the last one. -99 is a value used in the WUnderground plugin to denote a "nonsense" value. NaN (Not a Number) should now be skipped rather than charted as -99. If you have other state values not reflected above, please let me know as they're easily added.
I've added linear transformations to the line chart device type (which seems like the only one needing it, but am open to other types) which will allow individual adjustments to be made to each line based on simple math expressions. So, for example, line 1 could be plotted as real and line two could be plotted as [ <datum> * X ] or [ <datum> + Y ] or [ <datum> * X + Y ]. The adjustment should be able to handle all "normal" mathematical operations but I expect [addition, subtraction, multiplication, division, and exponents] to be the most common. So your chart above should be easily recreated using:
Line 1
Line 2 + 2
Line 3 + 4
Line 4 + 6
Thanks again for the great suggestions. Hang tight for a forthcoming update after some more regression testing (there's lot's more changes under the hood.)
EDIT: better example for adjustment factor. See example below.