Skip to content

Commit 770b3cd

Browse files
committed
chore: update chart configs
1 parent b757eac commit 770b3cd

2 files changed

Lines changed: 29 additions & 3 deletions

File tree

app/components/Package/TrendsChart.vue

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<script setup lang="ts">
2-
import type { VueUiXyDatasetItem } from 'vue-data-ui'
2+
import type { VueUiXyConfig, VueUiXyDatasetItem } from 'vue-data-ui'
33
import { VueUiXy } from 'vue-data-ui/vue-ui-xy'
44
import { useDebounceFn, useElementSize } from '@vueuse/core'
55
import { useCssVariables } from '~/composables/useColors'
@@ -1283,12 +1283,14 @@ const chartConfig = computed(() => {
12831283
fullscreen: false,
12841284
table: false,
12851285
tooltip: false,
1286+
altCopy: false, // TODO: set to true to enable the alt copy feature
12861287
},
12871288
buttonTitles: {
12881289
csv: $t('package.trends.download_file', { fileType: 'CSV' }),
12891290
img: $t('package.trends.download_file', { fileType: 'PNG' }),
12901291
svg: $t('package.trends.download_file', { fileType: 'SVG' }),
12911292
annotator: $t('package.trends.toggle_annotator'),
1293+
altCopy: undefined, // TODO: set to proper translation key
12921294
},
12931295
callbacks: {
12941296
img: ({ imageUri }: { imageUri: string }) => {
@@ -1316,6 +1318,10 @@ const chartConfig = computed(() => {
13161318
loadFile(url, buildExportFilename('svg'))
13171319
URL.revokeObjectURL(url)
13181320
},
1321+
// altCopy: ({ dataset: dst, config: cfg }: { dataset: Array<VueUiXyDatasetItem>; config: VueUiXyConfig}) => {
1322+
// // TODO: implement a reusable copy-alt-text-to-clipboard feature based on the dataset & configuration
1323+
// console.log({ dst, cfg})
1324+
// }
13191325
},
13201326
},
13211327
grid: {
@@ -1422,6 +1428,9 @@ const chartConfig = computed(() => {
14221428
selectedColor: accent.value,
14231429
selectedColorOpacity: 0.06,
14241430
frameColor: colors.value.border,
1431+
handleWidth: isMobile.value ? 40 : 20, // does not affect the size of the touch area
1432+
handleBorderColor: colors.value.fgSubtle,
1433+
handleType: 'grab', // 'empty' | 'chevron' | 'arrow' | 'grab'
14251434
},
14261435
preview: {
14271436
fill: transparentizeOklch(accent.value, isDarkMode.value ? 0.95 : 0.92),
@@ -1722,6 +1731,13 @@ watch(selectedMetric, value => {
17221731
aria-hidden="true"
17231732
/>
17241733
</template>
1734+
<template #optionAltCopy>
1735+
<span
1736+
class="i-carbon:accessibility-alt w-6 h-6 text-fg-subtle"
1737+
style="pointer-events: none"
1738+
aria-hidden="true"
1739+
/>
1740+
</template>
17251741
</VueUiXy>
17261742
</div>
17271743

@@ -1768,7 +1784,7 @@ watch(selectedMetric, value => {
17681784
@media screen and (min-width: 767px) {
17691785
#trends-chart .vue-data-ui-refresh-button {
17701786
top: -0.6rem !important;
1771-
left: calc(100% + 2rem) !important;
1787+
left: calc(100% + 4rem) !important;
17721788
}
17731789
}
17741790

app/components/Package/VersionDistribution.vue

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import type {
55
VueUiXyDatasetBarItem,
66
VueUiXyDatapointItem,
77
MinimalCustomFormatParams,
8+
VueUiXyConfig,
89
} from 'vue-data-ui'
910
import { useElementSize } from '@vueuse/core'
1011
import { useCssVariables } from '~/composables/useColors'
@@ -132,12 +133,14 @@ const chartConfig = computed(() => {
132133
fullscreen: false,
133134
table: false,
134135
tooltip: false,
136+
altCopy: false, // TODO: set to true to enable the alt copy feature
135137
},
136138
buttonTitles: {
137139
csv: $t('package.trends.download_file', { fileType: 'CSV' }),
138140
img: $t('package.trends.download_file', { fileType: 'PNG' }),
139141
svg: $t('package.trends.download_file', { fileType: 'SVG' }),
140142
annotator: $t('package.trends.toggle_annotator'),
143+
altCopy: undefined, // TODO: set to proper translation key
141144
},
142145
callbacks: {
143146
img: ({ imageUri }: { imageUri: string }) => {
@@ -165,6 +168,10 @@ const chartConfig = computed(() => {
165168
loadFile(url, buildExportFilename('svg'))
166169
URL.revokeObjectURL(url)
167170
},
171+
// altCopy: ({ dataset: dst, config: cfg }: { dataset: Array<VueUiXyDatasetItem>; config: VueUiXyConfig}) => {
172+
// // TODO: implement a reusable copy-alt-text-to-clipboard feature based on the dataset & configuration
173+
// console.log({ dst, cfg})
174+
// }
168175
},
169176
},
170177
grid: {
@@ -243,6 +250,9 @@ const chartConfig = computed(() => {
243250
selectedColor: accent.value,
244251
selectedColorOpacity: 0.06,
245252
frameColor: colors.value.border,
253+
handleWidth: isMobile.value ? 40 : 20, // does not affect the size of the touch area
254+
handleBorderColor: colors.value.fgSubtle,
255+
handleType: 'grab', // 'empty' | 'chevron' | 'arrow' | 'grab'
246256
},
247257
preview: {
248258
fill: transparentizeOklch(accent.value, isDarkMode.value ? 0.95 : 0.92),
@@ -663,7 +673,7 @@ const endDate = computed(() => {
663673
@media screen and (min-width: 767px) {
664674
#version-distribution .vue-data-ui-refresh-button {
665675
top: -0.6rem !important;
666-
left: calc(100% + 2rem) !important;
676+
left: calc(100% + 4rem) !important;
667677
}
668678
}
669679
</style>

0 commit comments

Comments
 (0)