allows to hide warnings in gauge (#15139) (#15238)

* allows to hide warnings in gauge

* should default to true if option is not set

* fixing based on review

* default for isDisplayWarning needs to be applied, else it fails
This commit is contained in:
Peter Pisljar 2017-11-29 16:05:16 +01:00 committed by GitHub
parent af6a2fc6e2
commit aacd23403a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 17 additions and 3 deletions

View file

@ -35,6 +35,17 @@
</div>
</div>
<div class="kuiSideBarFormRow">
<label class="kuiSideBarFormRow__label" for="displayWarnings">
Display warnings &nbsp;
<kbn-info info="Turns on/off warnings. When turned on, a warning will be shown if not all labels could be displayed."></kbn-info>
</label>
<div class="kuiSideBarFormRow__control">
<input class="kuiCheckBox" id="displayWarnings" type="checkbox" ng-model="vis.params.isDisplayWarning">
</div>
</div>
<div class="kuiSideBarFormRow">
<label class="kuiSideBarFormRow__label" for="addLegend">
Show Legend

View file

@ -21,7 +21,7 @@ export default function GaugeVisType(Private) {
type: 'gauge',
addTooltip: true,
addLegend: true,
isDisplayWarning: false,
gauge: {
verticalSplit: false,
extendRange: true,

View file

@ -19,6 +19,7 @@ export default function GoalVisType(Private) {
defaults: {
addTooltip: true,
addLegend: false,
isDisplayWarning: false,
type: 'gauge',
gauge: {
verticalSplit: false,

View file

@ -150,6 +150,7 @@ export function MeterGaugeProvider() {
const marginFactor = 0.95;
const tooltip = this.gaugeChart.tooltip;
const isTooltip = this.gaugeChart.handler.visConfig.get('addTooltip');
const isDisplayWarning = this.gaugeChart.handler.visConfig.get('isDisplayWarning', false);
const maxAngle = this.gaugeConfig.maxAngle;
const minAngle = this.gaugeConfig.minAngle;
const angleFactor = this.gaugeConfig.gaugeType === 'Arc' ? 0.75 : 1;
@ -290,7 +291,7 @@ export function MeterGaugeProvider() {
});
}
if (hiddenLabels) {
if (hiddenLabels && isDisplayWarning) {
this.gaugeChart.handler.alerts.show('Some labels were hidden due to size constraints');
}

View file

@ -134,6 +134,7 @@ export function SimpleGaugeProvider() {
drawGauge(svg, data, width) {
const tooltip = this.gaugeChart.tooltip;
const isTooltip = this.gaugeChart.handler.visConfig.get('addTooltip');
const isDisplayWarning = this.gaugeChart.handler.visConfig.get('isDisplayWarning', false);
const fontSize = this.gaugeChart.handler.visConfig.get('gauge.style.fontSize');
const labelColor = this.gaugeConfig.style.labelColor;
@ -237,7 +238,7 @@ export function SimpleGaugeProvider() {
});
}
if (hiddenLabels) {
if (hiddenLabels && isDisplayWarning) {
this.gaugeChart.handler.alerts.show('Some labels were hidden due to size constraints');
}