Kibana: Custom labels for date histogram x-axis

Created on 11 Oct 2017  路  7Comments  路  Source: elastic/kibana

Currently in Kibana the ranges for which the timestamp label is customised to fit the data are very few.
We display

  • hh:mm if the interval is smaller than 60m
  • YYYY-MM-DD hh:mm if the interval is between 1h and 1 day
  • YYYY-MM-DD if the interval is between 1 day and 1 year
  • YYYY if the interval is 1y or larger
    It would be good to have a YYYY-MM for interval ranges between 1m and 1y or to allow the user to decide what formatting to use by taking in consideration the Format set on the date field (this way they can display a custom one)

cc @jakommo

Visualizations KibanaApp enhancement

Most helpful comment

@marius-dr but that's a global setting, correct?
I would imagine that one want's to set this only on a specific visualization, while keeping the other viz on the default date layout

All 7 comments

Thanks @marius-dr . I think having YYYY-MM as default for 1m to 1y would be helpful, but giving users the option to customize the format would be even better. I.e. someone might just want to see the Month as number and someone prefers the name of the month etc.

I think could imagine this to be an option in the Date Histogram aggregation with 3 options:

  • Full format -> which would always output the full format
  • Optimized (default) -> Which would determine what makes sense, (e.g. YYYY-MM) - and extend this for a bit more formats
  • Custom -> Which would allow the user to specify a momentjs (if that's used in that place) date format, which will be used to format the labels

I was looking in the advanced settings and I found this:
dateFormat:scaled

Values that define the format used in situations where timebased data is rendered in order, and formatted timestamps should adapt to the interval between measurements. Keys are ISO8601 intervals.

[
  ["", "HH:mm:ss.SSS"],
  ["PT1S", "HH:mm:ss"],
  ["PT1M", "HH:mm"],
  ["PT1H", "YYYY-MM-DD HH:mm"],
  ["P1DT", "YYYY-MM-DD"],
  ["P1YT", "YYYY"]
]

This looks like the place to set exactly what we were talking about in this issue. @timroes

@marius-dr but that's a global setting, correct?
I would imagine that one want's to set this only on a specific visualization, while keeping the other viz on the default date layout

You are right @jakommo, this just means that we have a nice starting point for this, with it already being exposed.

I want to set the date format to MMM-DD in a data table having aggregation type date histogram. Can someone help me how to do this, if this can be done.

Was this page helpful?
0 / 5 - 0 ratings