mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 17:28:26 -04:00
fixing based on thomas' review
This commit is contained in:
parent
92ad40750d
commit
c72ce4bdfd
7 changed files with 37 additions and 18 deletions
|
@ -75,11 +75,11 @@
|
|||
<div class="kuiSideBarCollapsibleTitle">
|
||||
<div
|
||||
class="kuiSideBarCollapsibleTitle__label"
|
||||
ng-click="vis.params.setColorRange = !vis.params.setColorRange"
|
||||
ng-click="toggleColorRangeSection()"
|
||||
>
|
||||
<span
|
||||
aria-hidden="true"
|
||||
ng-class="{ 'fa-caret-down': vis.params.setColorRange, 'fa-caret-right': !vis.params.setColorRange }"
|
||||
ng-class="{ 'fa-caret-down': showColorRange, 'fa-caret-right': !showColorRange }"
|
||||
class="fa fa-caret-right kuiSideBarCollapsibleTitle__caret"
|
||||
></span>
|
||||
<span class="kuiSideBarCollapsibleTitle__text">
|
||||
|
@ -90,10 +90,11 @@
|
|||
ng-model="vis.params.setColorRange"
|
||||
type="checkbox"
|
||||
class="kuiSideBarSectionTitle__action"
|
||||
ng-click="toggleColorRangeSection(true)"
|
||||
>
|
||||
</div>
|
||||
|
||||
<div ng-if="vis.params.setColorRange" class="kuiSideBarCollapsibleSection">
|
||||
<div ng-if="vis.params.setColorRange" ng-show="showColorRange" class="kuiSideBarCollapsibleSection">
|
||||
<div class="kuiSideBarSection">
|
||||
<table class="vis-editor-agg-editor-ranges form-group" ng-show="vis.params.colorsRange.length">
|
||||
<tr>
|
||||
|
@ -155,13 +156,13 @@
|
|||
<div class="kuiSideBarCollapsibleTitle">
|
||||
<div
|
||||
class="kuiSideBarCollapsibleTitle__label"
|
||||
ng-click="valueAxis.labels.show = !valueAxis.labels.show"
|
||||
ng-click="toggleLabelSection()"
|
||||
>
|
||||
<span
|
||||
aria-hidden="true"
|
||||
ng-class="{
|
||||
'fa-caret-down': valueAxis.labels.show,
|
||||
'fa-caret-right': !valueAxis.labels.show
|
||||
'fa-caret-down': showLabels,
|
||||
'fa-caret-right': !showLabels
|
||||
}"
|
||||
class="fa fa-caret-right kuiSideBarCollapsibleTitle__caret"
|
||||
></span>
|
||||
|
@ -175,7 +176,7 @@
|
|||
class="kuiSideBarSectionTitle__action"
|
||||
>
|
||||
</div>
|
||||
<div ng-if="valueAxis.labels.show" class="kuiSideBarCollapsibleSection">
|
||||
<div ng-if="valueAxis.labels.show" ng-show="showLabels" class="kuiSideBarCollapsibleSection">
|
||||
<div class="kuiSideBarSection">
|
||||
<div class="kuiSideBarFormRow">
|
||||
<label class="kuiSideBarFormRow__label" for="rotateLabels">
|
||||
|
|
|
@ -9,7 +9,8 @@ module.directive('heatmapOptions', function () {
|
|||
template: heatmapOptionsTemplate,
|
||||
replace: true,
|
||||
link: function ($scope) {
|
||||
$scope.isColorRangeOpen = true;
|
||||
$scope.showColorRange = false;
|
||||
$scope.showLabels = false;
|
||||
$scope.customColors = false;
|
||||
$scope.options = {
|
||||
rotateLabels: false
|
||||
|
@ -21,20 +22,32 @@ module.directive('heatmapOptions', function () {
|
|||
$scope.vis.params.valueAxes[0].labels.rotate = rotate ? 270 : 0;
|
||||
});
|
||||
|
||||
$scope.resetColors = () => {
|
||||
$scope.resetColors = function () {
|
||||
$scope.uiState.set('vis.colors', null);
|
||||
$scope.customColors = false;
|
||||
};
|
||||
|
||||
$scope.toggleColorRangeSection = function (checkbox = false) {
|
||||
$scope.showColorRange = !$scope.showColorRange;
|
||||
if (checkbox && !$scope.vis.params.setColorRange) $scope.showColorRange = false;
|
||||
if (!checkbox && $scope.showColorRange && !$scope.vis.params.setColorRange) $scope.vis.params.setColorRange = true;
|
||||
};
|
||||
|
||||
$scope.toggleLabelSection = function (checkbox = false) {
|
||||
$scope.showLabels = !$scope.showLabels;
|
||||
if (checkbox && !$scope.valueAxis.labels.show) $scope.showLabels = false;
|
||||
if ($scope.showLabels && !$scope.valueAxis.labels.show) $scope.valueAxis.labels.show = true;
|
||||
};
|
||||
|
||||
$scope.getGreaterThan = function (index) {
|
||||
if (index === 0) return -1;
|
||||
if (index === 0) return;
|
||||
return $scope.vis.params.colorsRange[index - 1].to;
|
||||
};
|
||||
|
||||
$scope.addRange = function () {
|
||||
const previousRange = _.last($scope.vis.params.colorsRange);
|
||||
const from = previousRange ? previousRange.to : 0;
|
||||
$scope.vis.params.colorsRange.push({from: from, to: null});
|
||||
$scope.vis.params.colorsRange.push({ from: from, to: null });
|
||||
};
|
||||
|
||||
$scope.removeRange = function (index) {
|
||||
|
|
|
@ -37,6 +37,7 @@ export default function HeatmapVisType(Private) {
|
|||
labels: {
|
||||
show: false,
|
||||
rotate: 0,
|
||||
color: '#555'
|
||||
}
|
||||
}]
|
||||
},
|
||||
|
|
|
@ -14,6 +14,7 @@ export default function AlertsFactory(Private) {
|
|||
constructor(vis, alertDefs) {
|
||||
this.vis = vis;
|
||||
this.data = vis.data;
|
||||
this.alertDefs = _.cloneDeep(alertDefs);
|
||||
|
||||
this.alerts = _(alertDefs)
|
||||
.map(alertDef => {
|
||||
|
@ -55,11 +56,14 @@ export default function AlertsFactory(Private) {
|
|||
// shows new alert
|
||||
show(msg, type) {
|
||||
const vis = this.vis;
|
||||
const alert = {
|
||||
msg: msg,
|
||||
type: type
|
||||
};
|
||||
if (this.alertDefs.find(alertDef => alertDef.msg === alert.msg)) return;
|
||||
this.alertDefs.push(alert);
|
||||
$(vis.el).find('.vis-alerts-tray').append(
|
||||
this._addAlert({
|
||||
msg: msg,
|
||||
type: type
|
||||
})
|
||||
this._addAlert(alert)
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@ export default function VisConfigFactory(Private) {
|
|||
style: {
|
||||
margin : { top: 10, right: 3, bottom: 5, left: 3 }
|
||||
},
|
||||
alerts: {},
|
||||
alerts: [],
|
||||
categoryAxes: [],
|
||||
valueAxes: []
|
||||
};
|
||||
|
|
|
@ -153,7 +153,7 @@ export default function HeatmapChartFactory(Private) {
|
|||
val = colorsNumber - 1;
|
||||
} else {
|
||||
val = (d.y - min) / (max - min); /* get val from 0 - 1 */
|
||||
val = Math.floor(val * colorsNumber);
|
||||
val = Math.min(colorsNumber - 1, Math.floor(val * colorsNumber));
|
||||
}
|
||||
}
|
||||
return val;
|
||||
|
|
|
@ -117,7 +117,7 @@ uiModules.get('kibana')
|
|||
const labels = vislibVis.getLegendLabels();
|
||||
if (labels) {
|
||||
$scope.labels = _.map(labels, label => {
|
||||
return {label: label};
|
||||
return { label: label };
|
||||
});
|
||||
}
|
||||
} else {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue