Skip to content

Conversation

@eirikaho
Copy link

added 'stopNeedleAtMax' prop to flag that the needle should stop just above max for percentages above 1.0.

stopNeedleAtMax={true}
image

stopNeedleAtMax={false}
image

@Martin36
Copy link
Owner

There are some merge conflicts. Could you merge your local branch with the latest master and fix them?

eah added 3 commits April 15, 2020 08:37
…p-needle-at-max-for-percentage-above-100

# Conflicts:
#	package-lock.json
#	src/lib/GaugeChart/index.js
@eirikaho
Copy link
Author

There are some merge conflicts. Could you merge your local branch with the latest master and fix them?

done ✔️

@Martin36
Copy link
Owner

@eirikaho It looks great. I was just thinking, maybe the stop at 100% prop should be set default to true? For me it seems like the most logical behavior for the chart. Or it could even be something that is not a optional thing. What do you think?

@eirikaho
Copy link
Author

@Martin36 I agree, it could definitely be the default behaviour and not even an optional prop. Should I update the PR with that change?

@Martin36
Copy link
Owner

Martin36 commented Nov 5, 2020

@eirikaho Sorry for the late reply, but you can do that

@rebase
Copy link

rebase commented Apr 4, 2023

I solved this problem in the following way.

const newPercent = Math.min(percent, 1);

<GaugeChart
  percent={newPercent}
  formatTextValue={value => (percent > 1 ? `${(percent * 100).toFixed(0)}%` : `${value}%`)}
/>;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants