PolicyEngine / policyengine-app

PolicyEngine's free web app for computing the impact of public policy.
GNU Affero General Public License v3.0
41 stars 109 forks source link

Parameter editor chart does not properly handle infinite values #2051

Open MaxGhenis opened 2 months ago

MaxGhenis commented 2 months ago

See this:

image

https://policyengine.org/us/policy?focus=gov.irs.deductions.itemized.salt_and_real_estate.cap.JOINT&region=enhanced_us&timePeriod=2026&baseline=2&reform=56251

It's correctly specified as 10,000 from 2018 to 2025, inf otherwise: https://github.com/PolicyEngine/policyengine-us/blob/master/policyengine_us/parameters/gov/irs/deductions/itemized/salt_and_real_estate/cap.yaml

Should display a line in that range.

anth-volk commented 1 month ago

In terms of displaying, since we can't plot infinity on a chart, we could:

This would allow us to visualize without having to arbitrarily calculate some sort of stand-in that could be wrong, error-prone, or misleading.

Setting something to infinity, on the other hand, could be a bit more challenging.

anth-volk commented 1 month ago

Incredibly, react-plotly does not natively support axis breaks

MaxGhenis commented 1 month ago

How to display infinity in the years it's that value is a separate issue from what I reported here. For now I think not displaying it is fine.

anth-volk commented 1 month ago

Note that this is almost certainly driven by infinity itself not being displayed, hence impossible to draw a line to meet with a point at infinity

MaxGhenis commented 1 month ago

Yeah for now we can suggest including the last finite value in the year prior to infinity in the country package (https://github.com/PolicyEngine/policyengine-us/issues/5252), but let's keep this open as it would be cleaner to do it in the front-end