Bar chart date histogram - set x axis to yyyy-MM


(Ofer Kesten) #1

Hi,

i have a document with date field of format: yyyy-MM-DD HH:mm:SS.
i want to present the data in Bar chart, with date histogram in x axis, but i want to bucket my docs per month of year: yyyy-MM.
i tried to condifure my mapping with the "year_month" directive in a date field, but still get the following output:

How should i define my date format so that i will have x axis to have values such:
2016-01 .. 2016-02 .. 2016-03 .. and so on.

Thanks,
Ofer


(Joe Fleming) #2

The date markers on the axis are automatically generated, based on the size of the axis (to determine how many ticks to show) and the range of dates (to determine the values at those ticks). This is all pre-defined, and can't currently be modified. So regardless of the data you are using, or the formatting of that data, you can't currently remove the days, or control how many markers are shown.

To control the date format on the labels, there's an open issue about controlling field formatting per visualizations instead of only per field, which covers part of this. However, it may not be quite the same since the axis dates don't observe the field formatters currently.

As for controlling where the markers show up, and how many show up, I don't currently see any issue about that. I could encourage you to open an issue here.

It does seem like Kibana should be smarter by default based on the date interval it's using, especially when you don't use auto. That in itself might be worth of its own separate issue as well.


Customise time display on Xaxis
(system) #3