comparison client/src/components/gauge/Waterlevel.vue @ 3050:c739b81b8f41

client: gauge waterlevel diagram: fixed date extent was set to startOfDay, leading to a gap in the chart if the first result is not at 0:00.
author Markus Kottlaender <markus@intevation.de>
date Mon, 15 Apr 2019 16:58:36 +0200
parents 7e6ecb6d0796
children 5ada194e27fc
comparison
equal deleted inserted replaced
3049:7e6ecb6d0796 3050:c739b81b8f41
147 */ 147 */
148 148
149 import { mapState, mapGetters } from "vuex"; 149 import { mapState, mapGetters } from "vuex";
150 import * as d3Base from "d3"; 150 import * as d3Base from "d3";
151 import { lineChunked } from "d3-line-chunked"; 151 import { lineChunked } from "d3-line-chunked";
152 import { startOfDay, endOfDay } from "date-fns"; 152 import { endOfDay } from "date-fns";
153 import debounce from "debounce"; 153 import debounce from "debounce";
154 import jsPDF from "jspdf"; 154 import jsPDF from "jspdf";
155 import canvg from "canvg"; 155 import canvg from "canvg";
156 156
157 // we should load only d3 modules we need but for now we'll go with the lazy way 157 // we should load only d3 modules we need but for now we'll go with the lazy way
471 }, 471 },
472 getExtent(refWaterLevels) { 472 getExtent(refWaterLevels) {
473 return { 473 return {
474 // set min/max values for the date axis 474 // set min/max values for the date axis
475 date: [ 475 date: [
476 startOfDay(this.dateFrom), 476 this.waterlevels[0].date,
477 endOfDay(this.waterlevels[this.waterlevels.length - 1].date) 477 endOfDay(this.waterlevels[this.waterlevels.length - 1].date)
478 ], 478 ],
479 // set min/max values for the waterlevel axis 479 // set min/max values for the waterlevel axis
480 // including HDC (+ 1/8 HDC-LDC) and LDC (- 1/4 HDC-LDC) 480 // including HDC (+ 1/8 HDC-LDC) and LDC (- 1/4 HDC-LDC)
481 waterlevel: d3.extent( 481 waterlevel: d3.extent(