Skip to content

Commit 02eaa7d

Browse files
committed
feat: apply dashed estimation segments on compare sparklines
1 parent 22a4208 commit 02eaa7d

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

app/components/Chart/SplitSparkline.vue

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,11 @@ const props = defineProps<{
1919
year: string
2020
month: string
2121
day: string
22-
}
22+
},
23+
showLastDatapointEstimation: boolean
2324
}>()
2425
26+
2527
const { locale } = useI18n()
2628
const colorMode = useColorMode()
2729
const resolvedMode = shallowRef<'light' | 'dark'>('light')
@@ -89,6 +91,11 @@ function resetHover() {
8991
9092
const configs = computed(() => {
9193
return (props.dataset || []).map<VueUiSparklineConfig>((unit, i) => {
94+
const lastIndex = unit.series.length - 1
95+
const dashIndices = props.showLastDatapointEstimation
96+
? Array.from(new Set([...(unit.dashIndices ?? []), lastIndex]))
97+
: unit.dashIndices
98+
9299
return {
93100
a11y: {
94101
translations: {
@@ -140,6 +147,8 @@ const configs = computed(() => {
140147
},
141148
line: {
142149
color: unit.color ?? palette[i],
150+
dashIndices,
151+
dashArray: 3
143152
},
144153
plot: {
145154
radius: 6,
@@ -152,7 +161,7 @@ const configs = computed(() => {
152161
},
153162
154163
verticalIndicator: {
155-
strokeDasharray: 5,
164+
strokeDasharray: 0,
156165
color: colors.value.fgSubtle,
157166
},
158167
padding: {

app/components/Package/TrendsChart.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1933,6 +1933,7 @@ const isSparklineLayout = shallowRef(false)
19331933
:dataset="normalisedDataset"
19341934
:dates="chartData.dates"
19351935
:datetimeFormatterOptions
1936+
:showLastDatapointEstimation="shouldRenderEstimationOverlay && !isEndDateOnPeriodEnd"
19361937
/>
19371938
</div>
19381939

0 commit comments

Comments
 (0)