Svelte 5 wrapper for ECharts.
bun add compote-echart echarts
<script lang="ts">
import { Chart } from 'compote-echart';
import { init, use } from 'echarts/core';
import { BarChart } from 'echarts/charts';
import { GridComponent, TitleComponent, TooltipComponent, DatasetComponent } from 'echarts/components';
import { SVGRenderer } from 'echarts/renderers';
use([BarChart, GridComponent, TitleComponent, TooltipComponent, DatasetComponent, SVGRenderer]);
const options = {
title: { text: 'Sales' },
xAxis: { type: 'category', data: ['Mon', 'Tue', 'Wed'] },
yAxis: { type: 'value' },
series: [{ type: 'bar', data: [12, 20, 8] }]
};
</script>
<Chart {init} {options} />
To apply rounded corners, clip the chart inside a wrapper:
<div class="h-full overflow-hidden rounded-lg shadow-xl">
<Chart {init} {options} />
</div>
rounded-lg affects the wrapper, and overflow-hidden makes the chart content respect that radius.
ChartChartPropsECMouseEventECInteractionEventEventHandlersMouseEventHandlersInteractionEventHandlersecharts is a peer dependency.onclick, onfinished, and similar props.