Skip to content

Commit 53265ad

Browse files
committed
Fix - VueUiGauge - Fix title alignment options not applied
1 parent d226c15 commit 53265ad

File tree

1 file changed

+19
-11
lines changed

1 file changed

+19
-11
lines changed

src/components/vue-ui-gauge.vue

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import { throttle } from "../canvas-lib";
1919
import themes from "../themes.json";
2020
import UserOptions from "../atoms/UserOptions.vue";
2121
import Skeleton from "./vue-ui-skeleton.vue";
22+
import Title from "../atoms/Title.vue";
2223
import { useNestedProp } from "../useNestedProp";
2324
import { usePrinter } from "../usePrinter";
2425
import { useResponsive } from "../useResponsive";
@@ -357,17 +358,24 @@ defineExpose({
357358
:id="`vue-ui-gauge_${uid}`"
358359
:style="`font-family:${FINAL_CONFIG.style.fontFamily};width:100%; text-align:center;background:${FINAL_CONFIG.style.chart.backgroundColor};${FINAL_CONFIG.responsive ? 'height: 100%' : ''}`"
359360
>
360-
<!-- TITLE AS DIV -->
361-
<div ref="chartTitle" v-if="FINAL_CONFIG.style.chart.title.text" :style="`width:100%;background:${FINAL_CONFIG.style.chart.backgroundColor};padding-bottom:12px;${FINAL_CONFIG.userOptions.show ? 'padding-top:36px' : ''}`">
362-
<div data-cy="gauge-div-title" :style="`width:100%;text-align:center;color:${FINAL_CONFIG.style.chart.title.color};font-size:${FINAL_CONFIG.style.chart.title.fontSize}px;font-weight:${FINAL_CONFIG.style.chart.title.bold ? 'bold': ''}`">
363-
{{ FINAL_CONFIG.style.chart.title.text }}
364-
</div>
365-
<div data-cy="gauge-div-subtitle" v-if="FINAL_CONFIG.style.chart.title.subtitle.text" :style="`width:100%;text-align:center;color:${FINAL_CONFIG.style.chart.title.subtitle.color};font-size:${FINAL_CONFIG.style.chart.title.subtitle.fontSize}px;font-weight:${FINAL_CONFIG.style.chart.title.subtitle.bold ? 'bold': ''}`">
366-
{{ FINAL_CONFIG.style.chart.title.subtitle.text }}
367-
</div>
368-
<div data-cy="gauge-div-base" v-if="!isNaN(dataset.base)" :style="`width:100%;text-align:center;color:${FINAL_CONFIG.style.chart.title.subtitle.color};font-size:${FINAL_CONFIG.style.chart.title.subtitle.fontSize}px;font-weight:${FINAL_CONFIG.style.chart.title.subtitle.bold ? 'bold': ''}`">
369-
{{ FINAL_CONFIG.translations.base }} : {{ dataset.base }}
370-
</div>
361+
362+
<div ref="chartTitle" v-if="FINAL_CONFIG.style.chart.title.text" :style="`width:100%;background:${FINAL_CONFIG.style.chart.backgroundColor};padding-bottom:12px`">
363+
<Title
364+
:config="{
365+
title: {
366+
cy: 'gauge-div-title',
367+
...FINAL_CONFIG.style.chart.title,
368+
},
369+
subtitle: {
370+
cy: 'gauge-div-subtitle',
371+
...FINAL_CONFIG.style.chart.title.subtitle
372+
}
373+
}"
374+
>
375+
<span v-if="FINAL_CONFIG.translations.base && dataset.base">
376+
{{ FINAL_CONFIG.translations.base }}: {{ dataset.base }}
377+
</span>
378+
</Title>
371379
</div>
372380

373381
<!-- OPTIONS -->

0 commit comments

Comments
 (0)