@datagouv/components-next 1.0.2-dev.147 → 1.0.2-dev.149
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -30,6 +30,12 @@ const { locale } = useTranslation()
|
|
|
30
30
|
const chartContainer = ref<HTMLElement | null>(null)
|
|
31
31
|
let echartsInstance: EChartsType | null = null
|
|
32
32
|
|
|
33
|
+
function capture(): string | null {
|
|
34
|
+
return echartsInstance?.getDataURL() ?? null
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
defineExpose({ capture })
|
|
38
|
+
|
|
33
39
|
function mapXAxisType(xAxis: XAxis | XAxisForm): 'category' | 'value' {
|
|
34
40
|
if (!xAxis) return 'category'
|
|
35
41
|
return xAxis.type === 'continuous' ? 'value' : 'category'
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
>
|
|
6
6
|
<template #default="{ data }">
|
|
7
7
|
<ChartViewer
|
|
8
|
+
ref="chartViewerRef"
|
|
8
9
|
:chart="chart"
|
|
9
10
|
:series="data"
|
|
10
11
|
/>
|
|
@@ -33,6 +34,13 @@ const props = defineProps<{
|
|
|
33
34
|
}>()
|
|
34
35
|
|
|
35
36
|
const { t } = useTranslation()
|
|
37
|
+
const chartViewerRef = ref<InstanceType<typeof ChartViewer> | null>(null)
|
|
38
|
+
|
|
39
|
+
function capture(): string | null {
|
|
40
|
+
return chartViewerRef.value?.capture() ?? null
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
defineExpose({ capture })
|
|
36
44
|
const config = useComponentsConfig()
|
|
37
45
|
const getProfile = useGetProfile()
|
|
38
46
|
|