jhit-echarts
是一个基于 ECharts 的 Web Component,并内置图表导出功能。
npm i @jhit/echarts-web-component
以HTML为例
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Echarts Web Component</title>
<script src="https://unpkg.com/@jhit/echarts-web-component"></script>
</head>
<body>
<jhit-echarts
downloadable
style="height: 300px; width: 500px;"
option='{
"title": {"text": "示例图表"},
"xAxis": {"data": ["A", "B", "C"]},
"yAxis": {},
"series": [{"type": "bar", "data": [10, 20, 30]}]
}'
/>
</body>
</html>
参数名 | 类型 | 说明 |
---|---|---|
option |
string |
ECharts 图表配置项 |
style |
string |
ECharts 容器样式 |
downloadable |
boolean |
是否显示导出按钮 |
npm run build
npm run dev # F5 Rrefresh
jhit 2025-04-25