Changes between Version 9 and Version 10 of WikiStart


Ignore:
Timestamp:
2011-06-28 11:49:01 (13 years ago)
Author:
futzle
Comment:

Bar colouring.

Legend:

Unmodified
Added
Removed
Modified
  • WikiStart

    v9 v10  
    7575 
    7676By default, the plugin creates child devices for each appliance transmitter that the EnviR console can detect.  If you want to stop this, edit the '''!ApplianceAutoDetect''' variable in the '''Advanced''' tab of the parent device.  When set to "0", the plugin will no longer look for new appliances.  Existing appliances are unaffected.  
     77 
     78=== History graph colouring === 
     79 
     80If you pay different tariffs depending on time of use, you can define a snippet of code which assigns a colour to each bar in the history graphs of child devices. 
     81 
     82For the two-hourly graph, create a variable with service ID '''urn:futzle-com:serviceId:CurrentCostEnviR1''' and variable name '''TwoHourlyHistoryColour'''.  For the daily graph, create a variable with the same service ID and variable name '''DailyHistoryColour'''.  For the monthly graph, create a variable with the same service ID and variable name '''MonthlyHistoryColour'''.  (Americans take note at the spelling of these variables.) 
     83 
     84The contents of the variable is a JavaScript fragment which evaluates to a string in the form '''RRGGBB'''.  A variable '''time''' contains a JavaScript '''Date''' object corresponding to the start time of that bar in the graph. 
     85 
     86Examples: 
     87* In the two-hourly graph, to display red from 7 am to 11 pm on weekdays, and blue at other times: 
     88`time.getHours() >= 23 || !(time.getHours() >= 7) || time.getDay() == 0 || time.getDay() == 6 ?  '4D89F9' : 'CC5544'` 
     89* In the daily graph, to display purple for weekdays, and blue on weekends: 
     90`time.getDay() == 0 || time.getDay() == 6 ? '4D89F9' : 'AA55CC'` 
     91 
     92Note how the logic has been written to avoid HTML-special characters '''&''' and '''<'''.