ECharts 图表 echarts
将 ECharts 的配置项作为部件属性传入。用 width 和 height 指定容器尺寸,整数按像素处理,字符串保留 CSS 单位。默认尺寸为 100% × 100px。
php
echarts
(
set::height(400),
set::responsive(true),
set::xAxis(['type' => 'category', 'data' => ['周一', '周二', '周三']]),
set::yAxis(['type' => 'value']),
set::series([['type' => 'line', 'data' => [150, 230, 224]]])
);exts 支持数组或逗号分隔的字符串,内置 timeline 和 liquidfill 两个扩展别名。theme($value) 与 responsive($value = true) 也可用于链式设置。旧的 size() 方法在调试模式下会发出弃用提示。
属性
| 名称 | 类型 | 可选 | 声明默认值 | 说明 |
|---|---|---|---|---|
theme | stringarray | 是 | — | 主题 |
width | numberstring | 是 | "100%" | 宽度 |
height | numberstring | 是 | 100 | 高度 |
responsive | bool | 是 | — | 是否自适应 |
exts | stringarray | 是 | — | 插件 |