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
21 lines (17 loc) • 563 B
JavaScript
import _ from 'lodash';
export default function PointSeriesInitYAxis() {
return function initYAxis(chart) {
let y = chart.aspects.y;
let x = chart.aspects.x;
if (_.isArray(y)) {
// TODO: vis option should allow choosing this format
chart.yAxisFormatter = y[0].agg.fieldFormatter();
chart.yAxisLabel = ''; // use the legend
} else {
chart.yAxisFormatter = y.agg.fieldFormatter();
chart.yAxisLabel = y.col.title;
}
let xAggOutput = x.agg.write();
chart.yScale = xAggOutput.metricScale || null;
};
};