滚动:https://chenxuan0000.github.io/vue-seamless-scroll/zh/guide/09-echart.html
案例:https://blog.csdn.net/qq_34235864/article/details/120878688?utm_medium=distribute.pc_feed_v2.none-task-blog-personrec_tag-9.pc_personrecdepth_1-utm_source=distribute.pc_feed_v2.none-task-blog-personrec_tag-9.pc_personrec
echarts 不动的数据格式:https://blog.csdn.net/qq_37235616/article/details/112298075
echarts 点击处理:https://www.cnblogs.com/liangsf/p/11592283.html
title: 标题组件,包含主标题和副标题。
legend:图例组件。
grid: 直角坐标系内绘图网格 及傍边距离
xAxis: x轴
yAxis: y轴
polar: 极坐标系
radiusAxis:极坐标系x
angleAxis:极坐标角度
radar: 雷达图
dataZoom 组件 用于区域缩放
tooltip: 提示框组件的通用介绍
参考:https://github.com/dabeng/OrgChart
树状图
option = {
series: [{
type: "tree",
data: [{
name: "root",
children: [{
name: "Child A",
children: [{
name: "Leaf C"
}, {
name: "Leaf D"
}, {
name: "Leaf E"
}, {
name: "Leaf F"
}]
}, {
name: "Child B",
children: [{
name: "Leaf G"
}, {
name: "Leaf H"
}]
}, {
name: "Child D"
}, {
name: "Child F",
children: [{
name: "Leaf J"
}, {
name: "Leaf K"
}]
}]
}],
label: {
position: "inside",
show: true,
backgroundColor: "rgba(150, 116, 116, 1)",
padding: [5, 5, 5, 5]
},
edgeShape: "polyline",
layout: "orthogonal",
orient: "LR",
symbol: "none",
symbolOffset: [0, 0],
expandAndCollapse: false,
itemStyle: {
color: "rgba(227, 23, 23, 1)",
borderColor: "rgba(118, 12, 12, 1)",
borderWidth: 5.5,
borderType: "dotted",
borderCap: "square"
},
tooltip: {
borderColor: "rgba(218, 45, 45, 1)"
}
}]
}
树状图
option = {
series: [{
type: "tree",
data: [{
name: "root",
children: [{
name: "Child A",
children: [{
name: "Leaf C"
}, {
name: "Leaf D"
}, {
name: "Leaf E"
}, {
name: "Leaf F"
}]
}, {
name: "Child B",
children: [{
name: "Leaf G"
}, {
name: "Leaf H"
}]
}, {
name: "Child D"
}, {
name: "Child F",
children: [{
name: "Leaf J"
}, {
name: "Leaf K"
}]
}]
}],
label: {
position: "right"
},
edgeShape: "polyline"
}]
}
南北极地图配置
option = {
angleAxis: {
max: 2,
startAngle: 30,
splitLine: {
show: true
}
},
radiusAxis: {
type: 'category',
data: ['v', 'w', 'x', 'y', 'z'],
z: 10
},
polar: {
},
series: [{
type: 'bar',
data: [4, 3, 2, 1, 0.55],
coordinateSystem: 'polar',
name: 'Without Round Cap',
color: 'rgba(200, 0, 0, 0.5)',
itemStyle: {
borderColor: 'red',
borderWidth: 1
}
}, {
type: 'bar',
data: [4, 3, 2, 1, 0],
coordinateSystem: 'polar',
name: 'With Round Cap',
roundCap: true,
color: 'rgba(0, 200, 0, 0.5)',
itemStyle: {
borderColor: 'green',
borderWidth: 1
}
}],
legend: {
show: true,
data: ['Without Round Cap', 'With Round Cap'],
selectedMode: false,// legend 点击联动效果
}
};
扇形配置
export let pie = {
color: ["#F05A49", "#2B91E1", "#29AB91"],
// title: {
// show: true,
// text: "120%",
// x: "center",
// y: "center",
// textStyle: {
// color: "#FFFEFE",
// fontSize: 12,
// },
// },
series: [{
type: "pie",
radius: "100%",
center: ["50%", "50%"],
data: [
{
name: "33%\n偏高",
value: 1,
},
{
name: "33%\n偏低",
value: 1,
},
{
name: "33%\n正常",
value: 1,
},
],
animation: false,
label: {
position: "inside",
alignTo: "none",
bleedMargin: 5,
},
},
],
};
圆环
let pie0 = {
series: [
{
name: "访问来源",
type: "pie",
radius: ["70%", "90%"],
avoidLabelOverlap: false,
label: {
show: true,
position: "center",
},
data: [
{
value: 10,
name: "10%",
itemStyle: { color: "#29AB91" },
},
{
value: 90,
name: "",
itemStyle: { color: "#EEEEEE" }
},
],
},
],
};
圆环配置
// 运动心率
var colorList = ["#2B91E2", "#F15A4A", "#FFB415"];
option = {
tooltip: {
show: false,
trigger: "item",
},
series: [
{
type: "pie",
// center:["50%","36%"],
radius: ["46%", "56%"],
clockwise: true,
avoidLabelOverlap: true,
hoverOffset: 0,
itemStyle: {
normal: {
color: function (params) {
return colorList[params.dataIndex];
},
},
},
label: {
show: true,
fontSize: 10,
// formatter: "{d}%(46分)\n 心率",
formatter: function (params) {
// console.log(params, "===========params");
return params.percent + "%(46分)\n" + params.name;
},
},
labelLine: {
normal: {
length: 10,
length2: 10,
lineStyle: {
width: 1,
},
},
},
data: [
{
name: "低于心直率",
value: 1.45,
},
{
name: "持平心直率",
value: 2.93,
},
{
name: "高于心直率",
value: 3.15,
},
],
},
],
};
柱状图 叠加
option = {
color: ["#F94B4B", "#FFA9A9", "#E6E6E6"],
legend: {
orient: "horizontal",
left: "center",
bottom: "10",
itemHeight: 10,
itemWidth: 10,
data: [
{
name: "日常消耗",
icon: "circle",
textStyle: {
color: "#666",
},
},
{
name: "运动消耗",
icon: "circle",
textStyle: {
color: "#666",
},
},
{
name: "每日建议量",
icon: "circle",
textStyle: {
color: "#666",
},
},
],
textStyle: {
color: "rgba(0,0,0,.3)",
fontSize: 10,
fontWeight: 300,
padding: [0, 2],
},
tooltip: {
show: true,
},
},
// 内容距离边框
grid: {
top: "2%", // 等价于 y: '16%'
left: "1%",
right: "6%",
bottom: "20%",
containLabel: true,
},
xAxis: {
type: "category",
boundaryGap: true,
offset: 10,
data: ["07/10", "07/11", "07/12", "07/13", "07/14", "07/15", "07/16"],
axisLine: {
lineStyle: {
color: "#ccc",
},
},
// 改变x轴字体颜色和大小
axisLabel: {
interval: 0,
textStyle: {
color: "#999999",
fontSize: "10",
},
},
//网格样式
splitLine: {
show: false,
interval: "auto",
lineStyle: {
color: ["#ccc"],
width: 1,
type: "solid",
},
},
axisTick: {
show: false,
},
},
yAxis: [
{
type: "value",
// name: "mmHg",
splitArea: {
show: false,
},
minInterval: 1, //设置成1保证坐标轴分割刻度显示成整数。
// y轴颜色
axisLine: {
lineStyle: {
color: "#ccc",
},
},
// 改变y轴字体颜色和大小
axisLabel: {
formatter: "{value}", // 给y轴添加单位
textStyle: {
color: "#ccc",
fontSize: "12",
},
},
// y轴线
splitLine: {
lineStyle: {
color: "#ccc",
},
},
axisTick: {
show: false,
},
},
// y轴
// {
// name: "降雨量(mm)",
// nameLocation: "start",
// max: 5,
// type: "value",
// inverse: true,
// axisLine: {
// lineStyle: {
// color: "#ccc",
// },
// },
// },
],
series: [
{
name: "日常消耗",
type: "bar",
stack: "广告",
barWidth: 10,
data: [120, 132, 101, 134, 90, 230, 210],
},
{
name: "运动消耗",
type: "bar",
stack: "广告",
data: [220, 182, 191, 234, 290, 330, 310],
},
{
name: "每日建议量",
type: "bar",
barWidth: 10,
barGap: 0,
stack: "广告1",
data: [150, 232, 201, 154, 190, 330, 410],
// 点击亮色
emphasis: {
itemStyle: {
// 高亮时点的颜色。
color: "#E6E6E6",
},
},
},
],
};
横向柱状图
option = sportdistance_option = {
legend: {
bottom: 20,
itemWidth: 10,
itemHeight: 10,
icon: "circle",
data: ["每日运动里程推荐", "运动里程"],
selectedMode: false,
},
grid: {
left: "1%",
right: "6%",
bottom: "20%",
top: "3%",
containLabel: true,
},
xAxis: {
type: "value",
boundaryGap: [0, 0],
axisTick: {
show: false,
},
axisLine: {
lineStyle: {
color: "#ccc",
},
},
},
yAxis: {
type: "category",
data: ["07/10", "07/11", "07/12", "07/13", "07/14", "07/15", "07/16"],
axisTick: {
show: false,
},
axisLine: {
lineStyle: {
color: "#ccc",
},
},
},
series: [
{
name: "运动里程",
type: "bar",
data: [1, 3, 3.1, 2.6, 3.5, 5, 4],
itemStyle: {
barBorderRadius: [0, 24, 24, 0],
color: "#FF7545",
},
},
{
name: "每日运动里程推荐",
type: "bar",
barGap: 0,
data: [2.25, 2.25, 2.25, 2.25, 2.25, 2.25, 2.25],
itemStyle: {
barBorderRadius: [0, 24, 24, 0],
color: "#DDDDDD",
},
emphasis: {
itemStyle: {
// 高亮时点的颜色。
color: "#DDDDDD",
},
},
},
],
};
双环图表
heatanalyse_option = {
title: [
{
text: "建议",
x: "44%",
y: 0,
textAlign: "center",
textStyle: {
align: "center",
color: "#6BB2EB",
fontSize: 12,
fontWeight: "100",
},
},
{
text: "实际",
x: "44%",
y: 20,
textAlign: "center",
textStyle: {
align: "center",
color: "#F05A49",
fontSize: 12,
fontWeight: "100",
},
},
{
text: "营养素分析",
left: "50%",
top: "42%",
textAlign: "center",
textStyle: {
fontSize: "14",
color: "#B6B6B6",
textAlign: "center",
fontWeight: "100",
},
},
],
series: [
{
name: "访问来源",
type: "pie",
startAngle: 85,
radius: ["82%", "92%"],
center: ["50%", "50%"],
avoidLabelOverlap: false,
label: {
show: false,
position: "center",
},
emphasis: {
label: {
show: true,
fontSize: "30",
fontWeight: "bold",
},
},
labelLine: {
show: false,
},
data: [
{
value: Math.round(0.1 * 75),
itemStyle: {
normal: {
color: "#F05A49",
},
},
},
{
value: 75 - Math.round(0.2 * 75),
name: " ",
itemStyle: {
normal: {
color: "#2B91E1", //未完成的圆环的颜色
label: {
show: false,
},
labelLine: {
show: false,
},
},
},
},
{
value: 75 - Math.round(0.7 * 75),
name: " ",
itemStyle: {
normal: {
color: "#29AB91", //未完成的圆环的颜色
label: {
show: false,
},
labelLine: {
show: false,
},
},
},
},
{
value: 25,
name: " ",
itemStyle: {
normal: {
color: "transparent", //未完成的圆环的颜色
label: {
show: false,
},
labelLine: {
show: false,
},
},
},
},
],
},
{
name: "访问来源1",
type: "pie",
startAngle: 85,
radius: ["62%", "72%"],
center: ["50%", "50%"],
avoidLabelOverlap: false,
label: {
show: false,
position: "center",
},
emphasis: {
label: {
show: true,
fontSize: "30",
fontWeight: "bold",
},
},
labelLine: {
show: false,
},
data: [
{
value: Math.round(0.1 * 75),
itemStyle: {
normal: {
color: "#F05A49",
},
},
},
{
value: 75 - Math.round(0.2 * 75),
name: " ",
itemStyle: {
normal: {
color: "#2B91E1", //未完成的圆环的颜色
label: {
show: false,
},
labelLine: {
show: false,
},
},
},
},
{
value: 75 - Math.round(0.7 * 75),
name: " ",
itemStyle: {
normal: {
color: "#29AB91", //未完成的圆环的颜色
label: {
show: false,
},
labelLine: {
show: false,
},
},
},
},
{
value: 25,
name: " ",
itemStyle: {
normal: {
color: "transparent", //未完成的圆环的颜色
label: {
show: false,
},
labelLine: {
show: false,
},
},
},
},
],
},
],
};
网格点图
cholesterol_option = {
cwl: "mmol/L",
tooltip: {
trigger: "item",
formatter: function (param) {
console.log(param, "param===");
return `<span>${(param.value[1] * 1).toFixed(2)}${cholesterol_option.cwl}<br>${
param.seriesName
}<span>`;
},
},
legend: {
orient: "horizontal",
left: "center",
bottom: "10",
itemHeight: 6,
itemWidth: 6,
data: [
{
name: "严重\n偏低",
icon: "circle",
textStyle: {
color: "#666",
},
},
{
name: "正常",
icon: "circle",
textStyle: {
color: "#666",
},
},
{
name: "偏高",
icon: "circle",
textStyle: {
color: "#666",
},
},
{
name: "严重\n偏高",
icon: "circle",
textStyle: {
color: "#666",
},
},
],
textStyle: {
color: "rgba(0,0,0,.3)",
fontSize: 10,
fontWeight: 300,
padding: [0, 1],
},
selectedMode: false,
},
// 内容距离边框
grid: {
top: "2%", // 等价于 y: '16%'
left: "1%",
right: "4%",
bottom: "20%",
containLabel: true,
},
xAxis: {
type: "category",
boundaryGap: false,
offset: 0,
data: ["", "07/10", "07/11", "07/12", "07/13", "07/14", "07/15", "07/16"],
axisLine: {
lineStyle: {
color: "#ccc",
},
},
// 改变x轴字体颜色和大小
axisLabel: {
interval: 0,
textStyle: {
color: "#999999",
fontSize: "10",
},
},
//网格样式
splitLine: {
show: true,
interval: "auto",
lineStyle: {
color: ["#ccc"],
width: 1,
type: "solid",
},
},
axisTick: {
show: false,
},
},
yAxis: {
type: "value",
// name: "mmHg",
minInterval: 1, //设置成1保证坐标轴分割刻度显示成整数。
// y轴颜色
axisLine: {
lineStyle: {
color: "#ccc",
},
},
// 改变y轴字体颜色和大小
axisLabel: {
formatter: "{value}", // 给y轴添加单位
textStyle: {
color: "#999999",
fontSize: "12",
},
},
// y轴线
splitLine: {
lineStyle: {
color: "#ccc",
},
},
axisTick: {
show: false,
},
},
series: [
{
name: "偏低",
type: "scatter",
data: [[1, 20]],
symbol: "circle",
symbolSize: 10,
showAllSymbol: true,
lineStyle: {
//设置折线色颜色
color: "#0BBFC6",
},
itemStyle: {
//设置折线折点的颜色,
normal: {
color: "#0BBFC6",
// label: { show: true }
},
},
// emphasis: {
// label: {
// show: true,
// formatter: function (param) {
// return param.data[3];
// },
// position: "bottom",
// },
// },
},
{
name: "正常",
type: "scatter",
data: [[5, 60]],
symbol: "circle",
symbolSize: 10,
showAllSymbol: true,
lineStyle: {
color: "#91D143",
},
itemStyle: {
//设置折线折点的颜色,
normal: {
color: "#91D143",
// label: { show: true }
},
},
// emphasis: {
// label: {
// show: true,
// formatter: function (param) {
// return param.data[3];
// },
// position: "bottom",
// },
// },
},
{
name: "偏高",
type: "scatter",
data: [],
symbol: "circle",
symbolSize: 10,
showAllSymbol: true,
lineStyle: {
color: "#FFD700",
},
itemStyle: {
//设置折线折点的颜色,
normal: {
color: "#FFD700",
// label: { show: true }
},
},
// emphasis: {
// label: {
// show: true,
// formatter: function (param) {
// return param.data[3];
// },
// position: "bottom",
// },
// },
},
{
name: "严重\n偏高",
type: "scatter",
data: [],
symbol: "circle",
symbolSize: 10,
showAllSymbol: true,
lineStyle: {
color: "#EC6700",
},
itemStyle: {
//设置折线折点的颜色,
normal: {
color: "#EC6700",
// label: { show: true }
},
},
// emphasis: {
// label: {
// show: true,
// formatter: function (param) {
// return param.data[3];
// },
// position: "bottom",
// },
// },
},
],
};
连线竖线状图
pressure_option = {
cwl: "mmHg",
tooltip: {
trigger: "item",
formatter: function (param) {
console.log(param, "param===");
return `<span>${(param.value[1] * 1).toFixed(0)}${pressure_option.cwl}<br>${
param.seriesName
}<span>`;
},
},
legend: {
orient: "horizontal",
left: "center",
bottom: "10",
itemHeight: 6,
itemWidth: 6,
data: [
{
name: "严重\n过低",
icon: "circle",
textStyle: {
color: "#666",
},
},
{
name: "低\n血压",
icon: "circle",
textStyle: {
color: "#666",
},
},
{
name: "正常\n血压",
icon: "circle",
textStyle: {
color: "#666",
},
},
{
name: "正常\n高值",
icon: "circle",
textStyle: {
color: "#666",
},
},
{
name: "一级\n血压",
icon: "circle",
textStyle: {
color: "#666",
},
},
{
name: "二级\n血压",
icon: "circle",
textStyle: {
color: "#666",
},
},
{
name: "三级\n血压",
icon: "circle",
textStyle: {
color: "#666",
},
},
],
textStyle: {
color: "rgba(0,0,0,.3)",
fontSize: 10,
fontWeight: 300,
padding: [0, 1],
},
selectedMode: false,
},
// 内容距离边框
grid: {
top: "2%", // 等价于 y: '16%'
left: "1%",
right: "2%",
bottom: "20%",
containLabel: true,
},
xAxis: {
type: "category",
boundaryGap: false,
offset: 0,
data: ["", "07/10", "07/11", "07/12", "07/13", "07/14", "07/15", "07/16"],
axisLine: {
lineStyle: {
color: "#ccc",
},
},
// 改变x轴字体颜色和大小
axisLabel: {
interval: 0,
textStyle: {
color: "#999999",
fontSize: "10",
},
},
//网格样式
splitLine: {
show: true,
interval: "auto",
lineStyle: {
color: ["#ccc"],
width: 1,
type: "solid",
},
},
axisTick: {
show: false,
},
},
yAxis: {
type: "value",
// name: "mmHg",
minInterval: 1, //设置成1保证坐标轴分割刻度显示成整数。
// y轴颜色
axisLine: {
lineStyle: {
color: "#ccc",
},
},
// 改变y轴字体颜色和大小
axisLabel: {
formatter: "{value}", // 给y轴添加单位
textStyle: {
color: "#999999",
fontSize: "12",
},
},
// y轴线
splitLine: {
lineStyle: {
color: "#ccc",
},
},
axisTick: {
show: false,
},
},
series: [
{
name: "严重\n过低",
type: "line",
data: [
[1, 20],
[1, 60],
],
symbol: "circle",
symbolSize: 10,
showAllSymbol: true,
lineStyle: {
//设置折线色颜色
color: "#63CFFA",
},
itemStyle: {
//设置折线折点的颜色,
normal: {
color: "#63CFFA",
// label: { show: true }
},
},
},
{
name: "低\n血压",
type: "line",
data: [
[5, 60],
[5, 80],
],
symbol: "circle",
symbolSize: 10,
showAllSymbol: true,
lineStyle: {
color: "#02C4C3",
},
itemStyle: {
//设置折线折点的颜色,
normal: {
color: "#02C4C3",
// label: { show: true }
},
},
},
{
name: "正常\n血压",
type: "line",
data: [],
symbol: "circle",
symbolSize: 10,
showAllSymbol: true,
lineStyle: {
color: "#91D049",
},
itemStyle: {
//设置折线折点的颜色,
normal: {
color: "#91D049",
// label: { show: true }
},
},
},
{
name: "正常\n高值",
type: "line",
data: [],
symbol: "circle",
symbolSize: 10,
showAllSymbol: true,
lineStyle: {
color: "#FFD900",
},
itemStyle: {
//设置折线折点的颜色,
normal: {
color: "#FFD900",
// label: { show: true }
},
},
},
{
name: "一级\n血压",
type: "line",
data: [],
symbol: "circle",
symbolSize: 10,
showAllSymbol: true,
lineStyle: {
color: "#FF9615",
},
itemStyle: {
//设置折线折点的颜色,
normal: {
color: "#FF9615",
// label: { show: true }
},
},
},
{
name: "二级\n血压",
type: "line",
data: [],
symbol: "circle",
symbolSize: 10,
showAllSymbol: true,
lineStyle: {
color: "#A30F04",
},
itemStyle: {
//设置折线折点的颜色,
normal: {
color: "#A30F04",
// label: { show: true }
},
},
},
{
name: "三级\n血压",
type: "line",
data: [],
symbol: "circle",
symbolSize: 10,
showAllSymbol: true,
lineStyle: {
color: "#A30F04",
},
itemStyle: {
//设置折线折点的颜色,
normal: {
color: "#A30F04",
// label: { show: true }
},
},
},
],
};
花纹 竖线图
option =glu_option = {
cwl: "mmol/L",
tooltip: {
borderColor: "#f00",
trigger: "item",
formatter: function (param) {
console.log(param, '============== // name: "mmHg",');
return `<span>${(param.value[1] * 1).toFixed(1)}${glu_option.cwl}<br>${
param.seriesName
}<span>`;
},
},
legend: {
orient: "horizontal",
left: "center",
bottom: "10",
itemHeight: 6,
itemWidth: 6,
data: [
{
name: "严重\n过低",
icon: "circle",
textStyle: {
color: "#666",
},
},
{
name: "血糖\n偏低",
icon: "circle",
textStyle: {
color: "#666",
},
},
{
name: "血糖\n正常",
icon: "circle",
textStyle: {
color: "#666",
},
},
{
name: "轻度\n偏高",
icon: "circle",
textStyle: {
color: "#666",
},
},
{
name: "血糖\n偏高",
icon: "circle",
textStyle: {
color: "#666",
},
},
{
name: "严重\n过高",
icon: "circle",
textStyle: {
color: "#666",
},
},
],
textStyle: {
color: "rgba(0,0,0,.3)",
fontSize: 10,
fontWeight: 300,
padding: [0, 1],
},
selectedMode: false,
},
// 内容距离边框
grid: {
top: "2%", // 等价于 y: '16%'
left: "1%",
right: "4%",
bottom: "20%",
containLabel: true,
},
xAxis: {
type: "category",
boundaryGap: false,
offset: 0,
data: ["", "07/10", "07/11", "07/12", "07/13", "07/14", "07/15", "07/16"],
axisLine: {
lineStyle: {
color: "#ccc",
},
},
// 改变x轴字体颜色和大小
axisLabel: {
interval: 0,
textStyle: {
color: "#999999",
fontSize: "10",
},
},
//网格样式
splitLine: {
show: false,
interval: "auto",
lineStyle: {
color: ["#ccc"],
width: 1,
type: "solid",
},
},
axisTick: {
show: false,
},
},
yAxis: [
{
type: "value",
// name: "mmHg",
splitArea: {
show: true,
},
minInterval: 1, //设置成1保证坐标轴分割刻度显示成整数。
// y轴颜色
axisLine: {
lineStyle: {
color: "#ccc",
},
},
// 改变y轴字体颜色和大小
axisLabel: {
formatter: "{value}", // 给y轴添加单位
textStyle: {
color: "#ccc",
fontSize: "12",
},
},
// y轴线
splitLine: {
lineStyle: {
color: "#ccc",
},
},
axisTick: {
show: false,
},
},
{
name: "降雨量(mm)",
nameLocation: "start",
max: 5,
type: "value",
inverse: true,
axisLine: {
lineStyle: {
color: "#ccc",
},
},
axisTick: {
show: false,
},
},
],
series: [
{
type: "scatter",
name: "严重\n过低",
data: [
[1, 20],
[1, 60],
],
symbol: "circle",
symbolSize: 10,
showAllSymbol: true,
lineStyle: {
//设置折线色颜色
color: "#66CDFB",
},
itemStyle: {
//设置折线折点的颜色,
normal: {
color: "#66CDFB",
// label: { show: true }
},
},
// emphasis: {
// label: {
// show: true,
// formatter: function (param) {
// return param.data[3];
// },
// position: "bottom",
// },
// },
},
{
name: "血糖\n偏低",
type: "scatter",
data: [
[5, 60],
[5, 80],
],
symbol: "circle",
symbolSize: 10,
showAllSymbol: true,
lineStyle: {
color: "#01C7BE",
},
itemStyle: {
//设置折线折点的颜色,
normal: {
color: "#01C7BE",
// label: { show: true }
},
},
// emphasis: {
// label: {
// show: true,
// formatter: function (param) {
// return param.data[3];
// },
// position: "bottom",
// },
// },
},
{
name: "血糖\n正常",
type: "scatter",
data: [],
symbol: "circle",
symbolSize: 10,
showAllSymbol: true,
lineStyle: {
color: "#90D049",
},
itemStyle: {
//设置折线折点的颜色,
normal: {
color: "#90D049",
// label: { show: true }
},
},
// emphasis: {
// label: {
// show: true,
// formatter: function (param) {
// return param.data[3];
// },
// position: "bottom",
// },
// },
},
{
name: "轻度\n偏高",
type: "scatter",
data: [],
symbol: "circle",
symbolSize: 10,
showAllSymbol: true,
lineStyle: {
color: "#FCD70A",
},
itemStyle: {
//设置折线折点的颜色,
normal: {
color: "#FCD70A",
// label: { show: true }
},
},
// emphasis: {
// label: {
// show: true,
// formatter: function (param) {
// return param.data[3];
// },
// position: "bottom",
// },
// },
},
{
name: "血糖\n偏高",
type: "scatter",
data: [],
symbol: "circle",
symbolSize: 10,
showAllSymbol: true,
lineStyle: {
color: "#FD961B",
},
itemStyle: {
//设置折线折点的颜色,
normal: {
color: "#FD961B",
// label: { show: true }
},
},
// emphasis: {
// label: {
// show: true,
// formatter: function (param) {
// return param.data[3];
// },
// position: "bottom",
// },
// },
},
{
name: "严重\n过高",
type: "scatter",
data: [],
symbol: "circle",
symbolSize: 10,
showAllSymbol: true,
lineStyle: {
color: "#EB6700",
},
itemStyle: {
//设置折线折点的颜色,
normal: {
color: "#EB6700",
// label: { show: true }
},
},
// emphasis: {
// label: {
// show: true,
// formatter: function (param) {
// return param.data[3];
// },
// position: "bottom",
// },
// },
},
],}
x轴平行线
option = {
color: "red",
tooltip: {},
xAxis: {
type: "value",
},
yAxis: [
{
type: "category",
data: ['3', '4', '1', '2', '5']
},
{
type: "category",
data: ['1', '2', '3','4', '5']
}
],
series: [
{
type: 'scatter',
yAxisIndex: 1,
symbolSize: 20,
data: [
['1', '1'],
['1', '2'],
]
},
{
symbolSize: 20,
data: [
['2', '3'],
['2', '4'],
],
markLine: {
silent: true, // 鼠标悬停事件, true悬停不会出现实线
symbol: 'none', // 去掉箭头
data: [
[
{
coord: ['1', '3'],
lineStyle: {
width: 1,
type: 'solid',
color: 'red',
},
},
{
coord: ['2', '3'],
lineStyle: {
width: 1,
type: 'solid',
color: 'red',
},
}
],
[
{
coord: ['1', '4'],
lineStyle: {
width: 1,
type: 'solid',
color: 'red',
},
},
{
coord: ['2', '4'],
lineStyle: {
width: 1,
type: 'solid',
color: 'red',
},
}
]
]
},
type: 'scatter'
}
]
};
网页调试:https://echarts.apache.org/examples/zh/editor.html?c=bar-stack
查看配置:https://echarts.apache.org/zh/tutorial.html#5%20%E5%88%86%E9%92%9F%E4%B8%8A%E6%89%8B%20ECharts