/** * ----------------------------------------------------------------------------- * @package smartVISU * @author Martin Gleiß * @copyright 2012 - 2015 * @license GPL [http://www.gnu.de] * ----------------------------------------------------------------------------- */ /** * The diagram showing curves of relative humidity and effective temperature superimposed upon rectangular coordinates. The comfort-zones indicate when humans feel good. * * @param {id=} unique id for this widget (optional) * @param {item} an item for the temperature * @param {item} an item for the humidity */ {% macro comfortchart(id, item_temp, item_humidity) %} {% endmacro %} /** * A gauge * * @param {id=} unique id for this widget (optional) * @param {item} an item for the gauge value * @param {value} min value * @param {value} max value * @param {format=} unit for the gauge * @param {text=} text for label * @param {text(solid-half,solid-cshape,solid-circle,speedometer,scale,vumeter)=solid-half} set mode 'solid-half', 'solid-cshape', 'solid-circle', 'speedometer', 'scale', 'vumeter' (optional, default: 'solid-half') * @param {value[?]=} stop(s) for the sections in percent e.g. 50. More sections in array form: [30,60] (optional) * @param {color[?]=} color(s) for the sections e.g. '#f00' for red. More sections in array form: ['#f00','#fff'] (optional) * @param {text=} actually unused (puts additional label inside speedometer ) * * @author ramann, Stefan Widmer */ {% macro gauge(id, item, min, max, unit, label, mode, stop, color, axis) %} {% endmacro %} /** * Displays a heating curve (outside temperature compared to heating flow temperature) with current datapoint * * @param {id=} unique id for this widget (optional) * @param {item(str)} an item containing the pairs of temperatures * Sorted array in format: [[outside1, heating_temp], [outside2, heating_temp] ...] * @param {item(num)} an item for the current outside temperature * @param {item(num)} an item for the current heating flow temperature * @param {text[?]=} object with additional options for Highcharts, see https://api.highcharts.com/ (optional) */ {% macro heatingcurve(id, item_datapoints, item_current_outsidetemp, item_current_flowtemp, chartoptions) %}
{% endmacro %} /** * Plots a chart of time series data * * @param {id=} unique id for this widget (optional) * @param {item[?](bool,num,list)} series of item(s); multiple items in array form: [ item1 , item2 ] * @param {text[?](avg,sum,min,max,minmax,minmaxavg,raw,on)=avg} the aggregation mode (optional, default 'avg') May be a single mode or an array with separate mode per item. Available modes depend on backend, common ones are 'avg', 'sum', 'min', 'max', 'minmax', 'minmaxavg', 'on', 'raw'. See backend's documentation for further information. * @param {duration=1h} the minimum time (x-axis): '1h', '2h'... (duration-format) Value is enterpreted as timestamp if no unit is given (e.g. 1629109298731). * @param {duration=now} the maximum time (x-axis): '', '1h', '2h'... (duration-format, default: now). Value is enterpreted as timestamp if no unit is given (e.g. 1629109298731). * @param {text[?]=} the minimum for each y-axis; multiples in array form: [ min_y-axis1, min_y-axis2, ...] (optional) If the axis type is boolean the passed value will be the label of the low state (e.g. 'Off') * @param {text[?]=} the maximum for each y-axis; multiples in array form: [ max_y-axis1, max_y-axis2, ...] (optional) If the axis type is boolean the passed value will be the label of the high state (e.g. 'On') * @param {value[?]=100} the number of datapoints in the series (optional, default 100) May be a single value or an array of separate counts per item. * @param {text[?]=} label for each series; multiples in array form (optional) * @param {color[?]=} color for each series; multiples in array form (optional, default: suitable for design) * @param {text[?](line,linestack,stair,spline,area,areastair,areaspline,areastack,column,columnstack)=line} type of each serie: 'line', 'linestack', 'stair', 'spline', 'area', 'areastair', 'areaspline', 'areastacked','column', 'columnstacked'; multiples in array form (optional, default 'line') * @param {text[?]=} title for the x-axis and y-axes in array form: [title_x-axis, title_y-axis1, title_y-axis2, ...] (optional) * @param {duration(advanced,day)=} minimal time range while zooming or 'advanced' or 'day' (optional, duration-format) By passing 'advanced' a seaparate range selector is shown and data grouping for large amount of data is enabled By passing 'day', the plot is shown from 0:00 until 24:00 on the current day (it makes sense to set tmin to '24h' and tmax to 'now'). * @param {value[]=} assignment of the series to the y-axes; multiples in array form (optional) * @param {value[]=} y-axes setup for left '0' and right '1' hand in array form (optional) * @param {color[?]=} y-axes color; multiples in array form (optional) * @param {text[?](linear,logarithmic,boolean)=linear} y-axes type, one of 'linear', 'logarithmic' or 'boolean'; multiples in array form (optional, default 'linear') * @param {format[?]=} unit(s) for the y-axis. Either a unit of the language file, an individual format string (PHP sprintf like) or a simple string as suffix. Multiples in array form. (optional) * @param {text[?]=} object with additional options for Highcharts, see https://api.highcharts.com/ (optional) * @param {text[?](normal,percent)=normal} stacking of series for each stack (array for multiple stacks in ascending order): 'normal', 'percent' (optional, default=normal). * @param {text[]=} assign stacked series to different stacks: '0', '1, '2'... or ''. Sequence must be same as item sequence (optional, default='') * @param {value=0} control for the export of plot data: 0 = none, 1 = images, 2 = images and data (e.g.csv) (optional) * @param {text(database,item)=database} source of the data. If set to 'item', data must be provided in a list item (optional, default=database) * * @see misc/fundamentals#Array-Form * @see misc/fundamentals#Duration-Format */ {% macro period(id, item, mode, tmin, tmax, ymin, ymax, count, label, color, exposure, axis, zoom, assign, opposite, ycolor, ytype, unit, chartoptions, stacking, stacks, export, source) %} {% if (not export is empty) and export > 0 %} {% if export == 2 %} {% endif %} {% endif %} {% set source = source|default('database') %} {% set tmax = (tmax|default('now')|lower=='0h' or tmax==0 or tmax is empty) ? 'now' : tmax %} {% set tmin = tmin|default('1h') %} {% set mode = (mode is iterable ? mode : [mode|default('avg')]) %} {% set count = (count is iterable ? count : [count|default(100)]) %} {% set unit = (unit is iterable ? unit : [unit|default('')]) %} {% set units = [] %} {% for uniti in unit %} {% set units = units|merge([uniti|replace({',' : ';'})]) %} /** hide comma before implode/explode to allow format strings, e.g. %01,02f% */ {% endfor %} {% set stacking = (stacking is iterable ? stacking : [stacking|default('normal')]) %} {% set stacks = (stacks is iterable ? stacks : [stacks|default('0')]) %} {% set item = (item is iterable ? item : [item]) %} {% set seriesitems = [] %} {% for itemi in item %} {% if mode|length < loop.index %} {% set mode = mode|merge([mode|last]) %} {% endif %} {% set modei = mode[loop.index0] %} {% if count|length < loop.index %} {% set count = count|merge([count|last]) %} {% endif %} {% set counti = count[loop.index0] %} {% if source == 'database' %} {% if modei == 'minmax' %} {% set seriesitems = seriesitems|merge([ implode(itemi, ['min', tmin, tmax, counti]), implode(itemi, ['max', tmin, tmax, counti]) ]) %} {% elseif modei == 'minmaxavg' %} {% set seriesitems = seriesitems|merge([ implode(itemi, ['min', tmin, tmax, counti]), implode(itemi, ['max', tmin, tmax, counti]), implode(itemi, ['avg', tmin, tmax, counti]) ]) %} {% else %} {% set seriesitems = seriesitems|merge([implode(itemi, [modei, tmin, tmax, counti])]) %} {% endif %} {% else %} {% set seriesitems = seriesitems|merge([itemi]) %} {% endif %} {% endfor %} {% endmacro %} /** * A pie diagram * * @param {id=} unique id for this widget (optional) * @param {item[?]} series of item(s). More items in array form: [ item1 , item2 ] * @param {text[]} series of label(s). More labels in array form: [ label1 , label2 ] * @param {color[]=} color for each series e. g. '#f00' for red. More color/s in array form: ['#f00','#fff'] (optional, default: sutiable for design) * @param {text=} text for headline * @param {text(label,legend,none)=legend} set dataview mode: 'label', 'legend' or 'none' (optional, default: 'legend') * * @author ramann, Stefan Widmer */ {% macro pie(id, item, label, color, text, mode) %} {% endmacro %} /** * A temperature-chart for use with an rtr. Plots actual and set temperature. If the state is given it will be shown as pie. * * @param {id=} unique id for this widget (optional) * @param {item} series of an item for the actual-temperature * @param {item} series of an item for the set-temperature * @param {item=} series of an item for the state of the actor. This is shown as percental value within the pie. (optional) * @param {value=100} number of samples (points) (optional, default 100) * @param {duration=1d} the minimum time (x-axis) (duration-format, default: '1d') * @param {duration=now} the maximum time (x-axis) (duration-format, default: 'now') * @param {text=} maximum value (or type) of the item for the state of the actor (optional, default: guessed according to values) Often used values are 1 for boolean items, 100 for percentages, 255 for 1-byte values. Additionally you may pass 'on' to use backend's 'on' function (caution: not all backend databases do support this). */ {% macro rtr(id, item_actual, item_set, item_state, count, tmin, tmax, state_max) %} {% set tmax = (tmax|default('now')|lower=='0h' or tmax==0 or tmax is empty) ? 'now' : tmax %} {% set tmin = tmin|default('1d') %} {% set count = count|default(100) %} {% set items = [ implode(item_actual, ['avg', tmin, tmax, count]), implode(item_set, ['avg', tmin, tmax, count]) ] %} {% if item_state is not empty %} {% set items = items|merge([implode([item_state], [state_max == 'on' ? 'on' : 'avg', tmin, tmax, state_max == 'on' ? 1 : count])]) %} {% endif %} {% endmacro %} /** * A complete house temperature plot. The rose shows all rooms with there actual and set temperature in one diagramm. * * @param {id=} unique id for this widget (optional) * @param {item[?]} an item for the actual temperature; multiple items in array form: [ item1 , item2 ] * @param {item[?]=} an item for the set temperature; multiple items in array form: [ item1 , item2 ] * @param {text[?]} label for each axis * @param {text[]=} label for actual and set series in array form: [ 'label_actual', 'label_set' ] (optional, default is language dependent) * @param {format=temp} either a unit of the language file, an individual format string (PHP sprintf like) or a simple string as suffix. (optional, default 'temp') * * @see misc/fundamentals#Array-Form */ {% macro temprose(id, item_actual, item_set, axis, series_label, unit) %} {% endmacro %} /** * Plots a chart of x/y data * * @param {id=} unique id for this widget (optional) * @param {item[?](list)} item(s) contaning x/y data in list form; specify multiple items as array: [ item1 , item2 ] * @param {item[?](bool, num)} unused. Planned for a later version: item(s) contaning x data of working point(s) * @param {item[?](bool, num)} unused. Planned for a later version: item(s) contaning y data of working point(s) * @param {text=} the minimum x-axis value (optional) * @param {text=} the maximum x-axis value (optional) * @param {text[?]=} the minimum for each y-axis; multiples in array form: [ min_y-axis1, min_y-axis2, ...] (optional) If the axis type is boolean the passed value will be the label of the low state (e.g. 'Off') * @param {text[?]=} the maximum for each y-axis; multiples in array form: [ max_y-axis1, max_y-axis2, ...] (optional) If the axis type is boolean the passed value will be the label of the high state (e.g. 'On') * @param {text[?]=} label for each series; multiples in array form (optional) * @param {text[?]=} unused. Planned for a later version: name(s) of the working point(s) * @param {color[?]=} color for each series; multiples in array form (optional, default: suitable for design) * @param {text[?](line,linestack,stair,spline,area,areastair,areaspline,areastack,column,columnstack)=line} type of each serie: 'line', 'linestack', 'stair', 'spline', 'area', 'areastair', 'areaspline', 'areastacked','column', 'columnstacked'; multiples in array form (optional, default 'line') * @param {text[?]=} title for the x-axis and y-axes in array form: [title_x-axis, title_y-axis1, title_y-axis2, ...] (optional) * @param {text=} minimal x-range while zooming (optional) * @param {value[]=} assignment of the series to the y-axes; multiples in array form (optional) * @param {value[]=} y-axes setup for left '0' and right '1' hand in array form (optional) * @param {color[?]=} y-axes color; multiples in array form (optional) * @param {text[?](linear,logarithmic,boolean)=linear} y-axes type, one of 'linear', 'logarithmic' or 'boolean'; multiples in array form (optional, default 'linear') * @param {format[?]=} unit(s) for the y-axis. Either a unit of the language file, an individual format string (PHP sprintf like) or a simple string as suffix. Multiples in array form. (optional) * @param {text[?]=} object with additional options for Highcharts, see https://api.highcharts.com/ (optional) * @param {text[?](normal,percent)=normal} stacking of series for each stack (array for multiple stacks in ascending order): 'normal', 'percent' (optional, default=normal). * @param {text[]=} assign stacked series to different stacks: '0', '1, '2'... or ''. Sequence must be same as item sequence (optional, default='') * @param {value=0} control for the export of plot data: 0 = none, 1 = images, 2 = images and data (e.g.csv) (optional) * * @see misc/fundamentals#Array-Form * @see misc/fundamentals#Duration-Format */ {% macro xyplot(id, item, xitem, yitem, xmin, xmax, ymin, ymax, label, xylabel, color, exposure, axis, zoom, assign, opposite, ycolor, ytype, unit, chartoptions, stacking, stacks, export) %} {% if (not export is empty) and export > 0 %} {% if export == 2 %} {% endif %} {% endif %} {% set unit = (unit is iterable ? unit : [unit|default('')]) %} {% set units = [] %} {% for uniti in unit %} {% set units = units|merge([uniti|replace({',' : ';'})]) %} /** hide comma before implode/explode to allow format strings, e.g. %01,02f% */ {% endfor %} {% set stacking = (stacking is iterable ? stacking : [stacking|default('normal')]) %} {% set stacks = (stacks is iterable ? stacks : [stacks|default('0')]) %} {% endmacro %} /****************************************************************************** * D E P R E C A T E D W I D G E T S ******************************************************************************/