Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Round axis values with integersOnly when Decimal format is 0 #170151

Open
nickofthyme opened this issue Oct 30, 2023 · 1 comment
Open

Round axis values with integersOnly when Decimal format is 0 #170151

nickofthyme opened this issue Oct 30, 2023 · 1 comment
Assignees
Labels
bug Fixes for quality problems that affect the customer experience Feature:ElasticCharts Issues related to the elastic-charts library Feature:Lens impact:medium Addressing this issue will have a medium level of impact on the quality/strength of our product. Team:Visualizations Visualization editors, elastic-charts and infrastructure

Comments

@nickofthyme
Copy link
Contributor

nickofthyme commented Oct 30, 2023

Kibana version:

latest on main

Describe the bug:

Custom axis tick formatting with a decimal of 0 can cause tick labels to be placed inaccurately.

Screen Recording 2023-10-18 at 05 21 46 PM

Notice in the recording above the value at 13:40 is 1.60, but when setting the decimals value to 0, the value becomes 2 and the axis tick label for 1.6 becomes 2, with no change in the axis scale itself. This is wrong and this elastic/elastic-charts#1417 was never truly fixed, so I reopened it. It worth noting this case only happens when formatting at a small scale such that decimal tick values are shown.

Really we need to format the value then somehow parse the formatted value to compare the value with the true value. Or maybe there is another way to take the lower/higher formatted value and remove the rest. Will continue this discussion in elastic/elastic-charts#1417.

Expected behavior:

Tick labels are always accurate to the numerical value they represent 1.6 should not be formatted to '2'.

Any additional context:

The solution here is to enable the integersOnly option on the Axis, when the decimal value is set to 0, see example with the option here. I think this would cover most use cases but this would still occur for decimals set to 1 or more just at a lower order of magnitude. Although this case is rare we could fully fixe this by telling charts the rounded decimal value which is why I opened elastic/elastic-charts#2220.

This fix only applies to the Lens custom formatter and NOT to default formatter at the data view level. This is due to the use of Numeral.js, which does not permit a way of knowing the fractional digits to round to. This is would be a rare case to have an integer-only format at the data view level additionally, if it was a problem the user could just enable a Lens custom field formatter.

Related to #170154

@nickofthyme nickofthyme added bug Fixes for quality problems that affect the customer experience Feature:ElasticCharts Issues related to the elastic-charts library Feature:Lens labels Oct 30, 2023
@botelastic botelastic bot added the needs-team Issues missing a team label label Oct 30, 2023
@nickofthyme nickofthyme self-assigned this Oct 30, 2023
@dej611 dej611 added the Team:Visualizations Visualization editors, elastic-charts and infrastructure label Oct 31, 2023
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-visualizations (Team:Visualizations)

@botelastic botelastic bot removed the needs-team Issues missing a team label label Oct 31, 2023
@nickofthyme nickofthyme removed their assignment Nov 3, 2023
@timductive timductive added the impact:medium Addressing this issue will have a medium level of impact on the quality/strength of our product. label Nov 15, 2023
@nickofthyme nickofthyme self-assigned this Dec 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Fixes for quality problems that affect the customer experience Feature:ElasticCharts Issues related to the elastic-charts library Feature:Lens impact:medium Addressing this issue will have a medium level of impact on the quality/strength of our product. Team:Visualizations Visualization editors, elastic-charts and infrastructure
Projects
None yet
Development

No branches or pull requests

5 participants