Mercurial > gemma
changeset 4142:2a3bd5f3fc99
waterlevels: drawing now line according to maximum of waterlevels
author | Thomas Junk <thomas.junk@intevation.de> |
---|---|
date | Fri, 02 Aug 2019 10:45:52 +0200 |
parents | be34d02cff73 |
children | afc564e0db40 |
files | client/src/components/gauge/Waterlevel.vue |
diffstat | 1 files changed, 5 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/client/src/components/gauge/Waterlevel.vue Fri Aug 02 09:42:02 2019 +0200 +++ b/client/src/components/gauge/Waterlevel.vue Fri Aug 02 10:45:52 2019 +0200 @@ -589,10 +589,10 @@ const y = d3.scaleLinear().range([dimensions.mainHeight, 0]); const x2 = d3.scaleTime().range([0, dimensions.width]); const y2 = d3.scaleLinear().range([dimensions.navHeight, 0]); - + const [lo, hi] = extent.waterlevel; // setting the min and max values for the diagram axes x.domain(d3.extent(extent.date)); - y.domain(extent.waterlevel); + y.domain([Math.floor(lo * 0.9), Math.ceil(hi * 1.1)]); x2.domain(x.domain()); y2.domain(y.domain()); @@ -706,7 +706,7 @@ selection.attr( "transform", `translate(${scale.x(new Date())}, ${scale.y( - extent.waterlevel[1] - 16 + Math.ceil(extent.waterlevel[1] * 1.07) )})` ); }; @@ -715,8 +715,8 @@ diagram .append("path") .datum([ - { x: new Date(), y: extent.waterlevel[0] }, - { x: new Date(), y: extent.waterlevel[1] - 20 } + { x: new Date(), y: Math.floor(extent.waterlevel[0] * 0.9) }, + { x: new Date(), y: Math.ceil(extent.waterlevel[1] * 1.07) } ]) .attr("class", "now-line") .attr("d", nowLine);