Browse Source

echarts颜色

master
aBin 5 years ago
parent
commit
82634d1daa
  1. 27
      src/components/Duration/Duration.js
  2. 54
      src/components/Sensor/Sensor.js
  3. 58
      src/components/Statistics/Statistics.js

27
src/components/Duration/Duration.js

@ -1,6 +1,10 @@
var option = { var option = {
title: { title: {
left: '10%', left: '10%',
textStyle: {
fontWeight: 'normal',
color: '#fff', //标题颜色
},
text: '急救时长分析', text: '急救时长分析',
}, },
tooltip: { trigger: 'axis' }, tooltip: { trigger: 'axis' },
@ -8,6 +12,10 @@ var option = {
x: 'center', x: 'center',
y: 'bottom', y: 'bottom',
data: ['我院记录', '国际水准', '当前数据'], data: ['我院记录', '国际水准', '当前数据'],
textStyle: {
fontWeight: 'normal',
color: '#fff', //标题颜色
},
}, },
grid: { grid: {
left: '3%', left: '3%',
@ -19,11 +27,30 @@ var option = {
type: 'category', type: 'category',
boundaryGap: false, boundaryGap: false,
data: ['周一', '周二', '周三', '周四', '周五', '周六', '周日'], data: ['周一', '周二', '周三', '周四', '周五', '周六', '周日'],
axisLabel: {
textStyle: {
fontWeight: 'normal',
color: '#fff', //标题颜色
},
},
}, },
yAxis: { yAxis: {
type: 'value', type: 'value',
name: '秒', name: '秒',
interval: 100, interval: 100,
axisLabel: {
textStyle: {
fontWeight: 'normal',
color: '#fff', //标题颜色
},
},
splitLine: {
show: true,
lineStyle: {
type: 'dashed',
color: '#666',
},
},
}, },
series: [ series: [
{ {

54
src/components/Sensor/Sensor.js

@ -1,20 +1,28 @@
var option = { var option = {
title: { title: {
left: '10%', left: '10%',
textStyle: {
fontWeight: 'normal',
color: '#fff', //标题颜色
},
text: '震动传感器', text: '震动传感器',
}, },
legend: { legend: {
x: 'center', x: 'center',
y: 'top', y: 'top',
data: ['传感器1', '传感器2'], data: ['传感器1', '传感器2'],
textStyle: {
fontWeight: 'normal',
color: '#fff', //标题颜色
},
}, },
xAxis: { xAxis: {
type: 'category', type: 'category',
boundaryGap: false,
axisLine: { axisLine: {
//y轴 //y轴
show: false, show: false,
}, },
// data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
}, },
yAxis: { yAxis: {
show: true, show: true,
@ -43,12 +51,56 @@ var option = {
data: [120, 932, 401, 534, 290, 530, 320], data: [120, 932, 401, 534, 290, 530, 320],
type: 'line', type: 'line',
smooth: true, smooth: true,
itemStyle: {
color: {
type: 'linear',
x: 0,
y: 0,
x2: 0,
y2: 1,
colorStops: [
{
offset: 0,
color: '#0A4982', // 0% 处的颜色
},
{
offset: 1,
color: '#243859', // 100% 处的颜色
},
],
global: false, // 缺省为 false
},
},
areaStyle: {},
lineStyle: { normal: { width: 4 } },
}, },
{ {
name: '传感器2', name: '传感器2',
data: [220, 632, 101, 834, 490, 630, 220], data: [220, 632, 101, 834, 490, 630, 220],
type: 'line', type: 'line',
smooth: true, smooth: true,
itemStyle: {
color: {
type: 'linear',
x: 0,
y: 0,
x2: 0,
y2: 1,
colorStops: [
{
offset: 0,
color: '#B2F2FC', // 0% 处的颜色
},
{
offset: 1,
color: '#5BE1FB', // 100% 处的颜色
},
],
global: false, // 缺省为 false
},
},
areaStyle: {},
lineStyle: { normal: { width: 4 } },
}, },
], ],
}; };

58
src/components/Statistics/Statistics.js

@ -1,6 +1,10 @@
var option = { var option = {
title: { title: {
left: '10%', left: '10%',
textStyle: {
fontWeight: 'normal',
color: '#fff', //标题颜色
},
text: '急救数据统计', text: '急救数据统计',
}, },
tooltip: { trigger: 'axis' }, tooltip: { trigger: 'axis' },
@ -9,27 +13,73 @@ var option = {
x: 'center', x: 'center',
y: 'top', y: 'top',
data: ['本年', '去年'], data: ['本年', '去年'],
textStyle: {
fontWeight: 'normal',
color: '#fff', //标题颜色
},
}, },
{ {
x: 'center', x: 'center',
y: 'bottom', y: 'bottom',
data: ['本年完成', '去年同期'], data: ['本年完成', '去年同期'],
textStyle: {
fontWeight: 'normal',
color: '#fff', //标题颜色
},
}, },
], ],
xAxis: { xAxis: {
type: 'category', type: 'category',
data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'], data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'],
axisLabel: {
textStyle: {
fontWeight: 'normal',
color: '#fff', //标题颜色
},
},
}, },
yAxis: [ yAxis: [
{ {
type: 'value', type: 'value',
interval: 100, interval: 200,
name: '人次', name: '人次',
axisTick: {
//y轴刻度线
show: false,
},
splitLine: {
show: true,
lineStyle: {
type: 'dashed',
color: '#666',
},
},
nameTextStyle: { color: '#fff' },
axisLabel: {
textStyle: {
fontWeight: 'normal',
color: '#fff', //标题颜色
},
},
}, },
{ {
type: 'value', type: 'value',
interval: 100, interval: 200,
name: '数量', name: '数量',
splitLine: {
show: true,
lineStyle: {
type: 'dashed',
color: '#666',
},
},
nameTextStyle: { color: '#fff' },
axisLabel: {
textStyle: {
fontWeight: 'normal',
color: '#fff', //标题颜色
},
},
}, },
], ],
series: [ series: [
@ -58,7 +108,7 @@ var option = {
position: 'top', //在上方显示 position: 'top', //在上方显示
textStyle: { textStyle: {
//数值样式 //数值样式
color: 'black', color: 'white',
fontSize: 12, fontSize: 12,
}, },
}, },
@ -78,7 +128,7 @@ var option = {
position: 'top', //在上方显示 position: 'top', //在上方显示
textStyle: { textStyle: {
//数值样式 //数值样式
color: 'black', color: 'white',
fontSize: 12, fontSize: 12,
}, },
}, },

Loading…
Cancel
Save