Hat schon jemand versucht die SteelSeries-Canvas mit smartvisu zu verheiraten. Ich könnte mir gut vorstellen, dass man damit eine nette Startseite gestalten kann...
Code auf Github



Code auf Github




/** * Displays a steelseries lcd * * @param unique id for this widget * @param a gad/item */ {% macro lcd(id, gad) %} <canvas id="{{ id | replace({'.': '_'}) }}" data-widget="steelseries.lcd" data-item="{{ gad }}" width="50" height="50"></canvas> <script> var scroll = false; var {{ id | replace({'.': '_'}) }}; function init() { // Initialzing gauge var sections = [steelseries.Section(0, 70, 'rgba(255, 0, 0, 1.0)'), steelseries.Section(70, 95, 'rgba(255, 255, 0, 1.0)'), steelseries.Section(95, 100, 'rgba(0, 255, 0, 1.0)') ]; {{ id | replace({'.': '_'}) }} = new steelseries.DisplaySingle('{{ id | replace({'.': '_'}) }}', { width: 120, height: 50, section: sections }); {{ id | replace({'.': '_'}) }}.setLcdColor(steelseries.LcdColor.SECTIONS); } init(); $(document).delegate('canvas[data-widget="steelseries.lcd"]', { 'update': function (event, response) { // DEBUG: console.log("[basic.textinput] update '" + this.id + "':", response); {{ id | replace({'.': '_'}) }}.setValue(parseFloat(response)); } }); </script> {% endmacro %} /** * Displays a steelseries linear * * @param unique id for this widget * @param the gad for the value * @param the gad for the threshold * @param min value * @param max value * @param title * @param unit */ {% macro linear(id, gad_value, gad_threshold, minValue, maxValue, title, unit) %} <canvas id="{{ id | replace({'.': '_'}) }}" data-widget="steelseries.lcd" data-item="{{ gad_value }}, {{ gad_threshold}}" width="320" height="140"></canvas> <script> var {{ id | replace({'.': '_'}) }}; function init() { {{ id | replace({'.': '_'}) }} = new steelseries.Linear('{{ id | replace({'.': '_'}) }}', { width: 320, height: 140, gaugeType: steelseries.GaugeType.TYPE2, titleString: "{{ title }}", unitString: "{{ unit }}", {% if not gad_threshold %}thresholdVisible: false,{% endif %} {% if minValue %}minValue: {{ minValue }},{% endif %} {% if maxValue %}maxValue: {{ maxValue }},{% endif %} lcdVisible: true }); } init(); $(document).delegate('canvas[data-widget="steelseries.lcd"]', { 'update': function (event, response) { // DEBUG: console.log("[basic.textinput] update '" + this.id + "':", response); {{ id | replace({'.': '_'}) }}.setValueAnimated(parseFloat(response[0])); {{ id | replace({'.': '_'}) }}.setThreshold(parseFloat(response[1])); } }); </script> {% endmacro %} /** * Displays a steelseries linear bargraph * * @param unique id for this widget * @param the gad for the value * @param the gad for the threshold * @param min value * @param max value * @param title * @param unit */ {% macro linear_bargraph(id, gad_value, gad_threshold, minValue, maxValue, title, unit) %} <canvas id="{{ id | replace({'.': '_'}) }}" data-widget="steelseries.lcd" data-item="{{ gad_value }}, {{ gad_threshold}}" width="320" height="140"></canvas> <script> var {{ id | replace({'.': '_'}) }}; function init() { {{ id | replace({'.': '_'}) }} = new steelseries.LinearBargraph('{{ id | replace({'.': '_'}) }}', { width: 320, height: 140, gaugeType: steelseries.GaugeType.TYPE2, titleString: "{{ title }}", unitString: "{{ unit }}", {% if not gad_threshold %}thresholdVisible: false,{% endif %} {% if minValue %}minValue: {{ minValue }},{% endif %} {% if maxValue %}maxValue: {{ maxValue }},{% endif %} lcdVisible: true }); } init(); $(document).delegate('canvas[data-widget="steelseries.lcd"]', { 'update': function (event, response) { // DEBUG: console.log("[basic.textinput] update '" + this.id + "':", response); {{ id | replace({'.': '_'}) }}.setValueAnimated(parseFloat(response[0])); {{ id | replace({'.': '_'}) }}.setThreshold(parseFloat(response[1])); } }); </script> {% endmacro %} /** * Displays a steelseries radial * * @param unique id for this widget * @param the gad for the value * @param the gad for the threshold * @param min value * @param max value * @param title * @param unit */ {% macro radial(id, gad_value, gad_threshold, minValue, maxValue, title, unit) %} <canvas id="{{ id | replace({'.': '_'}) }}" data-widget="steelseries.radial" data-item="{{ gad_value }}, {{ gad_threshold}}" width="201" height="201"></canvas> <script> var {{ id | replace({'.': '_'}) }}; function init() { {{ id | replace({'.': '_'}) }} = new steelseries.Radial('{{ id | replace({'.': '_'}) }}', { gaugeType: steelseries.GaugeType.TYPE4, size: 201, titleString: "{{ title }}", unitString: "{{ unit }}", {% if not gad_threshold %}thresholdVisible: false,{% endif %} {% if minValue %}minValue: {{ minValue }},{% endif %} {% if maxValue %}maxValue: {{ maxValue }},{% endif %} lcdVisible: true, lcdDecimals: 1, useOdometer: false }); } init(); $(document).delegate('canvas[data-widget="steelseries.radial"]', { 'update': function (event, response) { // DEBUG: console.log("[basic.textinput] update '" + this.id + "':", response); {{ id | replace({'.': '_'}) }}.setValue(parseFloat(response[0])); {% if gad_threshold %}{{ id | replace({'.': '_'}) }}.setThreshold(parseFloat(response[1]));{% endif %} } }); </script> {% endmacro %}
{% import "widgets/widget_steelseries.html" as steelseries %} {{ steelseries.radial('steel.office.temperature.state ','office.temperature.state','office.temperature.plan', 0, 40, 'Temperatur Büro', '°C') }}
Wir verarbeiten personenbezogene Daten über die Nutzer unserer Website mithilfe von Cookies und anderen Technologien, um unsere Dienste bereitzustellen. Weitere Informationen findest Du in unserer Datenschutzerklärung.
Indem Du unten auf "ICH stimme zu" klickst, stimmst Du unserer Datenschutzerklärung und unseren persönlichen Datenverarbeitungs- und Cookie-Praktiken zu, wie darin beschrieben. Du erkennst außerdem an, dass dieses Forum möglicherweise außerhalb Deines Landes gehostet wird und bist damit einverstanden, dass Deine Daten in dem Land, in dem dieses Forum gehostet wird, gesammelt, gespeichert und verarbeitet werden.
Kommentar