add xtics

This commit is contained in:
Simon Vieille 2021-01-17 18:58:55 +01:00
parent 8d8d2afe93
commit f31b916230
Signed by: deblan
GPG Key ID: 03383D15A1D31745
3 changed files with 14 additions and 5 deletions

3
.gitmodules vendored
View File

@ -1,3 +0,0 @@
[submodule "lib/eplot"]
path = lib/eplot
url = https://github.com/chriswolfvision/eplot

View File

@ -50,13 +50,17 @@ class ChartHygrometryCommand extends ContainerAwareCommand
$table->setHeaders(['ID', 'Date', 'Value']); $table->setHeaders(['ID', 'Date', 'Value']);
$max = (int) $this->params->get('hygrometry_trigger_max'); $max = (int) $this->params->get('hygrometry_trigger_max');
$stats = ['Value,Max']; $stats = ['Value,Max'];
$xtics = [];
foreach ($entities as $i => $entity) { foreach ($entities as $i => $entity) {
$stats1[] = $entity->getvalue(); $stats1[] = $entity->getvalue();
$stats2[] = $max; $stats2[] = $max;
if ($i % 5 === 0) {
$xtics[] = sprintf('"%s" %d', $entity->getDate()->format('H:i'), $i);
}
$table->addRow([ $table->addRow([
$i, $i,
$entity->getDate()->format('d/m/Y H:i'), $entity->getDate()->format('d/m/Y H:i'),
@ -73,6 +77,8 @@ class ChartHygrometryCommand extends ContainerAwareCommand
$process = new Process([ $process = new Process([
'./lib/eplot/eplot', './lib/eplot/eplot',
'-d', '-d',
'--xtics',
sprintf('(%s)', implode(', ', $xtics)),
'-t', '-t',
'Max@Hygrometry', 'Max@Hygrometry',
'-m', '-m',

View File

@ -51,14 +51,18 @@ class ChartTemperatureCommand extends ContainerAwareCommand
$perfect = (int) $this->params->get('temperature_trigger_max'); $perfect = (int) $this->params->get('temperature_trigger_max');
$min = (int) $this->params->get('temperature_trigger_min'); $min = (int) $this->params->get('temperature_trigger_min');
$stats = ['Value,Perfect,Min']; $stats = ['Value,Perfect,Min'];
$xtics = [];
foreach ($entities as $i => $entity) { foreach ($entities as $i => $entity) {
$stats1[] = $entity->getvalue(); $stats1[] = $entity->getvalue();
$stats2[] = (float) 27; $stats2[] = (float) 27;
$stats3[] = (float) $min; $stats3[] = (float) $min;
if ($i % 5 === 0) {
$xtics[] = sprintf('"%s" %d', $entity->getDate()->format('H:i'), $i);
}
$table->addRow([ $table->addRow([
$i, $i,
$entity->getDate()->format('d/m/Y H:i'), $entity->getDate()->format('d/m/Y H:i'),
@ -77,6 +81,8 @@ class ChartTemperatureCommand extends ContainerAwareCommand
$process = new Process([ $process = new Process([
'./lib/eplot/eplot', './lib/eplot/eplot',
'-d', '-d',
'--xtics',
sprintf('(%s)', implode(', ', $xtics)),
'-r', '-r',
'[0:45][10:35]', '[0:45][10:35]',
'-t', '-t',