You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

160 lines
4.2 KiB

5 years ago
import { mapState } from 'vuex';
const mixin = {
data() {
return {
5 years ago
series1: [10, 20, 30, 10, 20, 30, 10, 20, 30, 10, 20, 30, 10, 20, 30, 10, 20, 30], // 传感器1
series2: [20, 30, 10, 20, 30, 10, 20, 30, 10, 20, 30, 10, 20, 30, 10, 20, 30, 10], // 传感器2
series3: [30, 10, 20, 30, 10, 20, 30, 10, 20, 30, 10, 20, 30, 10, 20, 30, 10, 20], // 传感器3
5 years ago
};
5 years ago
},
5 years ago
computed: {
...mapState('messages', ['vibrationSensor']),
option() {
return {
legend: {
x: 'center',
5 years ago
y: '8%',
5 years ago
data: ['X轴', 'Y轴', 'Z轴'],
5 years ago
textStyle: {
fontWeight: 'normal',
color: '#ccc', //标题颜色
},
},
xAxis: {
type: 'category',
boundaryGap: false,
5 years ago
max: this.series1.length >= 6 ? this.series1.length - 1 : 6,
min: this.series1.length >= 6 ? this.series1.length - 6 : 0,
5 years ago
axisLine: {
//y轴
show: false,
},
},
yAxis: {
show: true,
type: 'value',
splitLine: { show: false }, //去除网格线
nameTextStyle: {
color: '#abb8ce',
show: false,
},
axisLabel: {
color: '#abb8ce',
show: false,
},
axisTick: {
//y轴刻度线
show: false,
},
axisLine: {
//y轴
show: false,
},
},
series: [
{
5 years ago
name: 'X轴',
5 years ago
data: this.series1,
type: 'line',
smooth: true,
symbol: 'none',
itemStyle: {
color: {
type: 'linear',
x: 0,
y: 0,
x2: 0,
y2: 1,
colorStops: [
{
offset: 0,
color: 'rgba(10,73,130,1)', // 0% 处的颜色
},
{
offset: 1,
color: 'rgba(10,73,130,0)', // 100% 处的颜色
},
],
global: false, // 缺省为 false
},
5 years ago
},
5 years ago
areaStyle: {},
lineStyle: { normal: { color: 'rgb(39,149,243)', width: 2 } },
},
{
5 years ago
name: 'Y轴',
5 years ago
data: this.series2,
type: 'line',
smooth: true,
symbol: 'none',
itemStyle: {
color: {
type: 'linear',
x: 0,
y: 0,
x2: 0,
y2: 1,
colorStops: [
{
offset: 0,
color: 'rgba(91,225,251,1)', // 0% 处的颜色
},
{
offset: 1,
color: 'rgba(91,225,251,0)', // 100% 处的颜色
},
],
global: false, // 缺省为 false
},
5 years ago
},
5 years ago
areaStyle: {},
lineStyle: {
normal: {
color: 'rgb(91,225,251)',
width: 2,
},
5 years ago
},
5 years ago
},
{
5 years ago
name: 'Z轴',
5 years ago
data: this.series3,
type: 'line',
smooth: true,
symbol: 'none',
itemStyle: {
color: {
type: 'linear',
x: 0,
y: 0,
x2: 0,
y2: 1,
colorStops: [
{
offset: 0,
color: 'rgba(241,158,194,1)', // 0% 处的颜色
},
{
offset: 1,
color: 'rgba(241,158,194,0)', // 100% 处的颜色
},
],
global: false, // 缺省为 false
},
5 years ago
},
5 years ago
areaStyle: {},
lineStyle: {
normal: {
color: 'rgb(241,158,194)',
width: 2,
},
},
},
],
};
},
},
5 years ago
watch: {},
5 years ago
};
5 years ago
export default mixin;