@@ -103,6 +103,9 @@ const drawingArea = computed(() => {
103
103
}
104
104
});
105
105
106
+ const sideLegendHeight = computed (() => {
107
+ return drawingArea .value .height - (heatmapConfig .value .style .layout .padding .top - heatmapConfig .value .style .layout .padding .bottom )
108
+ })
106
109
107
110
108
111
const maxValue = computed (() => {
@@ -167,9 +170,12 @@ const mutableDataset = computed(() => {
167
170
})
168
171
});
169
172
173
+ const hoveredValue = ref (null );
174
+
170
175
function useTooltip (datapoint ) {
171
176
const { value , yAxisName , xAxisName ,id } = datapoint;
172
177
hoveredCell .value = id;
178
+ hoveredValue .value = value;
173
179
isTooltip .value = true ;
174
180
let html = " " ;
175
181
@@ -178,6 +184,10 @@ function useTooltip(datapoint) {
178
184
tooltipContent .value = ` <div style="font-size:${ heatmapConfig .value .style .tooltip .fontSize } px">${ html} </div>` ;
179
185
}
180
186
187
+ const sideLegendIndicatorY = computed (() => {
188
+ return drawingArea .value .top + (sideLegendHeight .value * (1 - hoveredValue .value / maxValue .value ))
189
+ })
190
+
181
191
const __to__ = ref (null );
182
192
183
193
function showSpinnerPdf () {
@@ -381,7 +391,7 @@ defineExpose({
381
391
fill =" transparent"
382
392
stroke =" none"
383
393
@mouseover =" useTooltip(cell)"
384
- @mouseout =" isTooltip = false; hoveredCell = undefined"
394
+ @mouseout =" isTooltip = false; hoveredCell = undefined; hoveredValue = null "
385
395
/>
386
396
</g >
387
397
<g v-if =" heatmapConfig.style.layout.dataLabels.yAxis.show" >
@@ -430,19 +440,21 @@ defineExpose({
430
440
:x =" drawingArea.right + 36"
431
441
:y =" drawingArea.top"
432
442
:width =" 36"
433
- :height =" drawingArea.height - 12 "
443
+ :height =" sideLegendHeight "
434
444
:rx =" heatmapConfig.style.legend.scaleBorderRadius"
435
445
fill =" url(#colorScaleVertical)"
436
446
/>
437
447
<text
438
448
:x =" drawingArea.right + 36 + 18"
439
- :y =" drawingArea.bottom + heatmapConfig.style.legend.fontSize * 2 "
449
+ :y =" drawingArea.bottom + heatmapConfig.style.legend.fontSize"
440
450
text-anchor =" middle"
441
451
:font-size =" heatmapConfig.style.legend.fontSize * 2"
442
452
:fill =" heatmapConfig.style.legend.color"
443
453
>
444
454
{{ Number(minValue.toFixed(heatmapConfig.style.legend.roundingValue)).toLocaleString() }}
445
455
</text >
456
+ <line v-if =" hoveredValue !== null" :stroke =" heatmapConfig.style.backgroundColor" stroke-width =" 2" :x1 =" drawingArea.right + 36" :x2 =" drawingArea.right + 72" :y1 =" sideLegendIndicatorY" :y2 =" sideLegendIndicatorY" />
457
+ <path v-if =" hoveredValue !== null" :fill =" heatmapConfig.style.color" stroke =" none" :d =" `M ${drawingArea.right + 36},${sideLegendIndicatorY} ${drawingArea.right + 26},${sideLegendIndicatorY - 8} ${drawingArea.right + 26},${sideLegendIndicatorY + 8}z`" />
446
458
</g >
447
459
448
460
<!-- LEGEND AS G -->
0 commit comments