Changes between Version 10 and Version 11 of WikiStart


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

Attach bar colour examples and image

Legend:

Unmodified
Added
Removed
Modified
  • WikiStart

    v10 v11  
    8080If 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. 
    8181 
    82 For 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.) 
     82[[Image(CurrentCostBarColour.png)]] 
    8383 
    84 The 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. 
     84For 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.) 
     85 
     86The 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. 
    8587 
    8688Examples: 
     
    9092`time.getDay() == 0 || time.getDay() == 6 ? '4D89F9' : 'AA55CC'` 
    9193 
    92 Note how the logic has been written to avoid HTML-special characters '''&''' and '''<'''. 
     94Note how the logic has been written to avoid HTML-special characters '''&''', '''"''' and '''<'''.  This prevents weird HTML injection artifacts on the device's Advanced tab.