v3.12.0.1: Update chart module
Main changes are summarized below.
Default charts
For some device types (P1 smart meter, Temp/Hum/Bar devices) Dashticz will add some default settings.
If you don’t want to make use of the default settings add the following block parameter:
usedefaults: false
The legend will be added by default. To show no legend use the following block parameter:
legend: false
Dataset numbering
Example:
blocks['three_temp_devices'] = {
type: 'graph',
devices: [ 12, 13, 14],
usedefaults: false
}
In previous versions the device idx was added to each dataset label, resulting in the following three datasets:
te_12
te_13
te_14
In the current version, no suffix will be added to first the dataset label. The dataset of the second graph device will have ‘_1’ as suffix. That means the block definition above will give the following two datasets:
te
te_1
te_2
New block parameter datasets
Use the datasets block parameter to set options for each dataset:
blocks['three_temp_devices'] = {
type: 'graph',
devices: [ 12, 13, 14],
datasets: {
te: {
legend: 'Temp 1',
},
te_1: {
legend: 'Temp 2'
},
te_2: {
legend: 'Temp 3'
}
}
}
List of options which can be set for each dataset:
hideData: trueto hide the dataset completely
hidefromlegend: trueto hide the dataset from the legend only
legend: 'Temp 1'to set the name of the dataset in the legend
yAxis: 'yaxis'Name of the y-axis that will be used for this dataset
yLabel: '(m3)'to use ‘(m3)’ as label behind the data in the tooltip
bubble: 'd.te_1'Bubble graph. The result of the expression sets the radius value of the bubble.
backgroundColor: 'red'
barPercentage: 0.9
borderColor: 'yellow'
borderWidth:
borderDash
pointRadius
pointStyle
pointBackgroundColor
pointBorderColor
pointBorderWidth
lineTension
spanGaps
fill
stepped
type: 'line'
order
data: Formula to compute the data for this dataset. Same format as used within the data section of a custom graph.
Display value as categories
To display the level of a switch as two categories (‘On’ or ‘Off’) use the following block definition:
blocks['gsw'] = {
type: 'graph',
devices: [1446],
categories: {
0: 'Off',
1: 'On'
}
}
In the example above, if the value of the device>=0, it will be labeled as ‘Off’. If the value of the device>=1, it will be labed as ‘On’
The categories parameter can also be applied on dataset level.
Data parameter in datasets section
Example:
blocks['datasetsdata'] = {
devices: [43],
height:400,
showAllDatasets: false,
stacked: true,
usedefaults: false,
datasets: {
nett: {
data: 'd.v+d.v2-d.r1-d.r2',
},
usage: {
data: 'd.v+d.v2',
graph: 'bar',
} ,
generation: {
data: '-d.r1-d.r2',
graph: 'bar',
}
},
}
or, if you want to make it dependent on the selected menu button:
blocks['datasetsdata'] = {
devices: [43],
height:400,
showAllDatasets: false,
stacked: true,
usedefaults: false,
custom: {
nett: {
datasets: {
nett: {
data: 'd.v+d.v2-d.r1-d.r2',
},
}
},
usage: {
datasets: {
usage: {
data: 'd.v+d.v2'
}
}
},
generation: {
datasets: {
generation: {
data: '-d.r1-d.r2'
}
}
}
}
}