Skip to content

Commit d489311

Browse files
committed
VueUiVerticalBar & VueUiHeatmap improvements
1 parent bdb167f commit d489311

File tree

4 files changed

+20
-8
lines changed

4 files changed

+20
-8
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "vue-data-ui",
33
"private": false,
4-
"version": "1.9.93",
4+
"version": "1.9.94",
55
"type": "module",
66
"description": "A user-empowering data visualization Vue components library",
77
"keywords": [

src/App.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2496,7 +2496,7 @@ const moodRadarConfig = ref({
24962496
</template>
24972497
</Box>
24982498

2499-
<Box open @copy="copyConfig(PROD_CONFIG.vue_ui_mini_loader)">
2499+
<Box @copy="copyConfig(PROD_CONFIG.vue_ui_mini_loader)">
25002500
<template #title>
25012501
<!-- <BaseIcon name="chartTable"/> -->
25022502
VueUiMiniLoader
@@ -2887,7 +2887,7 @@ const moodRadarConfig = ref({
28872887
</template>
28882888
</Box>
28892889

2890-
<Box open @copy="copyConfig(PROD_CONFIG.vue_ui_xy)">
2890+
<Box @copy="copyConfig(PROD_CONFIG.vue_ui_xy)">
28912891
<template #title>
28922892
<BaseIcon name="chartLine" />
28932893
VueUiXy
@@ -3625,7 +3625,7 @@ const moodRadarConfig = ref({
36253625
</template>
36263626
</Box>
36273627

3628-
<Box @copy="copyConfig(PROD_CONFIG.vue_ui_heatmap)">
3628+
<Box open @copy="copyConfig(PROD_CONFIG.vue_ui_heatmap)">
36293629
<template #title>
36303630
<BaseIcon name="chartHeatmap"/>
36313631
VueUiHeatmap

src/components/vue-ui-heatmap.vue

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -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
108111
const maxValue = computed(() => {
@@ -167,9 +170,12 @@ const mutableDataset = computed(() => {
167170
})
168171
});
169172
173+
const hoveredValue = ref(null);
174+
170175
function 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+
181191
const __to__ = ref(null);
182192
183193
function 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 -->

src/components/vue-ui-vertical-bar.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ function getParentData(serie, index) {
238238
const start = drawableArea.value.top + ((verticalBarConfig.value.style.chart.layout.bars.gap + verticalBarConfig.value.style.chart.layout.bars.height) * (index));
239239
const height = parent.children.length * (verticalBarConfig.value.style.chart.layout.bars.gap + verticalBarConfig.value.style.chart.layout.bars.height);
240240
return {
241-
y: start + (height / 2),
241+
y: start + (height / 2) - (verticalBarConfig.value.style.chart.layout.bars.parentLabels.fontSize),
242242
name: parent.name,
243243
value: [undefined, NaN, null].includes(parent.value) ? '' : parent.value.toFixed(verticalBarConfig.value.style.chart.layout.bars.dataLabels.value.roundingValue),
244244
percentageToTotal: isNaN(parent.value / total.value) ? '' : calcProportionToTotal(parent.value, true, verticalBarConfig.value.style.chart.layout.bars.dataLabels.percentage.roundingPercentage)

0 commit comments

Comments
 (0)