-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
[Lens] Improve tick formatting #97100
Comments
Pinging @elastic/kibana-app (Team:KibanaApp) |
Before adding/changing the way field formatter works or include that part inside the chart itself I would prioritize this #8583 work, to avoid having a again another way to describe the formatting for numbers and currencies |
@flash1293 this issue is overlapping with #57384, but I think this one is more about a specific plan. @markov00 We've already done 3/4 of the changes I proposed in that issue. The main thing we haven't done is define a future-facing API that can solve problems like this one. For tick formatting specifically, I like what you're proposing @flash1293 of adding some kind of metadata about what the values represent, like binary/decimal/time units. Here's the plan I would propose that we own:
The nice thing about this plan is that it also gives us a migration path away from pattern strings. |
This issue is still present in lastest Notice in the recording above the value at 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. Aside from the axis issue above - This issue will remain present in the value formatting across other parts of the chart such as the formatted tooltip/legend value and the actual rendered value. If you take the example above say the axes is fixed and with decimals set to I'm actually not sure how we fix this other than having an So even if we fix this in the axis it is another topic of discussion of how we treat this in other parts of the chart. Not sure if we open a separate issue for that discussion. |
Right now the chart decides where to place tick labels on an axis, then the formatter of the current dimension is applied to the value. This has some edge cases leading to misleading charts
Using the default format, it's showing correctly:
I think the issue here is the following: The chart wants to place a tick at
3.5
- based on the formatter, this gets shown as4
, but at the position of 3.5 (which is highly confusing), It would place another tick at4
, which would be formatted correctly, but as elastic-charts is filtering out duplicate ticks, it's omitting this tick, resulting in the situation that got reported by the customer.For a workaround, the user can make sure the formatting supports digits after the decimal point. It should work fine by default), maybe they changed the space wide advanced setting
format:number:defaultPattern
? They can also change it within LensAlso, see #92152
There are some ways we could tackle this ( via @markov00 ):
It gets even worse because Lens doesn't own formatting either in most cases (it's globally configured in advanced settings and in the index pattern).
Because of this I think it would make sense to explore option 2 here and pass some information about the formatting to the chart so it can influence tick placement.
One possible API would be to extend the field formatter API with something like this:
Some (but not all) formatters are able to provide this information - Lens could pass it on to the chart which uses it to place ticks accordingly.
What do you think @markov00
The text was updated successfully, but these errors were encountered: