From b5ed3f47fc23c1b1f415bff9f473339c5db808f3 Mon Sep 17 00:00:00 2001 From: Ivan Mikheykin Date: Thu, 30 Aug 2018 15:26:56 +0300 Subject: [PATCH] colored tooltip for discrete mode - fix multiple values notes - fix legend padding --- src/color_mode_discrete.js | 5 ++++- src/css/status-heatmap.scss | 4 ++++ src/options_editor.html | 30 +++++++++++++++++++----------- src/rendering.js | 2 +- src/tooltip.js | 7 +++++-- 5 files changed, 33 insertions(+), 15 deletions(-) diff --git a/src/color_mode_discrete.js b/src/color_mode_discrete.js index e64cb31..aae392a 100644 --- a/src/color_mode_discrete.js +++ b/src/color_mode_discrete.js @@ -16,7 +16,10 @@ export class ColorModeDiscrete { for (let i = 0; i < thresholds.length; i++) { for (let j = 0; j < values.length; j++) { if (values[j] == thresholds[i].value) { - tooltips.push(thresholds[i].tooltip); + tooltips.push({ + "tooltip": thresholds[i].tooltip, + "color": thresholds[i].color + }); } } } diff --git a/src/css/status-heatmap.scss b/src/css/status-heatmap.scss index ddbf427..575248f 100644 --- a/src/css/status-heatmap.scss +++ b/src/css/status-heatmap.scss @@ -75,6 +75,10 @@ $font-size-sm: 12px !default; padding-left: 10px; } + .status-heatmap-color-legend { + margin-top: 4px; + } + .status-heatmap-legend-values { display: inline-block; } diff --git a/src/options_editor.html b/src/options_editor.html index 20bff1a..27a34ef 100644 --- a/src/options_editor.html +++ b/src/options_editor.html @@ -17,6 +17,9 @@
+
+ Note: Bucket color determined by maximum value in bucket
+
@@ -36,6 +39,9 @@
+
+ Note: Bucket color determined by maximum value in bucket
+
@@ -45,16 +51,15 @@
- -
- Note: Bucket color determined by maximum for multiple values
+
+ Note: Multiple values displayed using color with least index
- + + + +
-
Graph
+
Bucket
+
+ Color for bucket with multiple values is determined by color mode
+
@@ -130,11 +138,11 @@
- +
- +
diff --git a/src/rendering.js b/src/rendering.js index 3b819f5..97180e2 100644 --- a/src/rendering.js +++ b/src/rendering.js @@ -58,7 +58,7 @@ export default function link(scope, elem, attrs, ctrl) { height = parseInt(height.replace('px', ''), 10); } - height -= panel.legend.show ? 28 : 11; // bottom padding and space for legend + height -= panel.legend.show ? 32 : 10; // bottom padding and space for legend. Change margin in .status-heatmap-color-legend ! $heatmap.css('height', height + 'px'); diff --git a/src/tooltip.js b/src/tooltip.js index 21b205f..493e3d8 100644 --- a/src/tooltip.js +++ b/src/tooltip.js @@ -84,11 +84,14 @@ export class StatusHeatmapTooltip { if (this.panel.color.mode === 'discrete') { let statuses = this.panelCtrl.discreteHelper.convertValuesToTooltips(values); let statusesHtml = ''; - if (statuses.length > 0) { + if (statuses.length === 1) { + statusesHtml = ` + status: ${statuses[0].tooltip}`; + } else if (statuses.length > 1) { statusesHtml = ` statuses:
    - ${_.join(_.map(statuses, v => `
  • ${v}
  • `), "")} + ${_.join(_.map(statuses, v => `
  • ${v.tooltip}
  • `), "")}
`; } tooltipHtml += `