From eaaee3c14a6388d2c1cdd057c8ed812731cd0753 Mon Sep 17 00:00:00 2001 From: Patrick Gebhardt Date: Thu, 25 Jun 2020 21:41:28 +0200 Subject: [PATCH] Add fixed graph scales --- frontend/src/app/components/graph/graph.component.ts | 11 +++++++++++ .../region-details/region-details.component.html | 10 ++++++---- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/frontend/src/app/components/graph/graph.component.ts b/frontend/src/app/components/graph/graph.component.ts index f2eb6c0..d2e8cf2 100644 --- a/frontend/src/app/components/graph/graph.component.ts +++ b/frontend/src/app/components/graph/graph.component.ts @@ -20,6 +20,8 @@ export class GraphComponent implements AfterViewInit { formatSting: string; @Input() graphType = 'line'; + @Input() + minMax: number[]; readonly randomId = uuidv4(); @@ -60,6 +62,14 @@ export class GraphComponent implements AfterViewInit { data[i].color = this.colors[i]; } + let axisY: CanvasJS.ChartOptions.ChartAxisY; + if (this.minMax) { + axisY = { + minimum: this.minMax[0], + maximum: this.minMax[1] + }; + } + const chart = new CanvasJS.Chart(this.randomId, { animationEnabled: true, @@ -70,6 +80,7 @@ export class GraphComponent implements AfterViewInit { horizontalAlign: 'left', dockInsidePlotArea: true }, + axisY, data }); diff --git a/frontend/src/app/containers/region-details/region-details.component.html b/frontend/src/app/containers/region-details/region-details.component.html index f31e3d7..039a475 100644 --- a/frontend/src/app/containers/region-details/region-details.component.html +++ b/frontend/src/app/containers/region-details/region-details.component.html @@ -36,25 +36,27 @@ + [minMax]="[-25, 50]" formatSting="##,##°C"> - + - + - +