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

Field formatting #2731

Merged
merged 129 commits into from
May 4, 2015
Merged

Field formatting #2731

merged 129 commits into from
May 4, 2015

Conversation

spalger
Copy link
Contributor

@spalger spalger commented Jan 22, 2015

Fixes #2882

Prereq PRs:

This PR adds an initial implementation of field formatters. The default formats are defined in the "stringify" module, and registered with the registry/field_formats registry. The formats registered with the registry declare their type compatibility, which makes them an option when choosing the format for a particular field.

Every field type has a default field format, which is defined in the defaultFieldFormats config variable. This variable defines the default format for field types, but also a default for the default.

image

Modifying the format for a field is done within the index pattern settings. In the field table, a new format column shows the name of the format in use for that field. Clicking the cell reveals a select box, which when changed will update the format specified for that field. Choosing the - default - setting will cause that field to once again inherit the default format for that field type.

image
image

The non-default format names for each field are stored in the fieldFormatMap property on the indexPattern object, helping format names persist across field-list refreshes.

This was referenced Jan 22, 2015
@spalger spalger modified the milestones: 4.0.0-RC1, 4.1.0 Jan 28, 2015
@rashidkpc rashidkpc removed the review label Jan 29, 2015
@rashidkpc rashidkpc modified the milestone: 4.1.0 Feb 13, 2015
@rashidkpc rashidkpc modified the milestone: 4.1.0 Mar 2, 2015
@spalger spalger self-assigned this Apr 7, 2015
@w33ble
Copy link
Contributor

w33ble commented May 1, 2015

LGTM now that that's fixed!

@rashidkpc rashidkpc assigned tbragin and unassigned panda01 May 1, 2015
@simianhacker
Copy link
Member

I have data where my schema is basically { name: 'nameOfMetric', value: 129929 } and I wanted to have format value multiple ways (bytes, currency, number, etc). My work around was to use scripted fields where I would just create valueAsBytes, valueAsMoney, etc... Upon trying this out I found a bug:

image

image

@simianhacker
Copy link
Member

I thought there was suppose to be a way to add my own Numeral.js formatting pattern with the "Number" formatter? Did you remove that?

image

@lukasolson
Copy link
Member

Looks to me like scripted fields are now showing up in the regular field list, and when I click on the trash icon to delete them, it doesn't actually work.

screen shot 2015-05-01 at 5 05 40 pm

@spalger
Copy link
Contributor Author

spalger commented May 4, 2015

@lukasolson @simianhacker those issues are fixed.

@tbragin
Copy link
Contributor

tbragin commented May 4, 2015

Long numbers on the Y-axis seem to run off screen. I also still don't understand why we don't update the dates on the X-axis when the timestamp field has been formatted (mine is formatted as "MMMM Do YYYY"
screen shot 2015-05-04 at 9 26 07 am

What is the point of this formatting option? I'm not clear on what it does.
screen shot 2015-05-04 at 9 45 02 am

I'm not sure this is the most useful way to visualize a number formatted as a URL in a metric vis and legends, e.g. pie vis? I don't necessarily have a better suggestion other than either not formatting it as a URL in those instances or showing only the original value only (in this case the HTTP status code) and making it clickable? But that could be ugly.
screen shot 2015-05-04 at 10 03 05 am
screen shot 2015-05-04 at 10 10 20 am

@spalger
Copy link
Contributor Author

spalger commented May 4, 2015

@tbragin:

  1. check out Flexible y-axis styling #2693 for the y-axis issue
  2. this is what renders the "field: value" cloud in discover. Today it doesn't have any parameters but tomorrow it very well may.
  3. Opened Url field formats need an alt template #3747 to solve this outside of this pull.

@simianhacker
Copy link
Member

I'm not finding any issues with this so I'm going to give it my ceremonial LGETM. Congrats! 💃 💃 💃

@spalger spalger mentioned this pull request May 4, 2015
@spalger
Copy link
Contributor Author

spalger commented May 4, 2015

🍭 yummy

spalger added a commit that referenced this pull request May 4, 2015
@spalger spalger merged commit 5924d84 into elastic:master May 4, 2015
@panda01
Copy link
Contributor

panda01 commented May 4, 2015

I find myself hard pressed to find more issues with this. Great job man. LGTM.

@fcroiseaux
Copy link

Can we change the language used for formatting numbers ? I didn't find how.

2015-05-05 0:09 GMT+02:00 Khalah Jones Golden notifications@github.com:

I find myself hard pressed to find more issues with this. Great job man.
LGTM.


Reply to this email directly or view it on GitHub
#2731 (comment).

@dagguh
Copy link

dagguh commented May 8, 2015

Percentile values are formatted as percents:
screen shot 2015-05-08 at 15 20 46
They should be formatted as numbers.
Tested on 637a3ee

PS. The Y-Axis is clipped.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Big metrics hard to read
9 participants