@@ -103,6 +103,9 @@ const drawingArea = computed(() => {
103103 }
104104});
105105
106+ const sideLegendHeight = computed (() => {
107+ return drawingArea .value .height - (heatmapConfig .value .style .layout .padding .top - heatmapConfig .value .style .layout .padding .bottom )
108+ })
106109
107110
108111const maxValue = computed (() => {
@@ -167,9 +170,12 @@ const mutableDataset = computed(() => {
167170 })
168171});
169172
173+ const hoveredValue = ref (null );
174+
170175function useTooltip (datapoint ) {
171176 const { value , yAxisName , xAxisName ,id } = datapoint;
172177 hoveredCell .value = id;
178+ hoveredValue .value = value;
173179 isTooltip .value = true ;
174180 let html = " " ;
175181
@@ -178,6 +184,10 @@ function useTooltip(datapoint) {
178184 tooltipContent .value = ` <div style="font-size:${ heatmapConfig .value .style .tooltip .fontSize } px">${ html} </div>` ;
179185}
180186
187+ const sideLegendIndicatorY = computed (() => {
188+ return drawingArea .value .top + (sideLegendHeight .value * (1 - hoveredValue .value / maxValue .value ))
189+ })
190+
181191const __to__ = ref (null );
182192
183193function showSpinnerPdf () {
@@ -381,7 +391,7 @@ defineExpose({
381391 fill =" transparent"
382392 stroke =" none"
383393 @mouseover =" useTooltip(cell)"
384- @mouseout =" isTooltip = false; hoveredCell = undefined"
394+ @mouseout =" isTooltip = false; hoveredCell = undefined; hoveredValue = null "
385395 />
386396 </g >
387397 <g v-if =" heatmapConfig.style.layout.dataLabels.yAxis.show" >
@@ -430,19 +440,21 @@ defineExpose({
430440 :x =" drawingArea.right + 36"
431441 :y =" drawingArea.top"
432442 :width =" 36"
433- :height =" drawingArea.height - 12 "
443+ :height =" sideLegendHeight "
434444 :rx =" heatmapConfig.style.legend.scaleBorderRadius"
435445 fill =" url(#colorScaleVertical)"
436446 />
437447 <text
438448 :x =" drawingArea.right + 36 + 18"
439- :y =" drawingArea.bottom + heatmapConfig.style.legend.fontSize * 2 "
449+ :y =" drawingArea.bottom + heatmapConfig.style.legend.fontSize"
440450 text-anchor =" middle"
441451 :font-size =" heatmapConfig.style.legend.fontSize * 2"
442452 :fill =" heatmapConfig.style.legend.color"
443453 >
444454 {{ Number(minValue.toFixed(heatmapConfig.style.legend.roundingValue)).toLocaleString() }}
445455 </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`" />
446458 </g >
447459
448460 <!-- LEGEND AS G -->
0 commit comments