Difference between revisions of "Widget:GraphInteractivity"
m (update color state (experimental)) |
m (whoops, typo) |
||
Line 125: | Line 125: | ||
var powerstrip = document.querySelector( "g#" + _powerConsumption.name + ">polygon+text" ); | var powerstrip = document.querySelector( "g#" + _powerConsumption.name + ">polygon+text" ); | ||
if ( powerstrip ) | if ( powerstrip ) | ||
− | powerstrip.textContent = "strip " + | + | powerstrip.textContent = "strip " + _powerConsumption.value + _powerConsumption.unit; |
var color; | var color; | ||
− | if ( | + | if ( _powerConsumption.value < 5 ) |
color = "lightgray"; | color = "lightgray"; | ||
− | else if ( | + | else if ( _powerConsumption.value < 10 ) |
color = "green"; | color = "green"; | ||
− | else if ( | + | else if ( _powerConsumption.value < 100 ) |
color = "lightgreen"; | color = "lightgreen"; | ||
− | else if ( | + | else if ( _powerConsumption.value < 200 ) |
color = "yellow"; | color = "yellow"; | ||
− | else if ( | + | else if ( _powerConsumption.value < 1000 ) |
color = "orange"; | color = "orange"; | ||
else | else |
Revision as of 13:54, 29 May 2018
This widget allows you to display the Space API data (provided as JSON)
Created by Xopr
Using this widget
To insert this widget, use the following code:
{{#widget:GraphInteractivity}}
This will add javascript logic that enables 'interactivity' to graphs.
Copy to your site
To use this widget on your site, just install MediaWiki Widgets extension and copy full source code of this page to your wiki as Widget:GraphInteractivity article.