-
Notifications
You must be signed in to change notification settings - Fork 8.6k
[Lens] Improve tick formatting #97100
Copy link
Copy link
Closed
Labels
Feature:LensTeam:VisualizationsTeam label for Lens, elastic-charts, Graph, legacy editors (TSVB, Visualize, Timelion) t//Team label for Lens, elastic-charts, Graph, legacy editors (TSVB, Visualize, Timelion) t//enhancementNew value added to drive a business resultNew value added to drive a business resultimpact:needs-assessmentProduct and/or Engineering needs to evaluate the impact of the change.Product and/or Engineering needs to evaluate the impact of the change.
Metadata
Metadata
Assignees
Labels
Feature:LensTeam:VisualizationsTeam label for Lens, elastic-charts, Graph, legacy editors (TSVB, Visualize, Timelion) t//Team label for Lens, elastic-charts, Graph, legacy editors (TSVB, Visualize, Timelion) t//enhancementNew value added to drive a business resultNew value added to drive a business resultimpact:needs-assessmentProduct and/or Engineering needs to evaluate the impact of the change.Product and/or Engineering needs to evaluate the impact of the change.
Type
Fields
Give feedbackNo fields configured for issues without a type.
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