diff --git a/examples/data-exchange/.eslintrc.json b/examples/data-exchange/.eslintrc.json index ca38aec4..eff9d74a 100644 --- a/examples/data-exchange/.eslintrc.json +++ b/examples/data-exchange/.eslintrc.json @@ -11,6 +11,7 @@ "@typescript-eslint/no-explicit-any": ["off"], "react/display-name": "off", "@next/next/no-html-link-for-pages": "off", - "prefer-const": "off" + "prefer-const": "off", + "@typescript-eslint/no-var-requires": "off" } } diff --git a/examples/data-exchange/app/[locale]/(user)/chart/Content.tsx b/examples/data-exchange/app/[locale]/(user)/chart/Content.tsx index e4c16473..514eb87a 100644 --- a/examples/data-exchange/app/[locale]/(user)/chart/Content.tsx +++ b/examples/data-exchange/app/[locale]/(user)/chart/Content.tsx @@ -2,11 +2,13 @@ import React from 'react'; import dynamic from 'next/dynamic'; +import Image from 'next/image'; import { EChartsOption } from 'echarts-for-react'; import { ShareDialog, useScreenshot } from 'opub-ui'; import { BarChart } from 'opub-ui/viz'; import { useMediaQuery } from 'usehooks-ts'; +import { eCharts } from '@/lib/eCharts'; import { navigateEnd } from '@/lib/navigation'; const MapChart = dynamic( @@ -17,7 +19,6 @@ const MapChart = dynamic( ); type Props = { - svg: string; options: EChartsOption; }; export function Content({ @@ -49,21 +50,18 @@ export function Content({
{ const [svgURL, setSvgURL] = React.useState(''); - const base64SvgBar = btoa(svg); - const dataUrlBar = `data:image/svg+xml;base64,${base64SvgBar}`; const isDesktop = useMediaQuery('(min-width: 768px)'); const { createSvg, svgToPngURL, downloadFile } = useScreenshot(); const generateImage = async () => { + const dataUrlBar = eCharts({ options: options }); + const svg = await createSvg(