Skip to content

Commit

Permalink
Merge pull request #450 from andig/steps-after
Browse files Browse the repository at this point in the history
Add chart style "states"
  • Loading branch information
andig committed Jul 29, 2016
2 parents e0c1725 + 27ab1e5 commit f669124
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 8 deletions.
13 changes: 10 additions & 3 deletions htdocs/frontend/javascripts/wui.js
Expand Up @@ -502,6 +502,13 @@ vz.wui.updateLegend = function() {
y = p[1];
else
y = null;
} else if (series.lines.states) {
y = null;
if (j < series.data.length) {
var p2 = series.data[j];
if (p2)
y = p2[1];
}
} else { // no steps -> interpolate
var p1 = series.data[j - 1], p2 = series.data[j];
if (p1 == null || p2 == null) // jshint ignore:line
Expand Down Expand Up @@ -837,13 +844,13 @@ vz.wui.drawPlot = function () {
title: entity.title,
unit : entity.definition.unit,
lines: {
show: style == 'lines' || style == 'steps',
steps: style == 'steps' || style == 'steps',
show: style == 'lines' || style == 'steps' || style == 'states',
steps: style == 'steps' || style == 'states',
fill: fillstyle !== undefined ? fillstyle : false,
lineWidth: linewidth
},
points: {
show: style == 'points' || style == 'points'
show: style == 'points'
},
yaxis: entity.assignedYaxis
};
Expand Down
5 changes: 4 additions & 1 deletion lib/Definition/EntityDefinition.json
Expand Up @@ -64,6 +64,7 @@
"unit" : "W",
"scale" : 1000,
"interpreter" : "Volkszaehler\\Interpreter\\ImpulseInterpreter",
"style" : "steps",
"model" : "Volkszaehler\\Model\\Channel",
"hasConsumption" : true,
"translation" : {
Expand All @@ -78,7 +79,6 @@
"unit" : "W",
"scale" : 1000,
"interpreter" : "Volkszaehler\\Interpreter\\SensorInterpreter",
"style" : "steps",
"model" : "Volkszaehler\\Model\\Channel",
"hasConsumption" : true,
"translation" : {
Expand Down Expand Up @@ -135,6 +135,7 @@
"icon" : "flame.png",
"unit" : "m³/h",
"interpreter" : "Volkszaehler\\Interpreter\\ImpulseInterpreter",
"style" : "steps",
"model" : "Volkszaehler\\Model\\Channel",
"hasConsumption" : true,
"translation" : {
Expand All @@ -150,6 +151,7 @@
"icon" : "flame.png",
"unit" : "m³/h",
"interpreter" : "Volkszaehler\\Interpreter\\AccumulatorInterpreter",
"style" : "steps",
"model" : "Volkszaehler\\Model\\Channel",
"hasConsumption" : true,
"translation" : {
Expand Down Expand Up @@ -268,6 +270,7 @@
"unit" : "",
"scale" : 1000,
"interpreter" : "Volkszaehler\\Interpreter\\SensorInterpreter",
"style" : "states",
"model" : "Volkszaehler\\Model\\Channel",
"hasConsumption" : true,
"translation" : {
Expand Down
1 change: 1 addition & 0 deletions lib/Definition/PropertyDefinition.json
Expand Up @@ -383,6 +383,7 @@
"options" : [
"lines",
"steps",
"states",
"points"
],
"translation" : {
Expand Down
13 changes: 9 additions & 4 deletions misc/tools/model_helper.php
Expand Up @@ -76,14 +76,19 @@ protected function execute(InputInterface $input, OutputInterface $output) {
echo("\n== " . $group . " ==\n");

foreach($entities as $entity) {
echo(str_pad($entity->getName() . ":", 16));
$name = $entity->getName();
echo(str_pad($name . ":", 20));

$value = (isset($entity->$property)) ? $entity->$property : '';

if (in_array($property, $entity->required))
echo("required\n");
$required = "required";
elseif (in_array($property, $entity->optional))
echo("optional\n");
$required = "optional";
else
echo("not allowed\n");
$required = "not allowed";

printf("%s\t%s\n", $required, $value);
}

echo("\n");
Expand Down

0 comments on commit f669124

Please sign in to comment.