Skip to content

Commit b1649f0

Browse files
committed
Fix - VueUiOnion - Fixed tooltip config options not applied
1 parent e4a67ac commit b1649f0

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/components/vue-ui-onion.vue

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -340,8 +340,11 @@ function useTooltip({ datapoint, seriesIndex, show = true }) {
340340
config: onionConfig.value
341341
})
342342
} else {
343+
const showPercentage = onionConfig.value.style.chart.tooltip.showPercentage;
344+
const showValue = onionConfig.value.style.chart.tooltip.showValue;
345+
343346
html += `<div style="width: 100%; border-bottom: 1px solid #ccc; padding-bottom: 6px;margin-bottom:3px;display:flex;flex-direction:row;gap:3px;align-items:center"><svg viewBox="0 0 12 12" height="14" width="14"><circle data-cy="donut-tooltip-marker" cx="6" cy="6" r="6" stroke="none" fill="${datapoint.color}"/></svg><span></span>${datapoint.name}</span></div>`;
344-
html += `<div style="width:100%;text-align:left;"><b>${dataLabel({p: '', v: datapoint.percentage, s: '%', r: onionConfig.value.style.chart.tooltip.roundingPercentage})}</b> (${dataLabel({ p: datapoint.prefix, v: datapoint.value, s: datapoint.suffix, r: onionConfig.value.style.chart.tooltip.roundingValue })})</div>`
347+
html += `<div style="width:100%;text-align:left;"><b>${showPercentage ? dataLabel({p: '', v: datapoint.percentage, s: '%', r: onionConfig.value.style.chart.tooltip.roundingPercentage}) : ''}</b> ${showPercentage && showValue ? '(' : ''}${showValue ? dataLabel({ p: datapoint.prefix, v: datapoint.value, s: datapoint.suffix, r: onionConfig.value.style.chart.tooltip.roundingValue }) : ''}${showPercentage && showValue ? ')' : ''}</div>`
345348
346349
tooltipContent.value = `<div>${html}</div>`
347350
}

0 commit comments

Comments
 (0)