changeset 909:d612bc4dc3e9

profile redrawn
author Thomas Junk <thomas.junk@intevation.de>
date Tue, 02 Oct 2018 17:40:22 +0200
parents 21ab63347a6c
children 53fcb4414045
files client/src/application/Main.vue client/src/fairway/Fairwayprofile.vue
diffstat 2 files changed, 5 insertions(+), 20 deletions(-) [+]
line wrap: on
line diff
--- a/client/src/application/Main.vue	Tue Oct 02 17:08:40 2018 +0200
+++ b/client/src/application/Main.vue	Tue Oct 02 17:40:22 2018 +0200
@@ -57,11 +57,7 @@
       return [this.yScaleLeft.lo, hi];
     },
     yAxisRight() {
-      const hi =
-        Math.max(this.maxAlt, this.selectedWaterLevel) -
-        this.selectedWaterLevel;
-      const lo = this.selectedWaterLevel - this.minAlt;
-      return [-lo, hi];
+      return [-this.maxAlt, 0];
     },
     margins() {
       return this.margin;
--- a/client/src/fairway/Fairwayprofile.vue	Tue Oct 02 17:08:40 2018 +0200
+++ b/client/src/fairway/Fairwayprofile.vue	Tue Oct 02 17:40:22 2018 +0200
@@ -110,7 +110,7 @@
       this.drawProfile({
         graph,
         xScale,
-        yScaleLeft,
+        yScaleRight,
         currentData,
         height,
         width
@@ -157,15 +157,6 @@
     drawLabels({ graph, height }) {
       graph
         .append("text")
-        .attr("transform", "rotate(-90)")
-        .attr("y", 0 - this.margin.left)
-        .attr("x", -(this.height - this.margin.top - this.margin.bottom) / 2)
-        .attr("dy", "1em")
-        .attr("fill", "black")
-        .style("text-anchor", "middle")
-        .text("Height above Adria [m]");
-      graph
-        .append("text")
         .attr("transform", ["rotate(-90)"])
         .attr("y", this.width - 60)
         .attr("x", -(this.height - this.margin.top - this.margin.bottom) / 2)
@@ -204,7 +195,6 @@
         .rangeRound([height, 0]);
 
       let xAxis = d3.axisBottom(xScale);
-      let yAxis = d3.axisLeft(yScaleLeft);
       let yAxis2 = d3.axisRight(yScaleRight);
       let graph = svg
         .append("g")
@@ -216,7 +206,6 @@
         .append("g")
         .attr("transform", "translate(0," + height + ")")
         .call(xAxis.ticks(5));
-      graph.append("g").call(yAxis);
       graph
         .append("g")
         .attr("transform", "translate(" + width + ",0)")
@@ -240,7 +229,7 @@
         .attr("stroke", this.waterColor)
         .attr("d", waterArea);
     },
-    drawProfile({ graph, xScale, yScaleLeft, currentData, height }) {
+    drawProfile({ graph, xScale, yScaleRight, currentData, height }) {
       for (let part of currentData) {
         let profileLine = d3
           .line()
@@ -248,7 +237,7 @@
             return xScale(d.x);
           })
           .y(d => {
-            return yScaleLeft(d.y);
+            return yScaleRight(-d.y);
           });
         let profileArea = d3
           .area()
@@ -257,7 +246,7 @@
           })
           .y0(height)
           .y1(function(d) {
-            return yScaleLeft(d.y);
+            return yScaleRight(-d.y);
           });
         graph
           .append("path")