Skip to content

Commit 92e3637

Browse files
committed
Fix - VueUiXyCanvas - Fix font issue when 'inherit' is used as font
1 parent a367687 commit 92e3637

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

src/components/vue-ui-xy-canvas.vue

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -487,7 +487,7 @@ function setupChart() {
487487
label.y,
488488
{
489489
align: 'right',
490-
font: `${w.value / 40 * FINAL_CONFIG.value.style.chart.grid.y.axisLabels.fontSizeRatio}px ${FINAL_CONFIG.value.style.fontFamily}`,
490+
font: `${Math.round(w.value / 40 * FINAL_CONFIG.value.style.chart.grid.y.axisLabels.fontSizeRatio)}px ${FINAL_CONFIG.value.style.fontFamily}`,
491491
color: FINAL_CONFIG.value.style.chart.grid.y.axisLabels.color
492492
}
493493
);
@@ -615,7 +615,7 @@ function setupChart() {
615615
entry.y,
616616
{
617617
align: 'right',
618-
font: `${w.value / 40 * FINAL_CONFIG.value.style.chart.grid.y.axisLabels.fontSizeRatio}px ${FINAL_CONFIG.value.style.fontFamily}`,
618+
font: `${Math.round(w.value / 40 * FINAL_CONFIG.value.style.chart.grid.y.axisLabels.fontSizeRatio)}px ${FINAL_CONFIG.value.style.fontFamily}`,
619619
color: ds.color
620620
}
621621
);
@@ -634,7 +634,7 @@ function setupChart() {
634634
align: 'center',
635635
rotation: -90,
636636
color: ds.color,
637-
font: `${w.value / 40 * FINAL_CONFIG.value.style.chart.grid.y.axisLabels.fontSizeRatio}px ${FINAL_CONFIG.value.style.fontFamily}`
637+
font: `${Math.round(w.value / 40 * FINAL_CONFIG.value.style.chart.grid.y.axisLabels.fontSizeRatio)}px ${FINAL_CONFIG.value.style.fontFamily}`
638638
}
639639
);
640640
});
@@ -648,7 +648,7 @@ function setupChart() {
648648
w.value - w.value / 40 * FINAL_CONFIG.value.style.chart.grid.y.axisLabels.fontSizeRatio * 1.2,
649649
drawingArea.value.bottom - drawingArea.value.height / 2,
650650
{
651-
font: `${w.value / 40 * FINAL_CONFIG.value.style.chart.grid.y.axisLabels.fontSizeRatio}px ${FINAL_CONFIG.value.style.fontFamily}`,
651+
font: `${Math.round(w.value / 40 * FINAL_CONFIG.value.style.chart.grid.y.axisLabels.fontSizeRatio)}px ${FINAL_CONFIG.value.style.fontFamily}`,
652652
color: FINAL_CONFIG.value.style.chart.color,
653653
align: 'center',
654654
rotation: 90
@@ -663,7 +663,7 @@ function setupChart() {
663663
w.value / 2,
664664
h.value,
665665
{
666-
font: `${w.value / 40 * FINAL_CONFIG.value.style.chart.grid.y.axisLabels.fontSizeRatio}px ${FINAL_CONFIG.value.style.fontFamily}`,
666+
font: `${Math.round(w.value / 40 * FINAL_CONFIG.value.style.chart.grid.y.axisLabels.fontSizeRatio)}px ${FINAL_CONFIG.value.style.fontFamily}`,
667667
color: FINAL_CONFIG.value.style.chart.color,
668668
align: 'center'
669669
}
@@ -701,7 +701,7 @@ function drawDataLabels(ds) {
701701
ds.coordinatesLine[i].y + FINAL_CONFIG.value.style.chart.dataLabels.offsetY,
702702
{
703703
align: 'center',
704-
font: `${w.value / 40 * FINAL_CONFIG.value.style.chart.dataLabels.fontSizeRatio}px ${FINAL_CONFIG.value.style.fontFamily}`,
704+
font: `${Math.round(w.value / 40 * FINAL_CONFIG.value.style.chart.dataLabels.fontSizeRatio)}px ${FINAL_CONFIG.value.style.fontFamily}`,
705705
color: FINAL_CONFIG.value.style.chart.dataLabels.useSerieColor ? ds.color : FINAL_CONFIG.value.style.chart.dataLabels.color,
706706
strokeColor: FINAL_CONFIG.value.style.chart.backgroundColor,
707707
lineWidth: 0.8
@@ -720,7 +720,7 @@ function drawTimeLabels() {
720720
drawingArea.value.bottom + (w.value / FINAL_CONFIG.value.style.chart.grid.y.timeLabels.offsetY),
721721
{
722722
align: FINAL_CONFIG.value.style.chart.grid.y.timeLabels.rotation === 0 ? 'center' : FINAL_CONFIG.value.style.chart.grid.y.timeLabels.rotation > 0 ? 'left' : 'right',
723-
font: `${w.value / 40 * FINAL_CONFIG.value.style.chart.grid.y.timeLabels.fontSizeRatio}px ${FINAL_CONFIG.value.style.fontFamily}`,
723+
font: `${Math.round(w.value / 40 * FINAL_CONFIG.value.style.chart.grid.y.timeLabels.fontSizeRatio)}px ${FINAL_CONFIG.value.style.fontFamily}`,
724724
color: FINAL_CONFIG.value.style.chart.grid.y.timeLabels.color + opacity[tooltipIndex.value !== null ? (tooltipIndex.value + slicer.value.start) === i ? 100 : 20 : 100],
725725
rotation: FINAL_CONFIG.value.style.chart.grid.y.timeLabels.rotation,
726726
}
@@ -825,7 +825,7 @@ function drawBars() {
825825
(ds.coordinatesLine[k].value < 0 ? (mutableConfig.value.stacked ? ds.localZero : absoluteExtremes.value.zero) : ds.coordinatesLine[k].y) + FINAL_CONFIG.value.style.chart.dataLabels.offsetY ,
826826
{
827827
align: 'center',
828-
font: `${w.value / 40 * FINAL_CONFIG.value.style.chart.dataLabels.fontSizeRatio}px ${FINAL_CONFIG.value.style.fontFamily}`,
828+
font: `${Math.round(w.value / 40 * FINAL_CONFIG.value.style.chart.dataLabels.fontSizeRatio)}px ${FINAL_CONFIG.value.style.fontFamily}`,
829829
color: FINAL_CONFIG.value.style.chart.dataLabels.useSerieColor ? ds.color : FINAL_CONFIG.value.style.chart.dataLabels.color,
830830
strokeColor: FINAL_CONFIG.value.style.chart.backgroundColor,
831831
lineWidth: 0.8
@@ -1303,7 +1303,6 @@ defineExpose({
13031303
13041304
<div class="vue-ui-xy-canvas" :style="`position: relative; aspect-ratio: ${aspectRatio}`"
13051305
ref="container">
1306-
13071306
<canvas
13081307
v-if="isDataset"
13091308
ref="canvas"

0 commit comments

Comments
 (0)