hbt-training-ui/src/components/manage/right/chartData.js

253 lines
7.2 KiB
JavaScript

export const lineChartData = function () {
return {
color:['#FADFA4','#947FEA'],
xAxis: {
type: 'category',
splitLine: {
show: true,
lineStyle: {
color: '#999999',
type: 'solid'
},
},
axisLabel: {
//x轴文字的配置
show: true,
interval: 0,//使x轴文字显示全
},
axisLine: {
lineStyle: {
color: '#999999',
}
},
data: ['1月','2月','3月','4月','5月']
},
legend: {
top: 'top',
itemGap: 30,
itemWidth: 8,
itemHeight: 8,
textStyle: {
// 未单独设置样式的图例(即非上下标)
lineHeight: 12,
verticalAlign: "middle",
fontSize: 10,
color: "#fff"
},
data:[
{
name:'应急事件',
icon:'roundRect'
},{
name:'应急演练',
icon:'roundRect'
}
]
},
yAxis: {
type: 'value',
splitLine: {
show: true,
lineStyle: {
color: '#999999',
type: 'solid'
},
},
axisLine: {
lineStyle: {
color: '#999999',
}
},
},
series: [
{
name:'应急事件',
data: [60,80,140,70,100],
type: 'line',
symbolSize: 4,
symbol: 'circle',
lineStyle: {
width: 2
},
smooth: true,
label: {
show: false,
position: 'top',
color: '#ffffff',
borderWidth: 0
},
},{
name:'应急演练',
data: [50,70,130,60,90],
type: 'line',
symbolSize: 4,
symbol: 'circle',
lineStyle: {
width: 2
},
smooth: true,
label: {
show: false,
position: 'top',
color: '#ffffff',
borderWidth: 0
},
}
],
tooltip: {
trigger: 'item',
backgroundColor:"rgba(0,0,0,0.6)",
borderWidth:0,
textStyle:{
color:"rgba(255,255,255,0.8)",
},
},
grid: {
x: 30,
y: 30,
x2: 12,
y2: 20,
}
}
}
export const lineChartData1 = function () {
let xLabel = ['周一', '周二', '周三', '周四', '周五', '周六', '周日'];
let dataValue = ['50', '150', '60', '110', '60', '200', '150'];
let dataValue1 = ['10', '60', '25', '45', '60', '76', '60'];
return {
dataZoom : {
type:"inside",
// orient:"vertical",
startValue:0,
endValue:10
},
legend: {
show: false,
top: '10%',
icon: "rect",
itemWidth: 10, // 图例标记的图形宽度。
// itemGap: 20, // 图例每项之间的间隔。
itemHeight: 10, // 图例标记的图形高度。
textStyle: {
color: '#fff',
fontSize: 14,
padding: [0, 8, 0, 8]
}
},
grid: {
top: '15%',
left: '10%',
right: '5%',
bottom: '20%',
},
xAxis: {
boundaryGap: false,
name:'日',
type: 'category',
splitLine: {
show: true,
lineStyle: {
color: 'rgba(153,153,153,0.4)',
type: 'solid'
},
},
axisLabel: {
//x轴文字的配置
show: true,
// interval: 0,//使x轴文字显示全
},
axisLine: {
lineStyle: {
color: '#999999',
}
},
data: xLabel
},
yAxis: {
type: 'value',
name:'单位:吨',
nameLocation:'end',
splitLine: {
show: true,
lineStyle: {
color: 'rgba(153,153,153,0.4)',
type: 'solid'
},
},
axisLine: {
lineStyle: {
color: '#999999',
}
},
},
series: [
{
name: '示例示例',
type: 'line',
symbol: 'circle', // 默认是空心圆(中间是白色的),改成实心圆
smooth: true,
color:'#FADFA4',
lineStyle: {
color:'#FADFA4',
normal: {
width: 2,
},
},
symbolSize: 4, //设定实心点的大小
data: dataValue,
areaStyle: {
normal: {
color: {
type: 'linear',
x: 0,
y: 0,
x2: 0,
y2: 1,
colorStops: [{
offset: 0, color: 'rgba(250,223,164,0.2)'
}, {
offset: 1, color: 'rgba(250,223,164,0.2)'
}],
global: false
}
},
},
},
{
name: '示例示例',
type: 'line',
symbol: 'circle', // 默认是空心圆(中间是白色的),改成实心圆
smooth: true,
color:'#947FEA',
lineStyle: {
normal: {
width: 2,
},
},
symbolSize: 4, //设定实心点的大小
data: dataValue1,
areaStyle: {
normal: {
color: {
type: 'linear',
x: 0,
y: 0,
x2: 0,
y2: 1,
colorStops: [{
offset: 0, color: 'rgba(148,127,234,0.2)'
}, {
offset: 1, color: 'rgba(148,127,234,0.2)'
}],
global: false
}
},
},
}
]
}
}