kibana-riya
Version:
Kibana is an open source (Apache Licensed), browser based analytics and search dashboard for Elasticsearch. Kibana is a snap to setup and start using. Kibana strives to be easy to get started with, while also being flexible and powerful, just like Elastic
28 lines (23 loc) • 707 B
JavaScript
import moment from 'moment';
export default function PointSeriesOrderedDateAxis(timefilter) {
return function orderedDateAxis(vis, chart) {
let xAgg = chart.aspects.x.agg;
let buckets = xAgg.buckets;
let format = buckets.getScaledDateFormat();
chart.xAxisFormatter = function (val) {
return moment(val).format(format);
};
chart.ordered = {
date: true,
interval: buckets.getInterval(),
};
let axisOnTimeField = xAgg.fieldIsTimeField();
let bounds = buckets.getBounds();
if (bounds && axisOnTimeField) {
chart.ordered.min = bounds.min;
chart.ordered.max = bounds.max;
} else {
chart.ordered.endzones = false;
}
};
};