comparison client/src/components/gauge/Waterlevel.vue @ 4140:4d7569cca5e6 improvepdf

client: fix rendering of nash-sutcliffe lines on pdf
author Fadi Abbud <fadi.abbud@intevation.de>
date Thu, 01 Aug 2019 12:48:33 +0200
parents 0becdd2812c9
children 552ea22ed266
comparison
equal deleted inserted replaced
4139:0becdd2812c9 4140:4d7569cca5e6
836 .selectAll("path.nash-sutcliffe") 836 .selectAll("path.nash-sutcliffe")
837 .attr( 837 .attr(
838 "stroke-opacity", 838 "stroke-opacity",
839 scale.x.domain()[1] - scale.x.domain()[0] > 90 * 86400000 ? 0 : 1 839 scale.x.domain()[1] - scale.x.domain()[0] > 90 * 86400000 ? 0 : 1
840 ); 840 );
841
842 return d3 841 return d3
843 .area() 842 .area()
844 .x(d => scale.x(d)) 843 .x(d => scale.x(d))
845 .y0(() => dimensions.mainHeight + 0.5) 844 .y0(() => dimensions.mainHeight + 0.5)
846 .y1(() => dimensions.mainHeight - 15 * (hours / 24)); 845 .y1(
846 () =>
847 dimensions.mainHeight -
848 Math.floor(0.06 * dimensions.mainHeight) * (hours / 24)
849 );
847 }; 850 };
848 851
849 const nashSutcliffeLabel = (label, date, hours) => { 852 const nashSutcliffeLabel = (label, date, hours) => {
850 let days = hours / 24; 853 let days = hours / 24;
851 label 854 label
852 .attr("x", Math.min(scale.x(date), dimensions.width) - 4) 855 .attr("x", Math.min(scale.x(date), dimensions.width) - 4)
853 .attr("y", dimensions.mainHeight - (15 * days + 0.5) + 12); 856 .attr(
857 "y",
858 dimensions.mainHeight -
859 (Math.floor(0.06 * dimensions.mainHeight) * days + 0.5) +
860 12
861 );
854 }; 862 };
855 863
856 if (coeff.samples) { 864 if (coeff.samples) {
857 diagram 865 diagram
858 .append("path") 866 .append("path")