lianfang_charts
v0.1.0
Published
联方 ECharts 图表封装(按图种独立组件,前缀 LfChart)
Readme
lianfang_charts
联方 ECharts 图表封装:每种图单独组件,只传核心数据,其余有默认值;option 可覆盖一切。
组件前缀 LfChart*,class lf-chart。
安装
pnpm add lianfang_charts echartspeer:vue ^3.5、echarts ^5.5。
import { LfChartBar, LfChartPie } from 'lianfang_charts'
import 'lianfang_charts/style.css'全量:app.use(LianFangCharts)(默认导出)。
组件
| 组件 | 核心 props |
|------|------------|
| LfChartLine | xData + series |
| LfChartBar | xData + series;可选 stack / horizontal |
| LfChartArea | 同 Line,默认面积 |
| LfChartPie | data: { name, value }[];donut 开环形 |
| LfChartRadar | indicators + series |
| LfChartGauge | value;可选 min/max/unit |
| LfChartScatter | data: [x,y][] |
公共:height(默认 320px) loading theme color title option autoresize。
暴露:getInstance() / resize() / setOption()。
最小示例
<script setup lang="ts">
import { LfChartBar, LfChartPie } from 'lianfang_charts'
</script>
<template>
<LfChartBar
:x-data="['周一', '周二', '周三']"
:series="[{ name: '订单', data: [120, 200, 150] }]"
height="280px"
/>
<LfChartPie
donut
:data="[
{ name: '华东', value: 38 },
{ name: '华南', value: 24 },
]"
/>
</template>monorepo
根 package.json 写 "lianfang_charts": "^0.1.0"(不要 workspace:)。本地 packages 版本匹配时 pnpm 链源码。
本仓库对照页:菜单 组件演示 → 图表 Demo,路由 /demo/charts。
