Skip to content

Commit

Permalink
Merge pull request #1635 from PolicyEngine/revert-1622-master
Browse files Browse the repository at this point in the history
Revert "correct rounding of percentages in parameter history hovercard"
  • Loading branch information
anth-volk authored Apr 23, 2024
2 parents cab9929 + 0e79368 commit 3501f6b
Showing 1 changed file with 1 addition and 15 deletions.
16 changes: 1 addition & 15 deletions src/pages/policy/input/ParameterOverTime.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,6 @@ function getReformPolicyLabel(policy) {
return reformPolicyId ? `Policy #${reformPolicyId}` : "reform";
}

const calculateFormattedPercentage = (value) => {
const formattedPercentage = (value * 100).toFixed(2);
return `${formattedPercentage}%`;
};

export default function ParameterOverTime(props) {
const { baseMap, reformMap, parameter, policy, metadata } = props;
const mobile = useMobile();
Expand Down Expand Up @@ -54,8 +49,6 @@ export default function ParameterOverTime(props) {
const yaxisValues = reformedY ? y.concat(reformedY) : y;
const xaxisFormat = getPlotlyAxisFormat("date", xaxisValues);
const yaxisFormat = getPlotlyAxisFormat(parameter.unit, yaxisValues);
const customdata = y.map(calculateFormattedPercentage);
const reformedCustomdata = reformedY.map(calculateFormattedPercentage);

return (
<>
Expand All @@ -72,8 +65,6 @@ export default function ParameterOverTime(props) {
color: style.colors.GRAY,
},
name: "Current law",
customdata: customdata,
hovertemplate: "%{x|%b, %Y}: %{customdata}<extra></extra>",
},
reformMap && {
x: reformedX,
Expand All @@ -87,16 +78,11 @@ export default function ParameterOverTime(props) {
color: style.colors.BLUE,
},
name: getReformPolicyLabel(policy),
customdata: reformedCustomdata,
hovertemplate: "%{x|%b, %Y}: %{customdata}<extra></extra>",
},
].filter((x) => x)}
layout={{
xaxis: { ...xaxisFormat },
yaxis: {
...yaxisFormat,
tickformat: ",.0%",
},
yaxis: { ...yaxisFormat },
legend: {
// Position above the plot
y: 1.2,
Expand Down

0 comments on commit 3501f6b

Please sign in to comment.