# HG changeset patch # User Thomas Junk # Date 1562923209 -7200 # Node ID cd8ba6599a9960ca46fa781d8dc0d661993a1e4c # Parent 7b3935a8d9eeb37dfff3d59eb4945d830e7f9036 fairway_profile: remove dependency on local state variable diff -r 7b3935a8d9ee -r cd8ba6599a99 client/src/components/fairway/Fairwayprofile.vue --- a/client/src/components/fairway/Fairwayprofile.vue Fri Jul 12 11:02:46 2019 +0200 +++ b/client/src/components/fairway/Fairwayprofile.vue Fri Jul 12 11:20:09 2019 +0200 @@ -168,12 +168,6 @@ resizeListenerFunction: null, width: null, height: null, - margin: { - top: 20, - right: 80, - bottom: 60, - left: 80 - }, form: { template: null }, @@ -419,11 +413,12 @@ const height = dimensions.mainHeight; const currentData = this.currentData; const additionalData = this.additionalData; - const { xScale, yScaleRight, graph } = this.generateScalesAndGraph( + const { xScale, yScaleRight, graph } = this.generateScalesAndGraph({ svg, height, - width - ); + width, + dimensions + }); this.drawWaterlevel({ graph, xScale, yScaleRight, height }); this.drawLabels({ graph, dimensions }); if (currentData) { @@ -530,7 +525,7 @@ ]) .text("Width [m]"); }, - generateScalesAndGraph(svg, height, width) { + generateScalesAndGraph({ svg, height, width, dimensions }) { let xScale = d3 .scaleLinear() .domain([0, this.totalLength]) @@ -565,7 +560,11 @@ .append("g") .attr( "transform", - "translate(" + this.margin.left + "," + this.margin.top + ")" + "translate(" + + dimensions.mainMargin.left + + "," + + dimensions.mainMargin.top + + ")" ); graph .append("g")