Skip to content

[Maps] Use field formatter to format value in legend - #48132

Merged
nreese merged 4 commits into
elastic:masterfrom
nreese:field_formatter_legend
Oct 15, 2019
Merged

nreese merged 4 commits into
elastic:masterfrom
nreese:field_formatter_legend

Conversation

@nreese

@nreese nreese commented Oct 14, 2019

Copy link
Copy Markdown
Contributor

This PR uses field formatters to format the value displayed in legend. This PR addresses a comment made in PR #47903 (comment) about formatting the time string in the legend.

To test the PR, configure the formatter for the web logs sample data set bytes field to display the value as bytes. Then view the legend for the sample data set and verify the label is formatted

Screen Shot 2019-10-14 at 10 41 16 AM

Screen Shot 2019-10-14 at 10 40 51 AM

@nreese nreese added release_note:enhancement Team:Geo Former Team Label for Geo Team. Now use Team:Presentation v8.0.0 v7.5.0 labels Oct 14, 2019
@nreese
nreese requested a review from thomasneirynck October 14, 2019 16:46
@elasticmachine

Copy link
Copy Markdown
Contributor

Pinging @elastic/kibana-gis (Team:Geo)

@elasticmachine

Copy link
Copy Markdown
Contributor

💚 Build Succeeded

@thomasneirynck thomasneirynck left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this kind of polish is great.

image

As discussed in person, not to be addressed in this PR, but to track this more explicitly. Field formatters are retrieved now for tooltips and legend formatting, and each need to handle aggregation fields, join fields, and source-fields separately. It would make sense to isolate this into a separate concept (e.g. Field). This may also help organize future work on better defaults for symbology based on field-level characteristics (domain/distribution of the data, classification, ...).

The rest are nits, but I really don't think we should mix/match notations and start using lambda notations for methods. These functions belong on the prototype. Apart from the inconsistency with how 95% of the class-methods in Maps are written now, lambdas-as-methods are needlessly crufty recreating that function with each new call. It's also confusing the type inference in my IDE, making navigating to through the code inconsistent :(

image

Consistent formatting of our class will also help with a future migration to typescript, since class-syntax in TS is equivalent. TS-sugar for access modifiers can be added in-place when using the vanilla method-notation.

Comment thread x-pack/legacy/plugins/maps/public/layers/sources/es_source.js Outdated
Comment thread x-pack/legacy/plugins/maps/public/layers/vector_layer.js Outdated
@nreese
nreese requested a review from thomasneirynck October 15, 2019 15:24
@elasticmachine

Copy link
Copy Markdown
Contributor

💚 Build Succeeded

@thomasneirynck thomasneirynck left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@nreese
nreese merged commit 2c89392 into elastic:master Oct 15, 2019
nreese added a commit to nreese/kibana that referenced this pull request Oct 15, 2019
* [Maps] Use field formatter to format value in legend

* remove console statement

* simplify logic

* review feed back
nreese added a commit that referenced this pull request Oct 15, 2019
* [Maps] Use field formatter to format value in legend

* remove console statement

* simplify logic

* review feed back
patrykkopycinski pushed a commit to patrykkopycinski/kibana that referenced this pull request May 6, 2026
* [Maps] Use field formatter to format value in legend

* remove console statement

* simplify logic

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

Labels

release_note:enhancement Team:Geo Former Team Label for Geo Team. Now use Team:Presentation v7.5.0 v8.0.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants