Skip to content

Commit 7bb96c7

Browse files
committed
Improvement - VueUiHeatmap - Improve selected cell border visibility
1 parent 7c71fa6 commit 7bb96c7

File tree

1 file changed

+22
-5
lines changed

1 file changed

+22
-5
lines changed

src/components/vue-ui-heatmap.vue

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ const details = ref(null);
5959
const isTooltip = ref(false);
6060
const tooltipContent = ref("");
6161
const hoveredCell = ref(undefined);
62+
const selectedClone = ref(null);
6263
const step = ref(0);
6364
const tableContainer = ref(null);
6465
const isResponsive = ref(false);
@@ -219,11 +220,12 @@ const mutableDataset = computed(() => {
219220
});
220221
221222
const hoveredValue = ref(null);
222-
223223
const dataTooltipSlot = ref(null);
224224
225-
function useTooltip(datapoint, seriesIndex) {
226-
const { value, yAxisName, xAxisName,id } = datapoint;
225+
function useTooltip(datapoint, seriesIndex, x, y) {
226+
selectedClone.value = { x, y };
227+
console.log(datapoint)
228+
const { value, yAxisName, xAxisName, id } = datapoint;
227229
hoveredCell.value = id;
228230
hoveredValue.value = value;
229231
@@ -433,8 +435,8 @@ defineExpose({
433435
:height="cellSize.height"
434436
fill="transparent"
435437
stroke="none"
436-
@mouseover="useTooltip(cell, i)"
437-
@mouseout="isTooltip = false; hoveredCell = undefined; hoveredValue = null"
438+
@mouseover="useTooltip(cell, i, drawingArea.left + cellSize.width * j, drawingArea.top + cellSize.height * i)"
439+
@mouseout="isTooltip = false; hoveredCell = undefined; hoveredValue = null; selectedClone = null"
438440
/>
439441
</g>
440442
<g v-if="FINAL_CONFIG.style.layout.dataLabels.yAxis.show">
@@ -463,6 +465,21 @@ defineExpose({
463465
</text>
464466
</g>
465467

468+
<!-- BORDER FOR SELECTED RECT, PAINTED LAST -->
469+
<g v-if="selectedClone">
470+
<rect
471+
style="pointer-events: none;"
472+
:x="selectedClone.x - FINAL_CONFIG.style.layout.cells.selected.border / 2"
473+
:y="selectedClone.y - FINAL_CONFIG.style.layout.cells.selected.border / 2"
474+
:width="cellSize.width - FINAL_CONFIG.style.layout.cells.spacing + FINAL_CONFIG.style.layout.cells.selected.border"
475+
:height="cellSize.height - FINAL_CONFIG.style.layout.cells.spacing + FINAL_CONFIG.style.layout.cells.selected.border"
476+
fill="transparent"
477+
:stroke="FINAL_CONFIG.style.layout.cells.selected.color"
478+
:stroke-width="FINAL_CONFIG.style.layout.cells.selected.border"
479+
:rx="1"
480+
/>
481+
</g>
482+
466483
<!-- LEGEND RIGHT -->
467484
<g v-if="FINAL_CONFIG.style.legend.show && legendPosition === 'right'">
468485
<defs>

0 commit comments

Comments
 (0)