@worm-print-platform/echarts 0.0.0-stage → 1.5.0
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/LICENSE +21 -0
- package/README.md +152 -2
- package/dist/bind.d.ts +11 -0
- package/dist/browser/executor.iife.d.ts +19 -0
- package/dist/browser-bundle.d.ts +8 -0
- package/dist/config.d.ts +36 -0
- package/dist/constants.d.ts +60 -0
- package/dist/defaults.d.ts +8 -0
- package/dist/echarts.d.ts +14 -0
- package/dist/echarts.js +20 -0
- package/dist/executor.iife.global.d.ts +14 -0
- package/dist/executor.iife.global.js +62 -0
- package/dist/index.cjs +6 -0
- package/dist/index.d.ts +19 -0
- package/dist/index.js +33 -0
- package/dist/kinds.d.ts +26 -0
- package/dist/kit.cjs +6 -0
- package/dist/kit.d.ts +21 -0
- package/dist/kit.js +154 -0
- package/dist/node.cjs +671 -0
- package/dist/node.d.ts +7 -0
- package/dist/node.js +654 -0
- package/dist/normalize.d.ts +7 -0
- package/dist/option-utils.d.ts +35 -0
- package/dist/plugin-Bf6QDbHO.cjs +6 -0
- package/dist/plugin-CUoE2jMs.js +573 -0
- package/dist/plugin.d.ts +24 -0
- package/dist/renderer.d.ts +26 -0
- package/dist/type-augmentation.d.ts +38 -0
- package/dist/ui.cjs +446 -0
- package/dist/ui.d.ts +12 -0
- package/dist/ui.js +445 -0
- package/dist/units.d.ts +8 -0
- package/dist/version.d.ts +8 -0
- package/package.json +74 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 worm <liu_long_qqcom@qq.com>
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,153 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @worm-print-platform/echarts
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
打印模板的 **ECharts 图表元素可选包**:一个插件注册十个图表元素,提供 SVG 渲染器(echarts SSR)、
|
|
4
|
+
页面执行器、设计器画布 / 图形化属性面板与共享数据契约。
|
|
5
|
+
主包 `@worm-print-platform/core` 与 `@worm-print-platform/canvas` 不依赖任何图表库,只有本包引入 `echarts`。
|
|
6
|
+
|
|
7
|
+
**「import 即注册」**:宿主不需要写任何注册代码,也不需要手写渲染器传参。
|
|
8
|
+
|
|
9
|
+
> 状态:本包随工作区主线开发,**尚未发布到 npm**;请以工作区依赖或源码方式引入。
|
|
10
|
+
|
|
11
|
+
## 安装
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
npm i @worm-print-platform/echarts
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
`echarts`(^6.1.0,Apache-2.0)由本包作为 dependency 安装;`@worm-print-platform/core`、
|
|
18
|
+
`@worm-print-platform/plugin-kit` 同样以 dependency 引入。
|
|
19
|
+
|
|
20
|
+
## 十个元素
|
|
21
|
+
|
|
22
|
+
| type | 元素 | 默认尺寸 | 数据映射要点 |
|
|
23
|
+
| --- | --- | --- | --- |
|
|
24
|
+
| `barChart` | 柱状图 | 100×60 | 类目 + 多数值字段(多值多系列) |
|
|
25
|
+
| `barHChart` | 条形图(横向) | 100×60 | 类目写 yAxis,xAxis 为数值 |
|
|
26
|
+
| `lineChart` | 折线图 | 100×60 | 同柱状图,series 为 line |
|
|
27
|
+
| `areaChart` | 面积图 | 100×60 | 折线 + areaStyle |
|
|
28
|
+
| `pieChart` | 饼图 | 60×60 | 类目 + 首数值 → `{ name, value }` |
|
|
29
|
+
| `doughnutChart` | 环形图 | 60×60 | 饼图 + 可配内径 |
|
|
30
|
+
| `scatterChart` | 散点图 | 80×60 | 类目作 x、首数值作 y;`chartBubble` 开启时第二数值作点大小 |
|
|
31
|
+
| `radarChart` | 雷达图 | 70×60 | 数值字段=维度,每行一个系列 |
|
|
32
|
+
| `funnelChart` | 漏斗图 | 60×60 | 类目 + 首数值,按数值降序 |
|
|
33
|
+
| `gaugeChart` | 仪表盘 | 60×60 | 取首行首值;min/max 面板可配 |
|
|
34
|
+
|
|
35
|
+
所有元素共用同一份数据契约:`chartOption` + `chartDataSource` / `chartCategoryField` /
|
|
36
|
+
`chartValueFields` / `chartSeriesField`(散点另有 `chartBubble`)。
|
|
37
|
+
模板只存 option 模板与字段映射,真实数据由 core 绑定阶段注入;`series[].data` 写 `$data` 占位即可。
|
|
38
|
+
|
|
39
|
+
## 用法
|
|
40
|
+
|
|
41
|
+
### 设计器 / 浏览器宿主
|
|
42
|
+
|
|
43
|
+
```ts
|
|
44
|
+
// 一行副作用 import:素材卡、画布组件、「自定义属性」tab、校验、绑定、出图全部生效
|
|
45
|
+
import '@worm-print-platform/echarts'
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
### 服务端 PDF / Electron 主进程
|
|
49
|
+
|
|
50
|
+
```ts
|
|
51
|
+
// ① 部署白名单:显式 import 才允许该插件进入注册表(模板字符串无法触发 import())
|
|
52
|
+
import '@worm-print-platform/echarts/node'
|
|
53
|
+
|
|
54
|
+
// ② runtime 装配:扩展元素执行器由注册表自动收集,新增插件无需改这行代码
|
|
55
|
+
import { collectExecutorBundles, createDomHostRuntime } from '@worm-print-platform/core'
|
|
56
|
+
createDomHostRuntime(factory, loadExecutorBundle(), collectExecutorBundles())
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
`/node` 子路径会为描述符补上 `render.executorBundle()`(惰性读取 IIFE 产物),
|
|
60
|
+
`collectExecutorBundles()` 因此能按注册态收集;插件同时提供 `createRenderer()`,
|
|
61
|
+
正常路径走**进程内 SSR 出图**,页面执行器只在宿主没有进程内能力时才需要。
|
|
62
|
+
执行器注入后挂在 `globalThis.__wormDom.renderAssets(specs)`(与 core 的 `renderAssets` 协议同名)。
|
|
63
|
+
|
|
64
|
+
### 零框架宿主 / 自建设计器 UI(`/kit`)
|
|
65
|
+
|
|
66
|
+
`/kit` 是**框架无关的纯 TS 出口**:不包含任何 `.vue` 组件、不读磁盘,import 即把十个 kind 注册到
|
|
67
|
+
core 插件注册表,但**不**注册设计器组件与执行器产物。零框架宿主用它自建画布与属性台:
|
|
68
|
+
|
|
69
|
+
```ts
|
|
70
|
+
import {
|
|
71
|
+
CHART_KIND_DEFINITIONS, createDefaultChartOption, normalizeChartOption,
|
|
72
|
+
previewChartOption, renderChartToSvg,
|
|
73
|
+
} from '@worm-print-platform/echarts/kit'
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
`/ui` 就是基于 `/kit` + `@worm-print-platform/plugin-kit` 的适配层(拆仓前旧名 `echarts-common`)
|
|
77
|
+
(静态 SVG 画布 + 原生 DOM 属性面板);框架无关宿主不必重复实现面板读取/写回逻辑。
|
|
78
|
+
|
|
79
|
+
## 配置(`configureChartPlugin`)
|
|
80
|
+
|
|
81
|
+
配置是**惰性**的:可在注册前调用、按键合并,不需要注销重注册。
|
|
82
|
+
|
|
83
|
+
```ts
|
|
84
|
+
import { configureChartPlugin } from '@worm-print-platform/echarts'
|
|
85
|
+
|
|
86
|
+
configureChartPlugin({
|
|
87
|
+
defaultWidth: 120, // 新建图表元素的全局默认尺寸(kind 自带默认值,配置优先)
|
|
88
|
+
defaultHeight: 70,
|
|
89
|
+
palettes: {
|
|
90
|
+
default: { label: '企业蓝', colors: ['#165DFF', '#36B37E'] }, // 覆盖同名预设
|
|
91
|
+
brand: { label: '品牌色', colors: ['#F2704E', '#F7A35C'] }, // 追加新配色
|
|
92
|
+
},
|
|
93
|
+
sampleCategories: ['一季度', '二季度', '三季度'],
|
|
94
|
+
components: [GaugeChart], // 追加 echarts.use 的图表/组件构造器
|
|
95
|
+
})
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
| 键 | 作用 |
|
|
99
|
+
| --- | --- |
|
|
100
|
+
| `defaultWidth` / `defaultHeight` | 新建图表元素的默认 mm 尺寸(kind 默认尺寸可被覆盖) |
|
|
101
|
+
| `palettes` | 覆盖同名预设配色或新增配色,属性台下拉即时可见 |
|
|
102
|
+
| `sampleCategories` | 设计态无绑定数据时 `$data` 占位的示例类目 |
|
|
103
|
+
| `components` | 追加 `echarts.use` 图表/组件;按引用去重,改配置后下次出图生效 |
|
|
104
|
+
|
|
105
|
+
## 导出
|
|
106
|
+
|
|
107
|
+
| 子路径 | 内容 |
|
|
108
|
+
| --- | --- |
|
|
109
|
+
| `.` | `CHART_PLUGIN` / `CHART_PLUGIN_ID` / `CHART_KINDS` / `CHART_KIND_DEFINITIONS` / `getChartKindDefinition` / `resolveChartPanelFields` / `createDefaultChartOption` / `normalizeChartOption` / `bindChartData` / `renderChartToSvg` / `renderChartElement` / `fitSvgRoot` / `mmToChartPx` / `configureChartPlugin` / `getChartPluginConfig` / `getChartPalettes` / `getSampleCategories` / `chartFactoryDefaults` / `registerChartPlugin` / `uninstallChartPlugin` / `installChartDesigner` / `uninstallChartDesigner` |
|
|
110
|
+
| `./kit` | 框架无关纯 TS 出口(无 Vue、无 `node:fs`):注册副作用 + 上表纯逻辑能力 + 常量(`CHART_PALETTES` / `FUNNEL_PADDING_DEFAULTS` / `RADAR_RADIUS_DEFAULT` 等)与面板读写工具(`previewChartOption` / `readPaletteKey` / `syncSeriesCount` / `readFunnelPadding` / `writeFunnelPadding` / `readRadarRadius` / `writeRadarRadius`) |
|
|
111
|
+
| `./node` | 注册副作用 + `render.executorBundle()`(惰性读取 IIFE 产物,纯 TS、不含 Vue) |
|
|
112
|
+
| `./browser/executor.iife` | 页面注入用 IIFE(echarts 已打入,自包含);带 `types` 条件 |
|
|
113
|
+
|
|
114
|
+
`type-augmentation.ts` 用声明合并把十个图表类型与 `chartOption` 等专属字段注入 core 的类型扩展点,
|
|
115
|
+
并带编译期自校验——已装包宿主的 `Record<ElementType, T>` 穷尽映射无需改动。
|
|
116
|
+
|
|
117
|
+
## 设计器属性面板
|
|
118
|
+
|
|
119
|
+
- **只提供图形化配置**:数据源 / 类目字段 / 数值字段 / 系列拆分 / 标题 / 图例 / 配色 /
|
|
120
|
+
堆叠 / 气泡 / 内径 / 仪表盘范围 / 漏斗内边距 / 雷达半径,按元素类型裁剪;不提供 JSON 编辑器。
|
|
121
|
+
- 模板 JSON 仍允许手写 `chartOption`(开发者与 AI 的出口),面板只改自己掌管的字段。
|
|
122
|
+
- 提交通道:`emit('change')`(记历史)、`emit('update:options', partial)`(受控合并)。
|
|
123
|
+
|
|
124
|
+
## 留白(内边距 / 半径)
|
|
125
|
+
|
|
126
|
+
ECharts 的图表内边距是 option 自身的布局参数,插件负责给出适合打印小框的出厂值,并把这几个值放进属性台。
|
|
127
|
+
|
|
128
|
+
| 元素 | 面板控件 | 落到 chartOption | 出厂默认 |
|
|
129
|
+
| --- | --- | --- | --- |
|
|
130
|
+
| `funnelChart` | 内边距 上/右/下/左 (%) | `series[].top/right/bottom/left` | `6% / 25% / 6% / 5%` |
|
|
131
|
+
| `radarChart` | 半径 (%) | `radar.radius` | `75%` |
|
|
132
|
+
|
|
133
|
+
- **漏斗图**不写内边距时会吃 ECharts 的 px 默认(左右 80、上 60、下 65),60×60mm 的元素框里图形只剩一半不到;
|
|
134
|
+
现阶段默认把四边压到 5~6%,右侧保留 25% 给**外置标签与引导线**(标签超出元素框会被 `overflow:hidden` 裁掉,
|
|
135
|
+
不要为了铺满把右边距调到 10% 以下;标签想更靠边可以手写 `series.label.position: 'inside'`)。
|
|
136
|
+
- **雷达图**的 ECharts 6 默认 `radar.radius` 是 `50%`(5.x 是 `75%`),70×60mm 框里图形直径只有短边一半,
|
|
137
|
+
默认值已恢复为 `75%`;想更大可调到 `80%` 左右,再大轴名会顶到框边。
|
|
138
|
+
- 面板显示统一为百分比:手写 `chartOption` 里的 px 数字会按当前元素框折算成百分比回读。
|
|
139
|
+
- 出厂默认只作用于**新建元素**;存量模板的 `chartOption` 已落盘,出图不变,需要时在属性台或模板 JSON 里改。
|
|
140
|
+
|
|
141
|
+
## SVG 根节点处理
|
|
142
|
+
|
|
143
|
+
echarts SSR 产出「固定 px 宽高 + viewBox」的独立 SVG。`renderChartToSvg` 归一为可内联铺满 mm 盒子的矢量图:
|
|
144
|
+
|
|
145
|
+
- `width` / `height` → `100%`;
|
|
146
|
+
- `viewBox="0 0 宽 高"`(96dpi:`px = mm * 96 / 25.4` 取整);
|
|
147
|
+
- 根节点样式固定 `display:block;width:100%;height:100%`。
|
|
148
|
+
|
|
149
|
+
## 构建
|
|
150
|
+
|
|
151
|
+
```bash
|
|
152
|
+
npm run build -w @worm-print-platform/echarts
|
|
153
|
+
```
|
package/dist/bind.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* @worm-print-platform/echarts v1.5.0
|
|
3
|
+
* Copyright (c) 2026 worm <liu_long_qqcom@qq.com>
|
|
4
|
+
* SPDX-FileCopyrightText: 2026 worm <liu_long_qqcom@qq.com>
|
|
5
|
+
* SPDX-License-Identifier: MIT
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* 绑定入口:返回要合并进元素 options 的补丁(`_chartOption`)。
|
|
9
|
+
* 没有可绑定数据、没有数值字段、或 option 里没有 `$data` 占位时原样保留(手写固定数据不被覆盖)。
|
|
10
|
+
*/
|
|
11
|
+
export declare function bindChartData(type: string, options: Record<string, unknown>, data: Record<string, unknown>): Record<string, unknown>;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* @worm-print-platform/echarts v1.5.0
|
|
3
|
+
* Copyright (c) 2026 worm <liu_long_qqcom@qq.com>
|
|
4
|
+
* SPDX-FileCopyrightText: 2026 worm <liu_long_qqcom@qq.com>
|
|
5
|
+
* SPDX-License-Identifier: MIT
|
|
6
|
+
*/
|
|
7
|
+
import { CHART_EXECUTOR_VERSION } from '../version.js';
|
|
8
|
+
/**
|
|
9
|
+
* 批量渲染规格 → `key → SVG` 映射(core 执行器协议:无首参、同步返回普通对象)。
|
|
10
|
+
* 单个规格失败只跳过该 key:core 侧对未命中的 key 会明确报「缺少扩展元素执行器产物」。
|
|
11
|
+
*/
|
|
12
|
+
export declare function renderAssets(specs: Array<Record<string, unknown>>): Record<string, string>;
|
|
13
|
+
type ExecutorHolder = Record<string, unknown>;
|
|
14
|
+
/**
|
|
15
|
+
* 挂载到 globalThis.__wormDom:core 的 DOM 执行器注入在前、本执行器注入在后,
|
|
16
|
+
* 两者共用同一个全局对象;只新增 renderAssets,不覆盖 core 已有方法。
|
|
17
|
+
*/
|
|
18
|
+
export declare function installChartExecutor(target?: Record<string, unknown>): ExecutorHolder;
|
|
19
|
+
export { CHART_EXECUTOR_VERSION };
|
package/dist/config.d.ts
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* @worm-print-platform/echarts v1.5.0
|
|
3
|
+
* Copyright (c) 2026 worm <liu_long_qqcom@qq.com>
|
|
4
|
+
* SPDX-FileCopyrightText: 2026 worm <liu_long_qqcom@qq.com>
|
|
5
|
+
* SPDX-License-Identifier: MIT
|
|
6
|
+
*/
|
|
7
|
+
export interface ChartPaletteDefinition {
|
|
8
|
+
label?: string;
|
|
9
|
+
colors: readonly string[];
|
|
10
|
+
}
|
|
11
|
+
/** 可通过 configureChartPlugin() 写入的全部配置键(均可选,缺省走出厂默认) */
|
|
12
|
+
export interface ChartPluginConfig {
|
|
13
|
+
/** 新建图表元素的默认宽度(mm);kind 自带默认尺寸,配置优先 */
|
|
14
|
+
defaultWidth?: number;
|
|
15
|
+
/** 新建图表元素的默认高度(mm) */
|
|
16
|
+
defaultHeight?: number;
|
|
17
|
+
/** 覆盖同名预设配色或新增配色:key → { label, colors } */
|
|
18
|
+
palettes?: Readonly<Record<string, ChartPaletteDefinition>>;
|
|
19
|
+
/** 追加的 ECharts 图表/组件构造器,交给 echarts.use(如 GaugeChart、MarkLineComponent) */
|
|
20
|
+
components?: readonly unknown[];
|
|
21
|
+
/** 设计态示例类目(模板态 $data 占位在无绑定数据时的替换值) */
|
|
22
|
+
sampleCategories?: readonly string[];
|
|
23
|
+
}
|
|
24
|
+
export declare function configureChartPlugin(config: ChartPluginConfig): void;
|
|
25
|
+
export declare function getChartPluginConfig(): ChartPluginConfig;
|
|
26
|
+
export interface ChartPalette {
|
|
27
|
+
key: string;
|
|
28
|
+
label: string;
|
|
29
|
+
colors: readonly string[];
|
|
30
|
+
}
|
|
31
|
+
/** 预设配色 ∪ 自定义配色:同名以自定义为准,新增 key 追加在末尾 */
|
|
32
|
+
export declare function getChartPalettes(): ChartPalette[];
|
|
33
|
+
/** 设计态示例类目;未配置时与 P0 行为一致 */
|
|
34
|
+
export declare function getSampleCategories(): readonly string[];
|
|
35
|
+
/** 某 kind 的元素出厂默认选项:core 元素工厂与 canvas 素材卡共用同一份 */
|
|
36
|
+
export declare function chartFactoryDefaults(type: string, partial?: Record<string, unknown>): Record<string, unknown>;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* @worm-print-platform/echarts v1.5.0
|
|
3
|
+
* Copyright (c) 2026 worm <liu_long_qqcom@qq.com>
|
|
4
|
+
* SPDX-FileCopyrightText: 2026 worm <liu_long_qqcom@qq.com>
|
|
5
|
+
* SPDX-License-Identifier: MIT
|
|
6
|
+
*/
|
|
7
|
+
/** 插件 id:写入模板顶层 plugins 清单,也是 configurePlugin / 注册表查询的键 */
|
|
8
|
+
export declare const CHART_PLUGIN_ID = "@worm-print-platform/echarts";
|
|
9
|
+
/** 图形化面板可选配色(落 chartOption.color,ECharts 按系列循环取色) */
|
|
10
|
+
export declare const CHART_PALETTES: readonly [{
|
|
11
|
+
readonly key: "default";
|
|
12
|
+
readonly label: "默认蓝";
|
|
13
|
+
readonly colors: readonly ["#5470c6", "#91cc75", "#fac858", "#ee6666", "#73c0de"];
|
|
14
|
+
}, {
|
|
15
|
+
readonly key: "fresh";
|
|
16
|
+
readonly label: "清新绿";
|
|
17
|
+
readonly colors: readonly ["#2f9e6e", "#5cc9a7", "#9ad6c1", "#f2c94c", "#4a90e2"];
|
|
18
|
+
}, {
|
|
19
|
+
readonly key: "warm";
|
|
20
|
+
readonly label: "暖橙红";
|
|
21
|
+
readonly colors: readonly ["#f2704e", "#f7a35c", "#f7d56d", "#c54e3f", "#8f5a4a"];
|
|
22
|
+
}, {
|
|
23
|
+
readonly key: "purple";
|
|
24
|
+
readonly label: "紫灰";
|
|
25
|
+
readonly colors: readonly ["#7b61ff", "#9b8cff", "#c3baff", "#596275", "#8d99ae"];
|
|
26
|
+
}];
|
|
27
|
+
export type ChartPaletteKey = (typeof CHART_PALETTES)[number]['key'];
|
|
28
|
+
/** 设计态示例类目(模板态 $data 占位在无绑定数据时的替换值) */
|
|
29
|
+
export declare const FALLBACK_SAMPLE_CATEGORIES: readonly string[];
|
|
30
|
+
/**
|
|
31
|
+
* 漏斗图出厂内边距(%):ECharts 内置默认是 px(left/right 80、top 60、bottom 65),
|
|
32
|
+
* 小尺寸打印框里会把图形压到一半都不到。右侧留 25% 给外置标签与引导线,其余三边压到 5~6% 铺满。
|
|
33
|
+
*/
|
|
34
|
+
export declare const FUNNEL_PADDING_DEFAULTS: {
|
|
35
|
+
readonly top: 6;
|
|
36
|
+
readonly right: 25;
|
|
37
|
+
readonly bottom: 6;
|
|
38
|
+
readonly left: 5;
|
|
39
|
+
};
|
|
40
|
+
/** 漏斗图四边内边距(%),对应 ECharts funnel series 的 top/right/bottom/left */
|
|
41
|
+
export interface FunnelPadding {
|
|
42
|
+
top: number;
|
|
43
|
+
right: number;
|
|
44
|
+
bottom: number;
|
|
45
|
+
left: number;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* 雷达图出厂半径(%):ECharts 6 把 radar.radius 的默认值从 5.x 的 75% 调到 50%,
|
|
49
|
+
* 70×60mm 的元素框里图形直径只剩短边一半,四周空得厉害;回到 75% 与 5.x 观感一致。
|
|
50
|
+
*/
|
|
51
|
+
export declare const RADAR_RADIUS_DEFAULT = 75;
|
|
52
|
+
/** ECharts 内置雷达半径默认值(%),存量模板没写 radius 时面板按它回读 */
|
|
53
|
+
export declare const ECHARTS_RADAR_RADIUS_DEFAULT = 50;
|
|
54
|
+
/** ECharts 内置漏斗内边距默认值(px),存量模板没写时面板按当前元素框折算成百分比回读 */
|
|
55
|
+
export declare const ECHARTS_FUNNEL_PADDING_PX: {
|
|
56
|
+
readonly top: 60;
|
|
57
|
+
readonly right: 80;
|
|
58
|
+
readonly bottom: 65;
|
|
59
|
+
readonly left: 80;
|
|
60
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* @worm-print-platform/echarts v1.5.0
|
|
3
|
+
* Copyright (c) 2026 worm <liu_long_qqcom@qq.com>
|
|
4
|
+
* SPDX-FileCopyrightText: 2026 worm <liu_long_qqcom@qq.com>
|
|
5
|
+
* SPDX-License-Identifier: MIT
|
|
6
|
+
*/
|
|
7
|
+
/** 按 kind 生成出厂 option;series.type 与 kind 语义一致(折线图不会落成柱状图) */
|
|
8
|
+
export declare function createDefaultChartOption(type: string): Record<string, unknown>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* @worm-print-platform/echarts v1.5.0
|
|
3
|
+
* Copyright (c) 2026 worm <liu_long_qqcom@qq.com>
|
|
4
|
+
* SPDX-FileCopyrightText: 2026 worm <liu_long_qqcom@qq.com>
|
|
5
|
+
* SPDX-License-Identifier: MIT
|
|
6
|
+
*/
|
|
7
|
+
import * as echarts from 'echarts/core';
|
|
8
|
+
/**
|
|
9
|
+
* 追加 configureChartPlugin({ components }) 声明的图表/组件构造器(P5)。
|
|
10
|
+
* 惰性且幂等:未配置时零开销;改配置后下一次出图自动生效,无需重新注册插件。
|
|
11
|
+
*/
|
|
12
|
+
export declare function applyExtraComponents(): void;
|
|
13
|
+
export { echarts };
|
|
14
|
+
export type EChartsType = echarts.EChartsType;
|