mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 17:28:26 -04:00
fixing issue with axis titles
This commit is contained in:
parent
5a499db34e
commit
a2a2681390
2 changed files with 23 additions and 9 deletions
|
@ -28,7 +28,11 @@ module.directive('vislibSeries', function ($parse, $compile) {
|
|||
$scope.series = $scope.vis.params.seriesParams;
|
||||
$scope.$watch(() => {
|
||||
return $scope.vis.aggs.map(agg => {
|
||||
return agg.params.field ? agg.makeLabel() : '';
|
||||
try {
|
||||
return agg.makeLabel();
|
||||
} catch (e) {
|
||||
return '';
|
||||
}
|
||||
}).join();
|
||||
}, () => {
|
||||
let serieCount = 0;
|
||||
|
@ -65,6 +69,7 @@ module.directive('vislibSeries', function ($parse, $compile) {
|
|||
|
||||
$scope.changeValueAxis = (index) => {
|
||||
const series = $scope.vis.params.seriesParams[index];
|
||||
$scope.updateAxisTitle();
|
||||
if (series.valueAxis === 'new') {
|
||||
const axis = $scope.addValueAxis();
|
||||
series.valueAxis = axis.id;
|
||||
|
|
|
@ -118,16 +118,13 @@ module.directive('vislibValueAxes', function ($parse, $compile) {
|
|||
};
|
||||
|
||||
const lastAxisTitles = {};
|
||||
$scope.$watch(() => {
|
||||
return $scope.vis.aggs.map(agg => {
|
||||
return agg.params.field ? agg.makeLabel() : '';
|
||||
}).join();
|
||||
}, () => {
|
||||
$scope.vis.params.valueAxes.forEach((axis, i) => {
|
||||
$scope.updateAxisTitle = function () {
|
||||
$scope.vis.params.valueAxes.forEach((axis, axisNumber) => {
|
||||
let label = '';
|
||||
const isFirst = axisNumber === 0;
|
||||
const matchingSeries = [];
|
||||
$scope.vis.params.seriesParams.forEach(series => {
|
||||
const isMatchingSeries = (i === 0 && !series.valueAxis) || (series.valueAxis === axis.id);
|
||||
$scope.vis.params.seriesParams.forEach((series, i) => {
|
||||
const isMatchingSeries = (isFirst && !series.valueAxis) || (series.valueAxis === axis.id);
|
||||
if (isMatchingSeries) {
|
||||
let seriesNumber = 0;
|
||||
$scope.vis.aggs.forEach(agg => {
|
||||
|
@ -146,6 +143,18 @@ module.directive('vislibValueAxes', function ($parse, $compile) {
|
|||
axis.title.text = label;
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
$scope.$watch(() => {
|
||||
return $scope.vis.aggs.map(agg => {
|
||||
try {
|
||||
return agg.makeLabel();
|
||||
} catch (e) {
|
||||
return '';
|
||||
}
|
||||
}).join();
|
||||
}, () => {
|
||||
$scope.updateAxisTitle();
|
||||
});
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue