Conversation
|
There was a problem hiding this comment.
Codex Review: Here are some suggestions.
Reply with @codex fix comments to fix any unresolved comments.
About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you open a pull request for review, mark a draft as ready, or comment "@codex review". If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex fix this CI failure" or "@codex address that feedback".
| const yDecimalPlaces = useMemo(() => { | ||
| let maxDecimals = 0; | ||
| parsedData.forEach(file => { | ||
| Object.values(file.metricsData).forEach(points => { | ||
| points.forEach(p => { | ||
| const str = p.y.toString(); | ||
| const decimalPart = str.split('.')[1]; | ||
| if (decimalPart) { | ||
| const decimals = decimalPart.replace(/e.+/i, '').length; | ||
| if (decimals > maxDecimals) { | ||
| maxDecimals = decimals; | ||
| } | ||
| } | ||
| }); | ||
| }); | ||
| }); |
There was a problem hiding this comment.
[P1] Handle exponent-formatted values when deriving decimal places
The new yDecimalPlaces logic counts fractional digits by splitting p.y.toString() on a decimal point, but numbers whose string representation is in scientific notation (1e-7, 3.2E-5, etc.) never enter the if (decimalPart) branch. When such values exist in parsedData, maxDecimals remains 0 and both tooltips and tick labels format them with toFixed(0), displaying 0 for every small-magnitude point and making the chart misleading. Consider parsing the exponent and counting digits from the mantissa so that values like 1e-7 retain at least seven decimals.
Useful? React with 👍 / 👎.
Summary
Testing
npm testnpm run linthttps://chatgpt.com/codex/tasks/task_e_68b51d49ede0832da05257475d7be121