From 4c1c5559bbd839536b04c84e15b1bed04203e83c Mon Sep 17 00:00:00 2001 From: Frank Sauerburger <frank@sauerburger.com> Date: Thu, 31 Dec 2020 17:08:11 +0100 Subject: [PATCH] Fix stat band issue --- uhepp-js/src/components/Graph.jsx | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/uhepp-js/src/components/Graph.jsx b/uhepp-js/src/components/Graph.jsx index 386fd4f..3ff7bf3 100644 --- a/uhepp-js/src/components/Graph.jsx +++ b/uhepp-js/src/components/Graph.jsx @@ -363,15 +363,15 @@ const Histogram = ({ } }) - if (stack.type == "stepfilled") { - for (let bin_i=1; bin_i < n_bins; bin_i++) { + if (stack.type == "stepfilled" || stack.type == "step") { + for (let bin_i=0; bin_i < n_bins; bin_i++) { const whole_stack = stack.content.map(si => si["yield"]).flat() - const stat = sumStat(uhepp.yields, whole_stack, bin_i) + const stat = sumStat(uhepp.yields, whole_stack, bin_i + 1) objects.push(<rect key={`rect-${stack_index}-uncert-${bin_i}`} - x={xScale(edges[bin_i - 1])} - width={xScale(edges[bin_i]) - xScale(edges[bin_i - 1])} - y={yScale(bottom + stat)} + x={xScale(edges[bin_i])} + width={xScale(edges[bin_i + 1]) - xScale(edges[bin_i])} + y={yScale(bottom[bin_i] + stat)} fill="url(#errorBand)" height={yScale(bottom[bin_i] - stat) - yScale(bottom[bin_i] + stat)} onMouseOver={() => onMouseOverBin(bin_i)} -- GitLab