Fix display of multivalues buckets as an empty cell

This commit is contained in:
Ivan Mikheykin
2018-12-11 15:58:45 +03:00
parent cb5d353b36
commit f13adb369b
3 changed files with 41 additions and 17 deletions
+19 -7
View File
@@ -61,15 +61,27 @@ export class ColorModeDiscrete {
getBucketColor(values) {
let thresholds = this.panel.color.thresholds;
if (!values || values.length == 0) {
// treat as null value
return this.getMatchedThreshold(null).color;
}
if (values.length == 1) {
return this.getMatchedThreshold(values[0]).color;
}
let isAllValuesNulls = true;
for (let j = 0; j < values.length; j++) {
if (values[j] != null) {
isAllValuesNulls = false;
}
}
if (isAllValuesNulls) {
return this.getMatchedThreshold(null).color;
}
for (let i = 0; i < thresholds.length; i++) {
for (let j = 0; j < values.length; j++) {
if (values[j] == null) {
if (this.panel.nullPointMode == 'as zero') {
return this.getMatchedThreshold(0).color;
} else {
return 'rgba(0,0,0,0)';
}
}
if (values[j] == thresholds[i].value) {
return this.getDiscreteColor(i);
}