ECharts 样式:主题、调色盘与高亮状态
保留主题加载、JSON注册、全局/系列色板及显式样式,并核对6.x默认主题差异。
学完这一章,你能够
- 保留主题加载、JSON注册、全局/系列色板及显式样式,并核对6.x默认主题差异。
- 保留主题加载、JSON注册、全局/系列色板及显式样式,并核对6.x默认主题差异。
主题与加载顺序
主题在初始化时选择,dark可用于内置深色对照;6.x默认主题、图例位置及历史light路径发生变化,不能假定旧界面与新默认外观完全相同。需要保持旧风格时按官方迁移主题处理。
主题编辑器可生成JS或JSON。JS主题必须先注册再init;JSON需要先fetch并检查响应,然后registerTheme。本例使用本站自有主题文件分别演示两种路线;外部wonderland原脚本不执行,原资源状态另存。
历史主题编辑器的选色界面,位置对应主题生成与注册说明;原文件缺失待补。
色板和显式覆盖
option.color是全局色板;系列自己的color可覆写该系列的自动取色规则。部分系列按系列取色,另一些按数据项取色,不能由一串颜色推断每根柱都会不同。
itemStyle作用于图形,lineStyle用于线,areaStyle用于面积,label用于文字。更具体的数据项样式通常覆盖上级配置;本例单独显示色板和直接样式,再检查实际图元颜色及线宽。
普通、高亮、模糊及选择
emphasis可指定高亮时itemStyle和label,默认效果会受库版本与系列影响。现代状态使用emphasis/blur/select,旧normal或历史highlight/downplay样式对象需说明迁移。
真正触发高亮后再核对颜色和标签;设置emphasis不等于鼠标已经命中。主题截图若缺失仍保留原锚点,不用一张随意图片替换成原图成功。
配置与生命周期参考
| API/字段 | 输入与用途 | 返回/条件 |
|---|---|---|
| echarts.init(dom,theme,opts) | 有尺寸的DOM、主题和renderer等 | ECharts实例;主题先注册,渲染器先引入 |
| setOption(option,opts) | 普通或复合选项 | void;默认合并,notMerge/replaceMerge按目标设置 |
| getOption() | 读取合并状态 | 配置对象;含默认值,不宜随意整体写回 |
| resize(opts) | width/height等对象 | void;不是resize(宽,高)两个数 |
| on / off | 事件名、可选query及handler | 按事件接口注册/解绑,同函数引用 |
| dispatchAction(payload) | 动作type及目标字段 | 动作及事件不是鼠标回调一一映射 |
| showLoading / hideLoading | 加载状态及可选配置 | 网络成功失败取消都须对应处理 |
| dispose / isDisposed | 释放与状态 | 销毁后不能被旧异步结果更新 |
| getInstanceByDom | 已初始化容器 | 实例或undefined |
| convertToPixel / convertFromPixel | 坐标查询与数值 | 需匹配实际坐标系和系列 |
| title / tooltip / legend | 标题、细节、系列选择 | 名称及所属系列对应 |
| xAxis / yAxis / series | 轴与数据系列 | 类型、单位、索引均明确 |
本章字段及全部分支
| 字段 | 职责 | 条件 |
|---|---|---|
| init theme | 默认/dark/已注册名称 | 6.x默认与历史light不等同 |
| registerTheme | 名称及主题对象 | JS或fetch JSON先注册 |
| option.color | 全局自动色板 | 不保证每项都不同 |
| series.color | 当前系列色板 | 覆盖相应自动取色 |
| itemStyle / lineStyle / areaStyle / label | 形状/线/面积/文字 | 按系列支持范围 |
| data.itemStyle | 更具体样式 | 通常优先于系列 |
| emphasis / blur / select | 现代状态 | 旧normal/highlight/downplay分开迁移 |
本章独立核心源码与验证步骤
import * as echarts from 'echarts';
import {mount} from './lab.js';
import theme from './blue-sky-theme.js';
echarts.registerTheme('blue-sky-js',theme);
// 本章独立配置和实际运行共用;数值均为自有虚构数据。
const specification = {
"key": "echarts-style",
"title": "ECharts 样式:主题、调色盘与高亮状态",
"cases": [
{
"id": "style-default",
"title": "当前默认主题",
"option": {
"animation": false,
"title": {
"text": "蓝色天空网 · 虚构学习数据"
},
"tooltip": {
"trigger": "item"
},
"legend": {
"top": 35
},
"grid": {
"top": 90,
"bottom": 65,
"containLabel": true
},
"xAxis": {
"type": "category",
"data": [
"阅读",
"实作",
"复习",
"调试",
"整理",
"回顾"
]
},
"yAxis": {
"type": "value",
"name": "次数"
},
"series": [
{
"id": "study",
"name": "练习次数",
"type": "bar",
"data": [
12,
24,
18,
31,
22,
27
]
}
]
}
},
{
"id": "style-dark",
"title": "内置dark",
"option": {
"animation": false,
"title": {
"text": "蓝色天空网 · 虚构学习数据"
},
"tooltip": {
"trigger": "item"
},
"legend": {
"top": 35
},
"grid": {
"top": 90,
"bottom": 65,
"containLabel": true
},
"xAxis": {
"type": "category",
"data": [
"阅读",
"实作",
"复习",
"调试",
"整理",
"回顾"
]
},
"yAxis": {
"type": "value",
"name": "次数"
},
"series": [
{
"id": "study",
"name": "练习次数",
"type": "bar",
"data": [
12,
24,
18,
31,
22,
27
]
}
]
},
"theme": "dark"
},
{
"id": "style-js",
"title": "本站JS注册主题",
"option": {
"animation": false,
"title": {
"text": "蓝色天空网 · 虚构学习数据"
},
"tooltip": {
"trigger": "item"
},
"legend": {
"top": 35
},
"grid": {
"top": 90,
"bottom": 65,
"containLabel": true
},
"xAxis": {
"type": "category",
"data": [
"阅读",
"实作",
"复习",
"调试",
"整理",
"回顾"
]
},
"yAxis": {
"type": "value",
"name": "次数"
},
"series": [
{
"id": "study",
"name": "练习次数",
"type": "bar",
"data": [
12,
24,
18,
31,
22,
27
]
}
]
},
"theme": "blue-sky-js"
},
{
"id": "style-json",
"title": "本站JSON加载主题",
"option": {
"animation": false,
"title": {
"text": "蓝色天空网 · 虚构学习数据"
},
"tooltip": {
"trigger": "item"
},
"legend": {
"top": 35
},
"grid": {
"top": 90,
"bottom": 65,
"containLabel": true
},
"xAxis": {
"type": "category",
"data": [
"阅读",
"实作",
"复习",
"调试",
"整理",
"回顾"
]
},
"yAxis": {
"type": "value",
"name": "次数"
},
"series": [
{
"id": "study",
"name": "练习次数",
"type": "bar",
"data": [
12,
24,
18,
31,
22,
27
]
}
]
},
"theme": "blue-sky-json"
},
{
"id": "palette-global",
"title": "全局调色盘",
"option": {
"animation": false,
"title": {
"text": "蓝色天空网 · 学习构成"
},
"tooltip": {
"trigger": "item"
},
"legend": {
"bottom": 0
},
"series": [
{
"id": "composition",
"name": "学习构成",
"type": "pie",
"radius": "55%",
"center": [
"50%",
"50%"
],
"data": [
{
"name": "阅读",
"value": 12
},
{
"name": "实作",
"value": 24
},
{
"name": "复习",
"value": 18
},
{
"name": "调试",
"value": 31
},
{
"name": "整理",
"value": 22
}
]
}
],
"color": [
"#ff0000",
"#00aa00",
"#0000ff",
"#aa00aa",
"#00aaaa"
]
}
},
{
"id": "palette-series",
"title": "系列调色盘覆盖",
"option": {
"animation": false,
"title": {
"text": "蓝色天空网 · 学习构成"
},
"tooltip": {
"trigger": "item"
},
"legend": {
"bottom": 0
},
"series": [
{
"id": "composition",
"name": "学习构成",
"type": "pie",
"radius": "55%",
"center": [
"50%",
"50%"
],
"data": [
{
"name": "阅读",
"value": 12
},
{
"name": "实作",
"value": 24
},
{
"name": "复习",
"value": 18
},
{
"name": "调试",
"value": 31
},
{
"name": "整理",
"value": 22
}
],
"color": [
"#00aa00",
"#0000ff",
"#aa00aa",
"#00aaaa",
"#aaaa00"
]
}
],
"color": [
"#ff0000"
]
}
},
{
"id": "style-explicit",
"title": "数据项覆盖系列样式",
"option": {
"animation": false,
"title": {
"text": "蓝色天空网 · 虚构学习数据"
},
"tooltip": {
"trigger": "item"
},
"legend": {
"top": 35
},
"grid": {
"top": 90,
"bottom": 65,
"containLabel": true
},
"xAxis": {
"type": "category",
"data": [
"阅读",
"实作",
"复习",
"调试",
"整理",
"回顾"
]
},
"yAxis": {
"type": "value",
"name": "次数"
},
"series": [
{
"id": "study",
"name": "练习次数",
"type": "bar",
"data": [
{
"value": 12,
"itemStyle": {
"color": "#db2777"
}
},
24,
18,
31,
22,
27
],
"itemStyle": {
"color": "#2563eb",
"borderWidth": 2,
"borderColor": "#18283d"
}
}
]
}
},
{
"id": "style-line",
"title": "线、面积与文字样式",
"option": {
"animation": false,
"title": {
"text": "蓝色天空网 · 虚构学习数据"
},
"tooltip": {
"trigger": "item"
},
"legend": {
"top": 35
},
"grid": {
"top": 90,
"bottom": 65,
"containLabel": true
},
"xAxis": {
"type": "category",
"data": [
"阅读",
"实作",
"复习",
"调试",
"整理",
"回顾"
]
},
"yAxis": {
"type": "value",
"name": "次数"
},
"series": [
{
"id": "study",
"name": "练习次数",
"type": "line",
"data": [
12,
24,
18,
31,
22,
27
],
"lineStyle": {
"width": 4,
"color": "#2563eb"
},
"areaStyle": {
"color": "rgba(37,99,235,.2)"
},
"label": {
"show": true,
"color": "#18283d"
}
}
]
}
},
{
"id": "style-emphasis",
"title": "高亮样式",
"option": {
"animation": false,
"title": {
"text": "蓝色天空网 · 虚构学习数据"
},
"tooltip": {
"trigger": "item"
},
"legend": {
"top": 35
},
"grid": {
"top": 90,
"bottom": 65,
"containLabel": true
},
"xAxis": {
"type": "category",
"data": [
"阅读",
"实作",
"复习",
"调试",
"整理",
"回顾"
]
},
"yAxis": {
"type": "value",
"name": "次数"
},
"series": [
{
"id": "study",
"name": "练习次数",
"type": "bar",
"data": [
12,
24,
18,
31,
22,
27
],
"emphasis": {
"itemStyle": {
"color": "#ff0000"
},
"label": {
"show": true,
"formatter": "学习高亮"
}
}
}
]
}
}
]
};
export default async function run(){await mount(echarts,specification);}
所需环境:ECharts6.1.0 / Edge156.0.4314.58 / 自有同源数据与本地HTTP服务;实际程序化指针和动作
当前源码 SHA256:1ee684762aae5dbeae2b0348d1f18f8a4d1871632115d850f1fc1eea975d0232
- 本章所有变体真实渲染,实际图元和状态与本章教学条件对应
- 不同初始化、轴/数据编码、状态分支或媒体布局分别核对
- 定时器、请求及容器观察器在销毁后释放,不以模拟文字代替实际运行
内置dark:独立实例
import * as echarts from 'echarts';
import {mount} from './lab.js';
import theme from './blue-sky-theme.js';
echarts.registerTheme('blue-sky-js',theme);
// 本章独立配置和实际运行共用;数值均为自有虚构数据。
const specification = {
"key": "echarts-style",
"title": "ECharts 样式:主题、调色盘与高亮状态",
"cases": [
{
"id": "style-default",
"title": "当前默认主题",
"option": {
"animation": false,
"title": {
"text": "蓝色天空网 · 虚构学习数据"
},
"tooltip": {
"trigger": "item"
},
"legend": {
"top": 35
},
"grid": {
"top": 90,
"bottom": 65,
"containLabel": true
},
"xAxis": {
"type": "category",
"data": [
"阅读",
"实作",
"复习",
"调试",
"整理",
"回顾"
]
},
"yAxis": {
"type": "value",
"name": "次数"
},
"series": [
{
"id": "study",
"name": "练习次数",
"type": "bar",
"data": [
12,
24,
18,
31,
22,
27
]
}
]
}
},
{
"id": "style-dark",
"title": "内置dark",
"option": {
"animation": false,
"title": {
"text": "蓝色天空网 · 虚构学习数据"
},
"tooltip": {
"trigger": "item"
},
"legend": {
"top": 35
},
"grid": {
"top": 90,
"bottom": 65,
"containLabel": true
},
"xAxis": {
"type": "category",
"data": [
"阅读",
"实作",
"复习",
"调试",
"整理",
"回顾"
]
},
"yAxis": {
"type": "value",
"name": "次数"
},
"series": [
{
"id": "study",
"name": "练习次数",
"type": "bar",
"data": [
12,
24,
18,
31,
22,
27
]
}
]
},
"theme": "dark"
},
{
"id": "style-js",
"title": "本站JS注册主题",
"option": {
"animation": false,
"title": {
"text": "蓝色天空网 · 虚构学习数据"
},
"tooltip": {
"trigger": "item"
},
"legend": {
"top": 35
},
"grid": {
"top": 90,
"bottom": 65,
"containLabel": true
},
"xAxis": {
"type": "category",
"data": [
"阅读",
"实作",
"复习",
"调试",
"整理",
"回顾"
]
},
"yAxis": {
"type": "value",
"name": "次数"
},
"series": [
{
"id": "study",
"name": "练习次数",
"type": "bar",
"data": [
12,
24,
18,
31,
22,
27
]
}
]
},
"theme": "blue-sky-js"
},
{
"id": "style-json",
"title": "本站JSON加载主题",
"option": {
"animation": false,
"title": {
"text": "蓝色天空网 · 虚构学习数据"
},
"tooltip": {
"trigger": "item"
},
"legend": {
"top": 35
},
"grid": {
"top": 90,
"bottom": 65,
"containLabel": true
},
"xAxis": {
"type": "category",
"data": [
"阅读",
"实作",
"复习",
"调试",
"整理",
"回顾"
]
},
"yAxis": {
"type": "value",
"name": "次数"
},
"series": [
{
"id": "study",
"name": "练习次数",
"type": "bar",
"data": [
12,
24,
18,
31,
22,
27
]
}
]
},
"theme": "blue-sky-json"
},
{
"id": "palette-global",
"title": "全局调色盘",
"option": {
"animation": false,
"title": {
"text": "蓝色天空网 · 学习构成"
},
"tooltip": {
"trigger": "item"
},
"legend": {
"bottom": 0
},
"series": [
{
"id": "composition",
"name": "学习构成",
"type": "pie",
"radius": "55%",
"center": [
"50%",
"50%"
],
"data": [
{
"name": "阅读",
"value": 12
},
{
"name": "实作",
"value": 24
},
{
"name": "复习",
"value": 18
},
{
"name": "调试",
"value": 31
},
{
"name": "整理",
"value": 22
}
]
}
],
"color": [
"#ff0000",
"#00aa00",
"#0000ff",
"#aa00aa",
"#00aaaa"
]
}
},
{
"id": "palette-series",
"title": "系列调色盘覆盖",
"option": {
"animation": false,
"title": {
"text": "蓝色天空网 · 学习构成"
},
"tooltip": {
"trigger": "item"
},
"legend": {
"bottom": 0
},
"series": [
{
"id": "composition",
"name": "学习构成",
"type": "pie",
"radius": "55%",
"center": [
"50%",
"50%"
],
"data": [
{
"name": "阅读",
"value": 12
},
{
"name": "实作",
"value": 24
},
{
"name": "复习",
"value": 18
},
{
"name": "调试",
"value": 31
},
{
"name": "整理",
"value": 22
}
],
"color": [
"#00aa00",
"#0000ff",
"#aa00aa",
"#00aaaa",
"#aaaa00"
]
}
],
"color": [
"#ff0000"
]
}
},
{
"id": "style-explicit",
"title": "数据项覆盖系列样式",
"option": {
"animation": false,
"title": {
"text": "蓝色天空网 · 虚构学习数据"
},
"tooltip": {
"trigger": "item"
},
"legend": {
"top": 35
},
"grid": {
"top": 90,
"bottom": 65,
"containLabel": true
},
"xAxis": {
"type": "category",
"data": [
"阅读",
"实作",
"复习",
"调试",
"整理",
"回顾"
]
},
"yAxis": {
"type": "value",
"name": "次数"
},
"series": [
{
"id": "study",
"name": "练习次数",
"type": "bar",
"data": [
{
"value": 12,
"itemStyle": {
"color": "#db2777"
}
},
24,
18,
31,
22,
27
],
"itemStyle": {
"color": "#2563eb",
"borderWidth": 2,
"borderColor": "#18283d"
}
}
]
}
},
{
"id": "style-line",
"title": "线、面积与文字样式",
"option": {
"animation": false,
"title": {
"text": "蓝色天空网 · 虚构学习数据"
},
"tooltip": {
"trigger": "item"
},
"legend": {
"top": 35
},
"grid": {
"top": 90,
"bottom": 65,
"containLabel": true
},
"xAxis": {
"type": "category",
"data": [
"阅读",
"实作",
"复习",
"调试",
"整理",
"回顾"
]
},
"yAxis": {
"type": "value",
"name": "次数"
},
"series": [
{
"id": "study",
"name": "练习次数",
"type": "line",
"data": [
12,
24,
18,
31,
22,
27
],
"lineStyle": {
"width": 4,
"color": "#2563eb"
},
"areaStyle": {
"color": "rgba(37,99,235,.2)"
},
"label": {
"show": true,
"color": "#18283d"
}
}
]
}
},
{
"id": "style-emphasis",
"title": "高亮样式",
"option": {
"animation": false,
"title": {
"text": "蓝色天空网 · 虚构学习数据"
},
"tooltip": {
"trigger": "item"
},
"legend": {
"top": 35
},
"grid": {
"top": 90,
"bottom": 65,
"containLabel": true
},
"xAxis": {
"type": "category",
"data": [
"阅读",
"实作",
"复习",
"调试",
"整理",
"回顾"
]
},
"yAxis": {
"type": "value",
"name": "次数"
},
"series": [
{
"id": "study",
"name": "练习次数",
"type": "bar",
"data": [
12,
24,
18,
31,
22,
27
],
"emphasis": {
"itemStyle": {
"color": "#ff0000"
},
"label": {
"show": true,
"formatter": "学习高亮"
}
}
}
]
}
}
]
};
export default async function run(){await mount(echarts,specification);}
所需环境:ECharts6.1.0 / Edge156.0.4314.58 / 自有同源数据与本地HTTP服务;实际程序化指针和动作
当前源码 SHA256:1ee684762aae5dbeae2b0348d1f18f8a4d1871632115d850f1fc1eea975d0232
- 对应变体真实运行;其数据、图元、事件或状态独立记录
本站JS注册主题:独立实例
import * as echarts from 'echarts';
import {mount} from './lab.js';
import theme from './blue-sky-theme.js';
echarts.registerTheme('blue-sky-js',theme);
// 本章独立配置和实际运行共用;数值均为自有虚构数据。
const specification = {
"key": "echarts-style",
"title": "ECharts 样式:主题、调色盘与高亮状态",
"cases": [
{
"id": "style-default",
"title": "当前默认主题",
"option": {
"animation": false,
"title": {
"text": "蓝色天空网 · 虚构学习数据"
},
"tooltip": {
"trigger": "item"
},
"legend": {
"top": 35
},
"grid": {
"top": 90,
"bottom": 65,
"containLabel": true
},
"xAxis": {
"type": "category",
"data": [
"阅读",
"实作",
"复习",
"调试",
"整理",
"回顾"
]
},
"yAxis": {
"type": "value",
"name": "次数"
},
"series": [
{
"id": "study",
"name": "练习次数",
"type": "bar",
"data": [
12,
24,
18,
31,
22,
27
]
}
]
}
},
{
"id": "style-dark",
"title": "内置dark",
"option": {
"animation": false,
"title": {
"text": "蓝色天空网 · 虚构学习数据"
},
"tooltip": {
"trigger": "item"
},
"legend": {
"top": 35
},
"grid": {
"top": 90,
"bottom": 65,
"containLabel": true
},
"xAxis": {
"type": "category",
"data": [
"阅读",
"实作",
"复习",
"调试",
"整理",
"回顾"
]
},
"yAxis": {
"type": "value",
"name": "次数"
},
"series": [
{
"id": "study",
"name": "练习次数",
"type": "bar",
"data": [
12,
24,
18,
31,
22,
27
]
}
]
},
"theme": "dark"
},
{
"id": "style-js",
"title": "本站JS注册主题",
"option": {
"animation": false,
"title": {
"text": "蓝色天空网 · 虚构学习数据"
},
"tooltip": {
"trigger": "item"
},
"legend": {
"top": 35
},
"grid": {
"top": 90,
"bottom": 65,
"containLabel": true
},
"xAxis": {
"type": "category",
"data": [
"阅读",
"实作",
"复习",
"调试",
"整理",
"回顾"
]
},
"yAxis": {
"type": "value",
"name": "次数"
},
"series": [
{
"id": "study",
"name": "练习次数",
"type": "bar",
"data": [
12,
24,
18,
31,
22,
27
]
}
]
},
"theme": "blue-sky-js"
},
{
"id": "style-json",
"title": "本站JSON加载主题",
"option": {
"animation": false,
"title": {
"text": "蓝色天空网 · 虚构学习数据"
},
"tooltip": {
"trigger": "item"
},
"legend": {
"top": 35
},
"grid": {
"top": 90,
"bottom": 65,
"containLabel": true
},
"xAxis": {
"type": "category",
"data": [
"阅读",
"实作",
"复习",
"调试",
"整理",
"回顾"
]
},
"yAxis": {
"type": "value",
"name": "次数"
},
"series": [
{
"id": "study",
"name": "练习次数",
"type": "bar",
"data": [
12,
24,
18,
31,
22,
27
]
}
]
},
"theme": "blue-sky-json"
},
{
"id": "palette-global",
"title": "全局调色盘",
"option": {
"animation": false,
"title": {
"text": "蓝色天空网 · 学习构成"
},
"tooltip": {
"trigger": "item"
},
"legend": {
"bottom": 0
},
"series": [
{
"id": "composition",
"name": "学习构成",
"type": "pie",
"radius": "55%",
"center": [
"50%",
"50%"
],
"data": [
{
"name": "阅读",
"value": 12
},
{
"name": "实作",
"value": 24
},
{
"name": "复习",
"value": 18
},
{
"name": "调试",
"value": 31
},
{
"name": "整理",
"value": 22
}
]
}
],
"color": [
"#ff0000",
"#00aa00",
"#0000ff",
"#aa00aa",
"#00aaaa"
]
}
},
{
"id": "palette-series",
"title": "系列调色盘覆盖",
"option": {
"animation": false,
"title": {
"text": "蓝色天空网 · 学习构成"
},
"tooltip": {
"trigger": "item"
},
"legend": {
"bottom": 0
},
"series": [
{
"id": "composition",
"name": "学习构成",
"type": "pie",
"radius": "55%",
"center": [
"50%",
"50%"
],
"data": [
{
"name": "阅读",
"value": 12
},
{
"name": "实作",
"value": 24
},
{
"name": "复习",
"value": 18
},
{
"name": "调试",
"value": 31
},
{
"name": "整理",
"value": 22
}
],
"color": [
"#00aa00",
"#0000ff",
"#aa00aa",
"#00aaaa",
"#aaaa00"
]
}
],
"color": [
"#ff0000"
]
}
},
{
"id": "style-explicit",
"title": "数据项覆盖系列样式",
"option": {
"animation": false,
"title": {
"text": "蓝色天空网 · 虚构学习数据"
},
"tooltip": {
"trigger": "item"
},
"legend": {
"top": 35
},
"grid": {
"top": 90,
"bottom": 65,
"containLabel": true
},
"xAxis": {
"type": "category",
"data": [
"阅读",
"实作",
"复习",
"调试",
"整理",
"回顾"
]
},
"yAxis": {
"type": "value",
"name": "次数"
},
"series": [
{
"id": "study",
"name": "练习次数",
"type": "bar",
"data": [
{
"value": 12,
"itemStyle": {
"color": "#db2777"
}
},
24,
18,
31,
22,
27
],
"itemStyle": {
"color": "#2563eb",
"borderWidth": 2,
"borderColor": "#18283d"
}
}
]
}
},
{
"id": "style-line",
"title": "线、面积与文字样式",
"option": {
"animation": false,
"title": {
"text": "蓝色天空网 · 虚构学习数据"
},
"tooltip": {
"trigger": "item"
},
"legend": {
"top": 35
},
"grid": {
"top": 90,
"bottom": 65,
"containLabel": true
},
"xAxis": {
"type": "category",
"data": [
"阅读",
"实作",
"复习",
"调试",
"整理",
"回顾"
]
},
"yAxis": {
"type": "value",
"name": "次数"
},
"series": [
{
"id": "study",
"name": "练习次数",
"type": "line",
"data": [
12,
24,
18,
31,
22,
27
],
"lineStyle": {
"width": 4,
"color": "#2563eb"
},
"areaStyle": {
"color": "rgba(37,99,235,.2)"
},
"label": {
"show": true,
"color": "#18283d"
}
}
]
}
},
{
"id": "style-emphasis",
"title": "高亮样式",
"option": {
"animation": false,
"title": {
"text": "蓝色天空网 · 虚构学习数据"
},
"tooltip": {
"trigger": "item"
},
"legend": {
"top": 35
},
"grid": {
"top": 90,
"bottom": 65,
"containLabel": true
},
"xAxis": {
"type": "category",
"data": [
"阅读",
"实作",
"复习",
"调试",
"整理",
"回顾"
]
},
"yAxis": {
"type": "value",
"name": "次数"
},
"series": [
{
"id": "study",
"name": "练习次数",
"type": "bar",
"data": [
12,
24,
18,
31,
22,
27
],
"emphasis": {
"itemStyle": {
"color": "#ff0000"
},
"label": {
"show": true,
"formatter": "学习高亮"
}
}
}
]
}
}
]
};
export default async function run(){await mount(echarts,specification);}
所需环境:ECharts6.1.0 / Edge156.0.4314.58 / 自有同源数据与本地HTTP服务;实际程序化指针和动作
当前源码 SHA256:1ee684762aae5dbeae2b0348d1f18f8a4d1871632115d850f1fc1eea975d0232
- 对应变体真实运行;其数据、图元、事件或状态独立记录
本站JSON加载主题:独立实例
import * as echarts from 'echarts';
import {mount} from './lab.js';
import theme from './blue-sky-theme.js';
echarts.registerTheme('blue-sky-js',theme);
// 本章独立配置和实际运行共用;数值均为自有虚构数据。
const specification = {
"key": "echarts-style",
"title": "ECharts 样式:主题、调色盘与高亮状态",
"cases": [
{
"id": "style-default",
"title": "当前默认主题",
"option": {
"animation": false,
"title": {
"text": "蓝色天空网 · 虚构学习数据"
},
"tooltip": {
"trigger": "item"
},
"legend": {
"top": 35
},
"grid": {
"top": 90,
"bottom": 65,
"containLabel": true
},
"xAxis": {
"type": "category",
"data": [
"阅读",
"实作",
"复习",
"调试",
"整理",
"回顾"
]
},
"yAxis": {
"type": "value",
"name": "次数"
},
"series": [
{
"id": "study",
"name": "练习次数",
"type": "bar",
"data": [
12,
24,
18,
31,
22,
27
]
}
]
}
},
{
"id": "style-dark",
"title": "内置dark",
"option": {
"animation": false,
"title": {
"text": "蓝色天空网 · 虚构学习数据"
},
"tooltip": {
"trigger": "item"
},
"legend": {
"top": 35
},
"grid": {
"top": 90,
"bottom": 65,
"containLabel": true
},
"xAxis": {
"type": "category",
"data": [
"阅读",
"实作",
"复习",
"调试",
"整理",
"回顾"
]
},
"yAxis": {
"type": "value",
"name": "次数"
},
"series": [
{
"id": "study",
"name": "练习次数",
"type": "bar",
"data": [
12,
24,
18,
31,
22,
27
]
}
]
},
"theme": "dark"
},
{
"id": "style-js",
"title": "本站JS注册主题",
"option": {
"animation": false,
"title": {
"text": "蓝色天空网 · 虚构学习数据"
},
"tooltip": {
"trigger": "item"
},
"legend": {
"top": 35
},
"grid": {
"top": 90,
"bottom": 65,
"containLabel": true
},
"xAxis": {
"type": "category",
"data": [
"阅读",
"实作",
"复习",
"调试",
"整理",
"回顾"
]
},
"yAxis": {
"type": "value",
"name": "次数"
},
"series": [
{
"id": "study",
"name": "练习次数",
"type": "bar",
"data": [
12,
24,
18,
31,
22,
27
]
}
]
},
"theme": "blue-sky-js"
},
{
"id": "style-json",
"title": "本站JSON加载主题",
"option": {
"animation": false,
"title": {
"text": "蓝色天空网 · 虚构学习数据"
},
"tooltip": {
"trigger": "item"
},
"legend": {
"top": 35
},
"grid": {
"top": 90,
"bottom": 65,
"containLabel": true
},
"xAxis": {
"type": "category",
"data": [
"阅读",
"实作",
"复习",
"调试",
"整理",
"回顾"
]
},
"yAxis": {
"type": "value",
"name": "次数"
},
"series": [
{
"id": "study",
"name": "练习次数",
"type": "bar",
"data": [
12,
24,
18,
31,
22,
27
]
}
]
},
"theme": "blue-sky-json"
},
{
"id": "palette-global",
"title": "全局调色盘",
"option": {
"animation": false,
"title": {
"text": "蓝色天空网 · 学习构成"
},
"tooltip": {
"trigger": "item"
},
"legend": {
"bottom": 0
},
"series": [
{
"id": "composition",
"name": "学习构成",
"type": "pie",
"radius": "55%",
"center": [
"50%",
"50%"
],
"data": [
{
"name": "阅读",
"value": 12
},
{
"name": "实作",
"value": 24
},
{
"name": "复习",
"value": 18
},
{
"name": "调试",
"value": 31
},
{
"name": "整理",
"value": 22
}
]
}
],
"color": [
"#ff0000",
"#00aa00",
"#0000ff",
"#aa00aa",
"#00aaaa"
]
}
},
{
"id": "palette-series",
"title": "系列调色盘覆盖",
"option": {
"animation": false,
"title": {
"text": "蓝色天空网 · 学习构成"
},
"tooltip": {
"trigger": "item"
},
"legend": {
"bottom": 0
},
"series": [
{
"id": "composition",
"name": "学习构成",
"type": "pie",
"radius": "55%",
"center": [
"50%",
"50%"
],
"data": [
{
"name": "阅读",
"value": 12
},
{
"name": "实作",
"value": 24
},
{
"name": "复习",
"value": 18
},
{
"name": "调试",
"value": 31
},
{
"name": "整理",
"value": 22
}
],
"color": [
"#00aa00",
"#0000ff",
"#aa00aa",
"#00aaaa",
"#aaaa00"
]
}
],
"color": [
"#ff0000"
]
}
},
{
"id": "style-explicit",
"title": "数据项覆盖系列样式",
"option": {
"animation": false,
"title": {
"text": "蓝色天空网 · 虚构学习数据"
},
"tooltip": {
"trigger": "item"
},
"legend": {
"top": 35
},
"grid": {
"top": 90,
"bottom": 65,
"containLabel": true
},
"xAxis": {
"type": "category",
"data": [
"阅读",
"实作",
"复习",
"调试",
"整理",
"回顾"
]
},
"yAxis": {
"type": "value",
"name": "次数"
},
"series": [
{
"id": "study",
"name": "练习次数",
"type": "bar",
"data": [
{
"value": 12,
"itemStyle": {
"color": "#db2777"
}
},
24,
18,
31,
22,
27
],
"itemStyle": {
"color": "#2563eb",
"borderWidth": 2,
"borderColor": "#18283d"
}
}
]
}
},
{
"id": "style-line",
"title": "线、面积与文字样式",
"option": {
"animation": false,
"title": {
"text": "蓝色天空网 · 虚构学习数据"
},
"tooltip": {
"trigger": "item"
},
"legend": {
"top": 35
},
"grid": {
"top": 90,
"bottom": 65,
"containLabel": true
},
"xAxis": {
"type": "category",
"data": [
"阅读",
"实作",
"复习",
"调试",
"整理",
"回顾"
]
},
"yAxis": {
"type": "value",
"name": "次数"
},
"series": [
{
"id": "study",
"name": "练习次数",
"type": "line",
"data": [
12,
24,
18,
31,
22,
27
],
"lineStyle": {
"width": 4,
"color": "#2563eb"
},
"areaStyle": {
"color": "rgba(37,99,235,.2)"
},
"label": {
"show": true,
"color": "#18283d"
}
}
]
}
},
{
"id": "style-emphasis",
"title": "高亮样式",
"option": {
"animation": false,
"title": {
"text": "蓝色天空网 · 虚构学习数据"
},
"tooltip": {
"trigger": "item"
},
"legend": {
"top": 35
},
"grid": {
"top": 90,
"bottom": 65,
"containLabel": true
},
"xAxis": {
"type": "category",
"data": [
"阅读",
"实作",
"复习",
"调试",
"整理",
"回顾"
]
},
"yAxis": {
"type": "value",
"name": "次数"
},
"series": [
{
"id": "study",
"name": "练习次数",
"type": "bar",
"data": [
12,
24,
18,
31,
22,
27
],
"emphasis": {
"itemStyle": {
"color": "#ff0000"
},
"label": {
"show": true,
"formatter": "学习高亮"
}
}
}
]
}
}
]
};
export default async function run(){await mount(echarts,specification);}
所需环境:ECharts6.1.0 / Edge156.0.4314.58 / 自有同源数据与本地HTTP服务;实际程序化指针和动作
当前源码 SHA256:1ee684762aae5dbeae2b0348d1f18f8a4d1871632115d850f1fc1eea975d0232
- 对应变体真实运行;其数据、图元、事件或状态独立记录
全局调色盘:独立实例
import * as echarts from 'echarts';
import {mount} from './lab.js';
import theme from './blue-sky-theme.js';
echarts.registerTheme('blue-sky-js',theme);
// 本章独立配置和实际运行共用;数值均为自有虚构数据。
const specification = {
"key": "echarts-style",
"title": "ECharts 样式:主题、调色盘与高亮状态",
"cases": [
{
"id": "style-default",
"title": "当前默认主题",
"option": {
"animation": false,
"title": {
"text": "蓝色天空网 · 虚构学习数据"
},
"tooltip": {
"trigger": "item"
},
"legend": {
"top": 35
},
"grid": {
"top": 90,
"bottom": 65,
"containLabel": true
},
"xAxis": {
"type": "category",
"data": [
"阅读",
"实作",
"复习",
"调试",
"整理",
"回顾"
]
},
"yAxis": {
"type": "value",
"name": "次数"
},
"series": [
{
"id": "study",
"name": "练习次数",
"type": "bar",
"data": [
12,
24,
18,
31,
22,
27
]
}
]
}
},
{
"id": "style-dark",
"title": "内置dark",
"option": {
"animation": false,
"title": {
"text": "蓝色天空网 · 虚构学习数据"
},
"tooltip": {
"trigger": "item"
},
"legend": {
"top": 35
},
"grid": {
"top": 90,
"bottom": 65,
"containLabel": true
},
"xAxis": {
"type": "category",
"data": [
"阅读",
"实作",
"复习",
"调试",
"整理",
"回顾"
]
},
"yAxis": {
"type": "value",
"name": "次数"
},
"series": [
{
"id": "study",
"name": "练习次数",
"type": "bar",
"data": [
12,
24,
18,
31,
22,
27
]
}
]
},
"theme": "dark"
},
{
"id": "style-js",
"title": "本站JS注册主题",
"option": {
"animation": false,
"title": {
"text": "蓝色天空网 · 虚构学习数据"
},
"tooltip": {
"trigger": "item"
},
"legend": {
"top": 35
},
"grid": {
"top": 90,
"bottom": 65,
"containLabel": true
},
"xAxis": {
"type": "category",
"data": [
"阅读",
"实作",
"复习",
"调试",
"整理",
"回顾"
]
},
"yAxis": {
"type": "value",
"name": "次数"
},
"series": [
{
"id": "study",
"name": "练习次数",
"type": "bar",
"data": [
12,
24,
18,
31,
22,
27
]
}
]
},
"theme": "blue-sky-js"
},
{
"id": "style-json",
"title": "本站JSON加载主题",
"option": {
"animation": false,
"title": {
"text": "蓝色天空网 · 虚构学习数据"
},
"tooltip": {
"trigger": "item"
},
"legend": {
"top": 35
},
"grid": {
"top": 90,
"bottom": 65,
"containLabel": true
},
"xAxis": {
"type": "category",
"data": [
"阅读",
"实作",
"复习",
"调试",
"整理",
"回顾"
]
},
"yAxis": {
"type": "value",
"name": "次数"
},
"series": [
{
"id": "study",
"name": "练习次数",
"type": "bar",
"data": [
12,
24,
18,
31,
22,
27
]
}
]
},
"theme": "blue-sky-json"
},
{
"id": "palette-global",
"title": "全局调色盘",
"option": {
"animation": false,
"title": {
"text": "蓝色天空网 · 学习构成"
},
"tooltip": {
"trigger": "item"
},
"legend": {
"bottom": 0
},
"series": [
{
"id": "composition",
"name": "学习构成",
"type": "pie",
"radius": "55%",
"center": [
"50%",
"50%"
],
"data": [
{
"name": "阅读",
"value": 12
},
{
"name": "实作",
"value": 24
},
{
"name": "复习",
"value": 18
},
{
"name": "调试",
"value": 31
},
{
"name": "整理",
"value": 22
}
]
}
],
"color": [
"#ff0000",
"#00aa00",
"#0000ff",
"#aa00aa",
"#00aaaa"
]
}
},
{
"id": "palette-series",
"title": "系列调色盘覆盖",
"option": {
"animation": false,
"title": {
"text": "蓝色天空网 · 学习构成"
},
"tooltip": {
"trigger": "item"
},
"legend": {
"bottom": 0
},
"series": [
{
"id": "composition",
"name": "学习构成",
"type": "pie",
"radius": "55%",
"center": [
"50%",
"50%"
],
"data": [
{
"name": "阅读",
"value": 12
},
{
"name": "实作",
"value": 24
},
{
"name": "复习",
"value": 18
},
{
"name": "调试",
"value": 31
},
{
"name": "整理",
"value": 22
}
],
"color": [
"#00aa00",
"#0000ff",
"#aa00aa",
"#00aaaa",
"#aaaa00"
]
}
],
"color": [
"#ff0000"
]
}
},
{
"id": "style-explicit",
"title": "数据项覆盖系列样式",
"option": {
"animation": false,
"title": {
"text": "蓝色天空网 · 虚构学习数据"
},
"tooltip": {
"trigger": "item"
},
"legend": {
"top": 35
},
"grid": {
"top": 90,
"bottom": 65,
"containLabel": true
},
"xAxis": {
"type": "category",
"data": [
"阅读",
"实作",
"复习",
"调试",
"整理",
"回顾"
]
},
"yAxis": {
"type": "value",
"name": "次数"
},
"series": [
{
"id": "study",
"name": "练习次数",
"type": "bar",
"data": [
{
"value": 12,
"itemStyle": {
"color": "#db2777"
}
},
24,
18,
31,
22,
27
],
"itemStyle": {
"color": "#2563eb",
"borderWidth": 2,
"borderColor": "#18283d"
}
}
]
}
},
{
"id": "style-line",
"title": "线、面积与文字样式",
"option": {
"animation": false,
"title": {
"text": "蓝色天空网 · 虚构学习数据"
},
"tooltip": {
"trigger": "item"
},
"legend": {
"top": 35
},
"grid": {
"top": 90,
"bottom": 65,
"containLabel": true
},
"xAxis": {
"type": "category",
"data": [
"阅读",
"实作",
"复习",
"调试",
"整理",
"回顾"
]
},
"yAxis": {
"type": "value",
"name": "次数"
},
"series": [
{
"id": "study",
"name": "练习次数",
"type": "line",
"data": [
12,
24,
18,
31,
22,
27
],
"lineStyle": {
"width": 4,
"color": "#2563eb"
},
"areaStyle": {
"color": "rgba(37,99,235,.2)"
},
"label": {
"show": true,
"color": "#18283d"
}
}
]
}
},
{
"id": "style-emphasis",
"title": "高亮样式",
"option": {
"animation": false,
"title": {
"text": "蓝色天空网 · 虚构学习数据"
},
"tooltip": {
"trigger": "item"
},
"legend": {
"top": 35
},
"grid": {
"top": 90,
"bottom": 65,
"containLabel": true
},
"xAxis": {
"type": "category",
"data": [
"阅读",
"实作",
"复习",
"调试",
"整理",
"回顾"
]
},
"yAxis": {
"type": "value",
"name": "次数"
},
"series": [
{
"id": "study",
"name": "练习次数",
"type": "bar",
"data": [
12,
24,
18,
31,
22,
27
],
"emphasis": {
"itemStyle": {
"color": "#ff0000"
},
"label": {
"show": true,
"formatter": "学习高亮"
}
}
}
]
}
}
]
};
export default async function run(){await mount(echarts,specification);}
所需环境:ECharts6.1.0 / Edge156.0.4314.58 / 自有同源数据与本地HTTP服务;实际程序化指针和动作
当前源码 SHA256:1ee684762aae5dbeae2b0348d1f18f8a4d1871632115d850f1fc1eea975d0232
- 对应变体真实运行;其数据、图元、事件或状态独立记录
系列调色盘覆盖:独立实例
import * as echarts from 'echarts';
import {mount} from './lab.js';
import theme from './blue-sky-theme.js';
echarts.registerTheme('blue-sky-js',theme);
// 本章独立配置和实际运行共用;数值均为自有虚构数据。
const specification = {
"key": "echarts-style",
"title": "ECharts 样式:主题、调色盘与高亮状态",
"cases": [
{
"id": "style-default",
"title": "当前默认主题",
"option": {
"animation": false,
"title": {
"text": "蓝色天空网 · 虚构学习数据"
},
"tooltip": {
"trigger": "item"
},
"legend": {
"top": 35
},
"grid": {
"top": 90,
"bottom": 65,
"containLabel": true
},
"xAxis": {
"type": "category",
"data": [
"阅读",
"实作",
"复习",
"调试",
"整理",
"回顾"
]
},
"yAxis": {
"type": "value",
"name": "次数"
},
"series": [
{
"id": "study",
"name": "练习次数",
"type": "bar",
"data": [
12,
24,
18,
31,
22,
27
]
}
]
}
},
{
"id": "style-dark",
"title": "内置dark",
"option": {
"animation": false,
"title": {
"text": "蓝色天空网 · 虚构学习数据"
},
"tooltip": {
"trigger": "item"
},
"legend": {
"top": 35
},
"grid": {
"top": 90,
"bottom": 65,
"containLabel": true
},
"xAxis": {
"type": "category",
"data": [
"阅读",
"实作",
"复习",
"调试",
"整理",
"回顾"
]
},
"yAxis": {
"type": "value",
"name": "次数"
},
"series": [
{
"id": "study",
"name": "练习次数",
"type": "bar",
"data": [
12,
24,
18,
31,
22,
27
]
}
]
},
"theme": "dark"
},
{
"id": "style-js",
"title": "本站JS注册主题",
"option": {
"animation": false,
"title": {
"text": "蓝色天空网 · 虚构学习数据"
},
"tooltip": {
"trigger": "item"
},
"legend": {
"top": 35
},
"grid": {
"top": 90,
"bottom": 65,
"containLabel": true
},
"xAxis": {
"type": "category",
"data": [
"阅读",
"实作",
"复习",
"调试",
"整理",
"回顾"
]
},
"yAxis": {
"type": "value",
"name": "次数"
},
"series": [
{
"id": "study",
"name": "练习次数",
"type": "bar",
"data": [
12,
24,
18,
31,
22,
27
]
}
]
},
"theme": "blue-sky-js"
},
{
"id": "style-json",
"title": "本站JSON加载主题",
"option": {
"animation": false,
"title": {
"text": "蓝色天空网 · 虚构学习数据"
},
"tooltip": {
"trigger": "item"
},
"legend": {
"top": 35
},
"grid": {
"top": 90,
"bottom": 65,
"containLabel": true
},
"xAxis": {
"type": "category",
"data": [
"阅读",
"实作",
"复习",
"调试",
"整理",
"回顾"
]
},
"yAxis": {
"type": "value",
"name": "次数"
},
"series": [
{
"id": "study",
"name": "练习次数",
"type": "bar",
"data": [
12,
24,
18,
31,
22,
27
]
}
]
},
"theme": "blue-sky-json"
},
{
"id": "palette-global",
"title": "全局调色盘",
"option": {
"animation": false,
"title": {
"text": "蓝色天空网 · 学习构成"
},
"tooltip": {
"trigger": "item"
},
"legend": {
"bottom": 0
},
"series": [
{
"id": "composition",
"name": "学习构成",
"type": "pie",
"radius": "55%",
"center": [
"50%",
"50%"
],
"data": [
{
"name": "阅读",
"value": 12
},
{
"name": "实作",
"value": 24
},
{
"name": "复习",
"value": 18
},
{
"name": "调试",
"value": 31
},
{
"name": "整理",
"value": 22
}
]
}
],
"color": [
"#ff0000",
"#00aa00",
"#0000ff",
"#aa00aa",
"#00aaaa"
]
}
},
{
"id": "palette-series",
"title": "系列调色盘覆盖",
"option": {
"animation": false,
"title": {
"text": "蓝色天空网 · 学习构成"
},
"tooltip": {
"trigger": "item"
},
"legend": {
"bottom": 0
},
"series": [
{
"id": "composition",
"name": "学习构成",
"type": "pie",
"radius": "55%",
"center": [
"50%",
"50%"
],
"data": [
{
"name": "阅读",
"value": 12
},
{
"name": "实作",
"value": 24
},
{
"name": "复习",
"value": 18
},
{
"name": "调试",
"value": 31
},
{
"name": "整理",
"value": 22
}
],
"color": [
"#00aa00",
"#0000ff",
"#aa00aa",
"#00aaaa",
"#aaaa00"
]
}
],
"color": [
"#ff0000"
]
}
},
{
"id": "style-explicit",
"title": "数据项覆盖系列样式",
"option": {
"animation": false,
"title": {
"text": "蓝色天空网 · 虚构学习数据"
},
"tooltip": {
"trigger": "item"
},
"legend": {
"top": 35
},
"grid": {
"top": 90,
"bottom": 65,
"containLabel": true
},
"xAxis": {
"type": "category",
"data": [
"阅读",
"实作",
"复习",
"调试",
"整理",
"回顾"
]
},
"yAxis": {
"type": "value",
"name": "次数"
},
"series": [
{
"id": "study",
"name": "练习次数",
"type": "bar",
"data": [
{
"value": 12,
"itemStyle": {
"color": "#db2777"
}
},
24,
18,
31,
22,
27
],
"itemStyle": {
"color": "#2563eb",
"borderWidth": 2,
"borderColor": "#18283d"
}
}
]
}
},
{
"id": "style-line",
"title": "线、面积与文字样式",
"option": {
"animation": false,
"title": {
"text": "蓝色天空网 · 虚构学习数据"
},
"tooltip": {
"trigger": "item"
},
"legend": {
"top": 35
},
"grid": {
"top": 90,
"bottom": 65,
"containLabel": true
},
"xAxis": {
"type": "category",
"data": [
"阅读",
"实作",
"复习",
"调试",
"整理",
"回顾"
]
},
"yAxis": {
"type": "value",
"name": "次数"
},
"series": [
{
"id": "study",
"name": "练习次数",
"type": "line",
"data": [
12,
24,
18,
31,
22,
27
],
"lineStyle": {
"width": 4,
"color": "#2563eb"
},
"areaStyle": {
"color": "rgba(37,99,235,.2)"
},
"label": {
"show": true,
"color": "#18283d"
}
}
]
}
},
{
"id": "style-emphasis",
"title": "高亮样式",
"option": {
"animation": false,
"title": {
"text": "蓝色天空网 · 虚构学习数据"
},
"tooltip": {
"trigger": "item"
},
"legend": {
"top": 35
},
"grid": {
"top": 90,
"bottom": 65,
"containLabel": true
},
"xAxis": {
"type": "category",
"data": [
"阅读",
"实作",
"复习",
"调试",
"整理",
"回顾"
]
},
"yAxis": {
"type": "value",
"name": "次数"
},
"series": [
{
"id": "study",
"name": "练习次数",
"type": "bar",
"data": [
12,
24,
18,
31,
22,
27
],
"emphasis": {
"itemStyle": {
"color": "#ff0000"
},
"label": {
"show": true,
"formatter": "学习高亮"
}
}
}
]
}
}
]
};
export default async function run(){await mount(echarts,specification);}
所需环境:ECharts6.1.0 / Edge156.0.4314.58 / 自有同源数据与本地HTTP服务;实际程序化指针和动作
当前源码 SHA256:1ee684762aae5dbeae2b0348d1f18f8a4d1871632115d850f1fc1eea975d0232
- 对应变体真实运行;其数据、图元、事件或状态独立记录
数据项覆盖系列样式:独立实例
import * as echarts from 'echarts';
import {mount} from './lab.js';
import theme from './blue-sky-theme.js';
echarts.registerTheme('blue-sky-js',theme);
// 本章独立配置和实际运行共用;数值均为自有虚构数据。
const specification = {
"key": "echarts-style",
"title": "ECharts 样式:主题、调色盘与高亮状态",
"cases": [
{
"id": "style-default",
"title": "当前默认主题",
"option": {
"animation": false,
"title": {
"text": "蓝色天空网 · 虚构学习数据"
},
"tooltip": {
"trigger": "item"
},
"legend": {
"top": 35
},
"grid": {
"top": 90,
"bottom": 65,
"containLabel": true
},
"xAxis": {
"type": "category",
"data": [
"阅读",
"实作",
"复习",
"调试",
"整理",
"回顾"
]
},
"yAxis": {
"type": "value",
"name": "次数"
},
"series": [
{
"id": "study",
"name": "练习次数",
"type": "bar",
"data": [
12,
24,
18,
31,
22,
27
]
}
]
}
},
{
"id": "style-dark",
"title": "内置dark",
"option": {
"animation": false,
"title": {
"text": "蓝色天空网 · 虚构学习数据"
},
"tooltip": {
"trigger": "item"
},
"legend": {
"top": 35
},
"grid": {
"top": 90,
"bottom": 65,
"containLabel": true
},
"xAxis": {
"type": "category",
"data": [
"阅读",
"实作",
"复习",
"调试",
"整理",
"回顾"
]
},
"yAxis": {
"type": "value",
"name": "次数"
},
"series": [
{
"id": "study",
"name": "练习次数",
"type": "bar",
"data": [
12,
24,
18,
31,
22,
27
]
}
]
},
"theme": "dark"
},
{
"id": "style-js",
"title": "本站JS注册主题",
"option": {
"animation": false,
"title": {
"text": "蓝色天空网 · 虚构学习数据"
},
"tooltip": {
"trigger": "item"
},
"legend": {
"top": 35
},
"grid": {
"top": 90,
"bottom": 65,
"containLabel": true
},
"xAxis": {
"type": "category",
"data": [
"阅读",
"实作",
"复习",
"调试",
"整理",
"回顾"
]
},
"yAxis": {
"type": "value",
"name": "次数"
},
"series": [
{
"id": "study",
"name": "练习次数",
"type": "bar",
"data": [
12,
24,
18,
31,
22,
27
]
}
]
},
"theme": "blue-sky-js"
},
{
"id": "style-json",
"title": "本站JSON加载主题",
"option": {
"animation": false,
"title": {
"text": "蓝色天空网 · 虚构学习数据"
},
"tooltip": {
"trigger": "item"
},
"legend": {
"top": 35
},
"grid": {
"top": 90,
"bottom": 65,
"containLabel": true
},
"xAxis": {
"type": "category",
"data": [
"阅读",
"实作",
"复习",
"调试",
"整理",
"回顾"
]
},
"yAxis": {
"type": "value",
"name": "次数"
},
"series": [
{
"id": "study",
"name": "练习次数",
"type": "bar",
"data": [
12,
24,
18,
31,
22,
27
]
}
]
},
"theme": "blue-sky-json"
},
{
"id": "palette-global",
"title": "全局调色盘",
"option": {
"animation": false,
"title": {
"text": "蓝色天空网 · 学习构成"
},
"tooltip": {
"trigger": "item"
},
"legend": {
"bottom": 0
},
"series": [
{
"id": "composition",
"name": "学习构成",
"type": "pie",
"radius": "55%",
"center": [
"50%",
"50%"
],
"data": [
{
"name": "阅读",
"value": 12
},
{
"name": "实作",
"value": 24
},
{
"name": "复习",
"value": 18
},
{
"name": "调试",
"value": 31
},
{
"name": "整理",
"value": 22
}
]
}
],
"color": [
"#ff0000",
"#00aa00",
"#0000ff",
"#aa00aa",
"#00aaaa"
]
}
},
{
"id": "palette-series",
"title": "系列调色盘覆盖",
"option": {
"animation": false,
"title": {
"text": "蓝色天空网 · 学习构成"
},
"tooltip": {
"trigger": "item"
},
"legend": {
"bottom": 0
},
"series": [
{
"id": "composition",
"name": "学习构成",
"type": "pie",
"radius": "55%",
"center": [
"50%",
"50%"
],
"data": [
{
"name": "阅读",
"value": 12
},
{
"name": "实作",
"value": 24
},
{
"name": "复习",
"value": 18
},
{
"name": "调试",
"value": 31
},
{
"name": "整理",
"value": 22
}
],
"color": [
"#00aa00",
"#0000ff",
"#aa00aa",
"#00aaaa",
"#aaaa00"
]
}
],
"color": [
"#ff0000"
]
}
},
{
"id": "style-explicit",
"title": "数据项覆盖系列样式",
"option": {
"animation": false,
"title": {
"text": "蓝色天空网 · 虚构学习数据"
},
"tooltip": {
"trigger": "item"
},
"legend": {
"top": 35
},
"grid": {
"top": 90,
"bottom": 65,
"containLabel": true
},
"xAxis": {
"type": "category",
"data": [
"阅读",
"实作",
"复习",
"调试",
"整理",
"回顾"
]
},
"yAxis": {
"type": "value",
"name": "次数"
},
"series": [
{
"id": "study",
"name": "练习次数",
"type": "bar",
"data": [
{
"value": 12,
"itemStyle": {
"color": "#db2777"
}
},
24,
18,
31,
22,
27
],
"itemStyle": {
"color": "#2563eb",
"borderWidth": 2,
"borderColor": "#18283d"
}
}
]
}
},
{
"id": "style-line",
"title": "线、面积与文字样式",
"option": {
"animation": false,
"title": {
"text": "蓝色天空网 · 虚构学习数据"
},
"tooltip": {
"trigger": "item"
},
"legend": {
"top": 35
},
"grid": {
"top": 90,
"bottom": 65,
"containLabel": true
},
"xAxis": {
"type": "category",
"data": [
"阅读",
"实作",
"复习",
"调试",
"整理",
"回顾"
]
},
"yAxis": {
"type": "value",
"name": "次数"
},
"series": [
{
"id": "study",
"name": "练习次数",
"type": "line",
"data": [
12,
24,
18,
31,
22,
27
],
"lineStyle": {
"width": 4,
"color": "#2563eb"
},
"areaStyle": {
"color": "rgba(37,99,235,.2)"
},
"label": {
"show": true,
"color": "#18283d"
}
}
]
}
},
{
"id": "style-emphasis",
"title": "高亮样式",
"option": {
"animation": false,
"title": {
"text": "蓝色天空网 · 虚构学习数据"
},
"tooltip": {
"trigger": "item"
},
"legend": {
"top": 35
},
"grid": {
"top": 90,
"bottom": 65,
"containLabel": true
},
"xAxis": {
"type": "category",
"data": [
"阅读",
"实作",
"复习",
"调试",
"整理",
"回顾"
]
},
"yAxis": {
"type": "value",
"name": "次数"
},
"series": [
{
"id": "study",
"name": "练习次数",
"type": "bar",
"data": [
12,
24,
18,
31,
22,
27
],
"emphasis": {
"itemStyle": {
"color": "#ff0000"
},
"label": {
"show": true,
"formatter": "学习高亮"
}
}
}
]
}
}
]
};
export default async function run(){await mount(echarts,specification);}
所需环境:ECharts6.1.0 / Edge156.0.4314.58 / 自有同源数据与本地HTTP服务;实际程序化指针和动作
当前源码 SHA256:1ee684762aae5dbeae2b0348d1f18f8a4d1871632115d850f1fc1eea975d0232
- 对应变体真实运行;其数据、图元、事件或状态独立记录
线、面积与文字样式:独立实例
import * as echarts from 'echarts';
import {mount} from './lab.js';
import theme from './blue-sky-theme.js';
echarts.registerTheme('blue-sky-js',theme);
// 本章独立配置和实际运行共用;数值均为自有虚构数据。
const specification = {
"key": "echarts-style",
"title": "ECharts 样式:主题、调色盘与高亮状态",
"cases": [
{
"id": "style-default",
"title": "当前默认主题",
"option": {
"animation": false,
"title": {
"text": "蓝色天空网 · 虚构学习数据"
},
"tooltip": {
"trigger": "item"
},
"legend": {
"top": 35
},
"grid": {
"top": 90,
"bottom": 65,
"containLabel": true
},
"xAxis": {
"type": "category",
"data": [
"阅读",
"实作",
"复习",
"调试",
"整理",
"回顾"
]
},
"yAxis": {
"type": "value",
"name": "次数"
},
"series": [
{
"id": "study",
"name": "练习次数",
"type": "bar",
"data": [
12,
24,
18,
31,
22,
27
]
}
]
}
},
{
"id": "style-dark",
"title": "内置dark",
"option": {
"animation": false,
"title": {
"text": "蓝色天空网 · 虚构学习数据"
},
"tooltip": {
"trigger": "item"
},
"legend": {
"top": 35
},
"grid": {
"top": 90,
"bottom": 65,
"containLabel": true
},
"xAxis": {
"type": "category",
"data": [
"阅读",
"实作",
"复习",
"调试",
"整理",
"回顾"
]
},
"yAxis": {
"type": "value",
"name": "次数"
},
"series": [
{
"id": "study",
"name": "练习次数",
"type": "bar",
"data": [
12,
24,
18,
31,
22,
27
]
}
]
},
"theme": "dark"
},
{
"id": "style-js",
"title": "本站JS注册主题",
"option": {
"animation": false,
"title": {
"text": "蓝色天空网 · 虚构学习数据"
},
"tooltip": {
"trigger": "item"
},
"legend": {
"top": 35
},
"grid": {
"top": 90,
"bottom": 65,
"containLabel": true
},
"xAxis": {
"type": "category",
"data": [
"阅读",
"实作",
"复习",
"调试",
"整理",
"回顾"
]
},
"yAxis": {
"type": "value",
"name": "次数"
},
"series": [
{
"id": "study",
"name": "练习次数",
"type": "bar",
"data": [
12,
24,
18,
31,
22,
27
]
}
]
},
"theme": "blue-sky-js"
},
{
"id": "style-json",
"title": "本站JSON加载主题",
"option": {
"animation": false,
"title": {
"text": "蓝色天空网 · 虚构学习数据"
},
"tooltip": {
"trigger": "item"
},
"legend": {
"top": 35
},
"grid": {
"top": 90,
"bottom": 65,
"containLabel": true
},
"xAxis": {
"type": "category",
"data": [
"阅读",
"实作",
"复习",
"调试",
"整理",
"回顾"
]
},
"yAxis": {
"type": "value",
"name": "次数"
},
"series": [
{
"id": "study",
"name": "练习次数",
"type": "bar",
"data": [
12,
24,
18,
31,
22,
27
]
}
]
},
"theme": "blue-sky-json"
},
{
"id": "palette-global",
"title": "全局调色盘",
"option": {
"animation": false,
"title": {
"text": "蓝色天空网 · 学习构成"
},
"tooltip": {
"trigger": "item"
},
"legend": {
"bottom": 0
},
"series": [
{
"id": "composition",
"name": "学习构成",
"type": "pie",
"radius": "55%",
"center": [
"50%",
"50%"
],
"data": [
{
"name": "阅读",
"value": 12
},
{
"name": "实作",
"value": 24
},
{
"name": "复习",
"value": 18
},
{
"name": "调试",
"value": 31
},
{
"name": "整理",
"value": 22
}
]
}
],
"color": [
"#ff0000",
"#00aa00",
"#0000ff",
"#aa00aa",
"#00aaaa"
]
}
},
{
"id": "palette-series",
"title": "系列调色盘覆盖",
"option": {
"animation": false,
"title": {
"text": "蓝色天空网 · 学习构成"
},
"tooltip": {
"trigger": "item"
},
"legend": {
"bottom": 0
},
"series": [
{
"id": "composition",
"name": "学习构成",
"type": "pie",
"radius": "55%",
"center": [
"50%",
"50%"
],
"data": [
{
"name": "阅读",
"value": 12
},
{
"name": "实作",
"value": 24
},
{
"name": "复习",
"value": 18
},
{
"name": "调试",
"value": 31
},
{
"name": "整理",
"value": 22
}
],
"color": [
"#00aa00",
"#0000ff",
"#aa00aa",
"#00aaaa",
"#aaaa00"
]
}
],
"color": [
"#ff0000"
]
}
},
{
"id": "style-explicit",
"title": "数据项覆盖系列样式",
"option": {
"animation": false,
"title": {
"text": "蓝色天空网 · 虚构学习数据"
},
"tooltip": {
"trigger": "item"
},
"legend": {
"top": 35
},
"grid": {
"top": 90,
"bottom": 65,
"containLabel": true
},
"xAxis": {
"type": "category",
"data": [
"阅读",
"实作",
"复习",
"调试",
"整理",
"回顾"
]
},
"yAxis": {
"type": "value",
"name": "次数"
},
"series": [
{
"id": "study",
"name": "练习次数",
"type": "bar",
"data": [
{
"value": 12,
"itemStyle": {
"color": "#db2777"
}
},
24,
18,
31,
22,
27
],
"itemStyle": {
"color": "#2563eb",
"borderWidth": 2,
"borderColor": "#18283d"
}
}
]
}
},
{
"id": "style-line",
"title": "线、面积与文字样式",
"option": {
"animation": false,
"title": {
"text": "蓝色天空网 · 虚构学习数据"
},
"tooltip": {
"trigger": "item"
},
"legend": {
"top": 35
},
"grid": {
"top": 90,
"bottom": 65,
"containLabel": true
},
"xAxis": {
"type": "category",
"data": [
"阅读",
"实作",
"复习",
"调试",
"整理",
"回顾"
]
},
"yAxis": {
"type": "value",
"name": "次数"
},
"series": [
{
"id": "study",
"name": "练习次数",
"type": "line",
"data": [
12,
24,
18,
31,
22,
27
],
"lineStyle": {
"width": 4,
"color": "#2563eb"
},
"areaStyle": {
"color": "rgba(37,99,235,.2)"
},
"label": {
"show": true,
"color": "#18283d"
}
}
]
}
},
{
"id": "style-emphasis",
"title": "高亮样式",
"option": {
"animation": false,
"title": {
"text": "蓝色天空网 · 虚构学习数据"
},
"tooltip": {
"trigger": "item"
},
"legend": {
"top": 35
},
"grid": {
"top": 90,
"bottom": 65,
"containLabel": true
},
"xAxis": {
"type": "category",
"data": [
"阅读",
"实作",
"复习",
"调试",
"整理",
"回顾"
]
},
"yAxis": {
"type": "value",
"name": "次数"
},
"series": [
{
"id": "study",
"name": "练习次数",
"type": "bar",
"data": [
12,
24,
18,
31,
22,
27
],
"emphasis": {
"itemStyle": {
"color": "#ff0000"
},
"label": {
"show": true,
"formatter": "学习高亮"
}
}
}
]
}
}
]
};
export default async function run(){await mount(echarts,specification);}
所需环境:ECharts6.1.0 / Edge156.0.4314.58 / 自有同源数据与本地HTTP服务;实际程序化指针和动作
当前源码 SHA256:1ee684762aae5dbeae2b0348d1f18f8a4d1871632115d850f1fc1eea975d0232
- 对应变体真实运行;其数据、图元、事件或状态独立记录
高亮样式:独立实例
import * as echarts from 'echarts';
import {mount} from './lab.js';
import theme from './blue-sky-theme.js';
echarts.registerTheme('blue-sky-js',theme);
// 本章独立配置和实际运行共用;数值均为自有虚构数据。
const specification = {
"key": "echarts-style",
"title": "ECharts 样式:主题、调色盘与高亮状态",
"cases": [
{
"id": "style-default",
"title": "当前默认主题",
"option": {
"animation": false,
"title": {
"text": "蓝色天空网 · 虚构学习数据"
},
"tooltip": {
"trigger": "item"
},
"legend": {
"top": 35
},
"grid": {
"top": 90,
"bottom": 65,
"containLabel": true
},
"xAxis": {
"type": "category",
"data": [
"阅读",
"实作",
"复习",
"调试",
"整理",
"回顾"
]
},
"yAxis": {
"type": "value",
"name": "次数"
},
"series": [
{
"id": "study",
"name": "练习次数",
"type": "bar",
"data": [
12,
24,
18,
31,
22,
27
]
}
]
}
},
{
"id": "style-dark",
"title": "内置dark",
"option": {
"animation": false,
"title": {
"text": "蓝色天空网 · 虚构学习数据"
},
"tooltip": {
"trigger": "item"
},
"legend": {
"top": 35
},
"grid": {
"top": 90,
"bottom": 65,
"containLabel": true
},
"xAxis": {
"type": "category",
"data": [
"阅读",
"实作",
"复习",
"调试",
"整理",
"回顾"
]
},
"yAxis": {
"type": "value",
"name": "次数"
},
"series": [
{
"id": "study",
"name": "练习次数",
"type": "bar",
"data": [
12,
24,
18,
31,
22,
27
]
}
]
},
"theme": "dark"
},
{
"id": "style-js",
"title": "本站JS注册主题",
"option": {
"animation": false,
"title": {
"text": "蓝色天空网 · 虚构学习数据"
},
"tooltip": {
"trigger": "item"
},
"legend": {
"top": 35
},
"grid": {
"top": 90,
"bottom": 65,
"containLabel": true
},
"xAxis": {
"type": "category",
"data": [
"阅读",
"实作",
"复习",
"调试",
"整理",
"回顾"
]
},
"yAxis": {
"type": "value",
"name": "次数"
},
"series": [
{
"id": "study",
"name": "练习次数",
"type": "bar",
"data": [
12,
24,
18,
31,
22,
27
]
}
]
},
"theme": "blue-sky-js"
},
{
"id": "style-json",
"title": "本站JSON加载主题",
"option": {
"animation": false,
"title": {
"text": "蓝色天空网 · 虚构学习数据"
},
"tooltip": {
"trigger": "item"
},
"legend": {
"top": 35
},
"grid": {
"top": 90,
"bottom": 65,
"containLabel": true
},
"xAxis": {
"type": "category",
"data": [
"阅读",
"实作",
"复习",
"调试",
"整理",
"回顾"
]
},
"yAxis": {
"type": "value",
"name": "次数"
},
"series": [
{
"id": "study",
"name": "练习次数",
"type": "bar",
"data": [
12,
24,
18,
31,
22,
27
]
}
]
},
"theme": "blue-sky-json"
},
{
"id": "palette-global",
"title": "全局调色盘",
"option": {
"animation": false,
"title": {
"text": "蓝色天空网 · 学习构成"
},
"tooltip": {
"trigger": "item"
},
"legend": {
"bottom": 0
},
"series": [
{
"id": "composition",
"name": "学习构成",
"type": "pie",
"radius": "55%",
"center": [
"50%",
"50%"
],
"data": [
{
"name": "阅读",
"value": 12
},
{
"name": "实作",
"value": 24
},
{
"name": "复习",
"value": 18
},
{
"name": "调试",
"value": 31
},
{
"name": "整理",
"value": 22
}
]
}
],
"color": [
"#ff0000",
"#00aa00",
"#0000ff",
"#aa00aa",
"#00aaaa"
]
}
},
{
"id": "palette-series",
"title": "系列调色盘覆盖",
"option": {
"animation": false,
"title": {
"text": "蓝色天空网 · 学习构成"
},
"tooltip": {
"trigger": "item"
},
"legend": {
"bottom": 0
},
"series": [
{
"id": "composition",
"name": "学习构成",
"type": "pie",
"radius": "55%",
"center": [
"50%",
"50%"
],
"data": [
{
"name": "阅读",
"value": 12
},
{
"name": "实作",
"value": 24
},
{
"name": "复习",
"value": 18
},
{
"name": "调试",
"value": 31
},
{
"name": "整理",
"value": 22
}
],
"color": [
"#00aa00",
"#0000ff",
"#aa00aa",
"#00aaaa",
"#aaaa00"
]
}
],
"color": [
"#ff0000"
]
}
},
{
"id": "style-explicit",
"title": "数据项覆盖系列样式",
"option": {
"animation": false,
"title": {
"text": "蓝色天空网 · 虚构学习数据"
},
"tooltip": {
"trigger": "item"
},
"legend": {
"top": 35
},
"grid": {
"top": 90,
"bottom": 65,
"containLabel": true
},
"xAxis": {
"type": "category",
"data": [
"阅读",
"实作",
"复习",
"调试",
"整理",
"回顾"
]
},
"yAxis": {
"type": "value",
"name": "次数"
},
"series": [
{
"id": "study",
"name": "练习次数",
"type": "bar",
"data": [
{
"value": 12,
"itemStyle": {
"color": "#db2777"
}
},
24,
18,
31,
22,
27
],
"itemStyle": {
"color": "#2563eb",
"borderWidth": 2,
"borderColor": "#18283d"
}
}
]
}
},
{
"id": "style-line",
"title": "线、面积与文字样式",
"option": {
"animation": false,
"title": {
"text": "蓝色天空网 · 虚构学习数据"
},
"tooltip": {
"trigger": "item"
},
"legend": {
"top": 35
},
"grid": {
"top": 90,
"bottom": 65,
"containLabel": true
},
"xAxis": {
"type": "category",
"data": [
"阅读",
"实作",
"复习",
"调试",
"整理",
"回顾"
]
},
"yAxis": {
"type": "value",
"name": "次数"
},
"series": [
{
"id": "study",
"name": "练习次数",
"type": "line",
"data": [
12,
24,
18,
31,
22,
27
],
"lineStyle": {
"width": 4,
"color": "#2563eb"
},
"areaStyle": {
"color": "rgba(37,99,235,.2)"
},
"label": {
"show": true,
"color": "#18283d"
}
}
]
}
},
{
"id": "style-emphasis",
"title": "高亮样式",
"option": {
"animation": false,
"title": {
"text": "蓝色天空网 · 虚构学习数据"
},
"tooltip": {
"trigger": "item"
},
"legend": {
"top": 35
},
"grid": {
"top": 90,
"bottom": 65,
"containLabel": true
},
"xAxis": {
"type": "category",
"data": [
"阅读",
"实作",
"复习",
"调试",
"整理",
"回顾"
]
},
"yAxis": {
"type": "value",
"name": "次数"
},
"series": [
{
"id": "study",
"name": "练习次数",
"type": "bar",
"data": [
12,
24,
18,
31,
22,
27
],
"emphasis": {
"itemStyle": {
"color": "#ff0000"
},
"label": {
"show": true,
"formatter": "学习高亮"
}
}
}
]
}
}
]
};
export default async function run(){await mount(echarts,specification);}
所需环境:ECharts6.1.0 / Edge156.0.4314.58 / 自有同源数据与本地HTTP服务;实际程序化指针和动作
当前源码 SHA256:1ee684762aae5dbeae2b0348d1f18f8a4d1871632115d850f1fc1eea975d0232
- 对应变体真实运行;其数据、图元、事件或状态独立记录
常见错误与边界
- 只看option或标题而未核对真实数据、图元、状态。
- 旧版本、外部数据及未运行环境被误写成已完成。
练习与解答
改变一个维度、布局条件或状态,预判结果,再分别观察图形、文字和事件记录。
展开参考解答
保持图表类型、轴、维度、数据和交互对应;完整来源事实、真人键盘/触屏/读屏及其他版本仍需独立复核。