Skip to content

Commit aa7ba96

Browse files
committed
Improvement - VueUiQuickChart - Add config options to show time labels at mod
1 parent 983e482 commit aa7ba96

File tree

1 file changed

+23
-21
lines changed

1 file changed

+23
-21
lines changed

src/components/vue-ui-quick-chart.vue

Lines changed: 23 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1316,27 +1316,29 @@ defineExpose({
13161316
</template>
13171317
</g>
13181318
<g class="periodLabels" v-if="FINAL_CONFIG.xyShowScale && FINAL_CONFIG.xyPeriods.length">
1319-
<line
1320-
data-cy="period-tick"
1321-
v-for="(_, i) in FINAL_CONFIG.xyPeriods.slice(slicer.start, slicer.end)"
1322-
:x1="line.drawingArea.left + (line.slotSize * (i+1)) - (line.slotSize / 2)"
1323-
:x2="line.drawingArea.left + (line.slotSize * (i+1)) - (line.slotSize / 2)"
1324-
:y1="line.drawingArea.bottom"
1325-
:y2="line.drawingArea.bottom + 4"
1326-
:stroke="FINAL_CONFIG.xyAxisStroke"
1327-
:stroke-width="FINAL_CONFIG.xyAxisStrokeWidth"
1328-
stroke-linecap="round"
1329-
/>
1330-
<text
1331-
data-cy="period-label"
1332-
v-for="(period, i) in FINAL_CONFIG.xyPeriods.slice(slicer.start, slicer.end)"
1333-
:font-size="FINAL_CONFIG.xyLabelsXFontSize"
1334-
:text-anchor="FINAL_CONFIG.xyPeriodLabelsRotation > 0 ? 'start' : FINAL_CONFIG.xyPeriodLabelsRotation < 0 ? 'end' : 'middle'"
1335-
:fill="FINAL_CONFIG.color"
1336-
:transform="`translate(${line.drawingArea.left + (line.slotSize * (i+1)) - (line.slotSize / 2)}, ${line.drawingArea.bottom + FINAL_CONFIG.xyLabelsXFontSize + 6}), rotate(${FINAL_CONFIG.xyPeriodLabelsRotation})`"
1337-
>
1338-
{{ period }}
1339-
</text>
1319+
<template v-for="(period, i) in FINAL_CONFIG.xyPeriods.slice(slicer.start, slicer.end)">
1320+
<line
1321+
v-if="(!FINAL_CONFIG.xyPeriodsShowOnlyAtModulo || (FINAL_CONFIG.xyPeriodsShowOnlyAtModulo && (i % Math.floor((slicer.end - slicer.start) / FINAL_CONFIG.xyPeriodsModulo) === 0)) || (slicer.end - slicer.start <= FINAL_CONFIG.xyPeriodsModulo))"
1322+
data-cy="period-tick"
1323+
:x1="line.drawingArea.left + (line.slotSize * (i+1)) - (line.slotSize / 2)"
1324+
:x2="line.drawingArea.left + (line.slotSize * (i+1)) - (line.slotSize / 2)"
1325+
:y1="line.drawingArea.bottom"
1326+
:y2="line.drawingArea.bottom + 4"
1327+
:stroke="FINAL_CONFIG.xyAxisStroke"
1328+
:stroke-width="FINAL_CONFIG.xyAxisStrokeWidth"
1329+
stroke-linecap="round"
1330+
/>
1331+
<text
1332+
v-if="(!FINAL_CONFIG.xyPeriodsShowOnlyAtModulo || (FINAL_CONFIG.xyPeriodsShowOnlyAtModulo && (i % Math.floor((slicer.end - slicer.start) / FINAL_CONFIG.xyPeriodsModulo) === 0)) || (slicer.end - slicer.start <= FINAL_CONFIG.xyPeriodsModulo))"
1333+
data-cy="period-label"
1334+
:font-size="FINAL_CONFIG.xyLabelsXFontSize"
1335+
:text-anchor="FINAL_CONFIG.xyPeriodLabelsRotation > 0 ? 'start' : FINAL_CONFIG.xyPeriodLabelsRotation < 0 ? 'end' : 'middle'"
1336+
:fill="FINAL_CONFIG.color"
1337+
:transform="`translate(${line.drawingArea.left + (line.slotSize * (i+1)) - (line.slotSize / 2)}, ${line.drawingArea.bottom + FINAL_CONFIG.xyLabelsXFontSize + 6}), rotate(${FINAL_CONFIG.xyPeriodLabelsRotation})`"
1338+
>
1339+
{{ period }}
1340+
</text>
1341+
</template>
13401342
</g>
13411343
<g class="plots">
13421344
<template v-for="(ds, i) in line.dataset">

0 commit comments

Comments
 (0)