折线对比图

qianming 4 years ago
parent 335645c370
commit 893f623fbe

@ -61,6 +61,7 @@ export default {
xAxis: [ xAxis: [
{// {//
splitNumber: 2, splitNumber: 2,
show: true,
type: 'value', type: 'value',
inverse: true, inverse: true,
axisLine: {//线 axisLine: {//线
@ -92,6 +93,7 @@ export default {
}, },
{// {//
gridIndex: 2, gridIndex: 2,
show: true,
type: 'value', type: 'value',
axisLine: { axisLine: {
show: false, show: false,
@ -302,6 +304,7 @@ export default {
const xAxisLeft = { const xAxisLeft = {
splitNumber: optionsSetup.splitNumberLeft, splitNumber: optionsSetup.splitNumberLeft,
type: 'value', type: 'value',
show : optionsSetup.hideXLeft,
inverse: true, inverse: true,
axisLine: {//X线 axisLine: {//X线
show: optionsSetup.xLineLeft, show: optionsSetup.xLineLeft,
@ -314,7 +317,7 @@ export default {
}, },
position: 'bottom', position: 'bottom',
axisLabel: { // x axisLabel: { // x
show: optionsSetup.hideXLeft, show: true,
textStyle: { textStyle: {
color: optionsSetup.XcolorLeft, color: optionsSetup.XcolorLeft,
fontSize: optionsSetup.fontSizeXLeft fontSize: optionsSetup.fontSizeXLeft
@ -337,6 +340,7 @@ export default {
const xAxisRight = { const xAxisRight = {
gridIndex: 2, gridIndex: 2,
splitNumber: optionsSetup.splitNumberRight, splitNumber: optionsSetup.splitNumberRight,
show : optionsSetup.hideXRight,
type: 'value', type: 'value',
axisLine: {//X线 axisLine: {//X线
show: optionsSetup.xLineRight, show: optionsSetup.xLineRight,
@ -349,7 +353,7 @@ export default {
}, },
position: 'bottom', position: 'bottom',
axisLabel: { // x axisLabel: { // x
show: optionsSetup.hideXRight, show: true,
textStyle: { textStyle: {
color: optionsSetup.XcolorRight, color: optionsSetup.XcolorRight,
fontSize: optionsSetup.fontSizeXRight fontSize: optionsSetup.fontSizeXRight
@ -444,16 +448,6 @@ export default {
this.options.tooltip = tooltip; this.options.tooltip = tooltip;
}, },
// //
getOptionsBottom(){
const optionsSetup = this.optionsSetup;
let bottom = optionsSetup.marginBottom;
if (optionsSetup.hideXLeft) {
bottom = optionsSetup.marginBottom + 15
}else if (optionsSetup.hideXRight){
bottom = optionsSetup.marginBottom + 15
}
return bottom
},
setOptionsGrid() { setOptionsGrid() {
const optionsSetup = this.optionsSetup; const optionsSetup = this.optionsSetup;
const grid = [ const grid = [
@ -469,7 +463,7 @@ export default {
show: false, show: false,
left: "51%", left: "51%",
top: optionsSetup.marginTop, top: optionsSetup.marginTop,
bottom: this.getOptionsBottom(), bottom: optionsSetup.marginBottom + 15,
width: '0%' width: '0%'
}, },
{// {//

@ -16,13 +16,27 @@ export default {
data() { data() {
return { return {
options: { options: {
axisPointer: {
link: {
xAxisIndex: "all",
},
},
title: { title: {
//text: '',
x: 'center', x: 'center',
textStyle: { textStyle: {
color: '#ffffff', color: '#ffffff',
}, },
}, },
tooltip: {
show: true,
trigger: "axis",
axisPointer: {
type: "line",
lineStyle: {
type: "dashed",
},
},
},
// //
grid: [ grid: [
{// {//
@ -52,60 +66,92 @@ export default {
{// {//
gridIndex: 0, gridIndex: 0,
type: 'category', type: 'category',
boundaryGap: false, boundaryGap: true, //
axisLine: { //线 axisLine: { //x线
onZero: false, show: true,
lineStyle: {
color: '#ffffff',
}
}, },
splitNumber: 2, axisTick: { //
inverse: true, show: true,
axisTick: {
show: false,
}, },
//position: 'bottom', axisLabel: { // X
axisLabel: { // x
show: true, show: true,
textStyle: { textStyle: {
color: '#ffffff', color: '#ffffff',
fontSize: 12 fontSize: 14
} }
}, },
data: [] data: [],
}, },
{// {//
gridIndex: 1, gridIndex: 1,
type: 'category', type: 'category',
position: 'top', position: 'top',
boundaryGap: false, boundaryGap: true, //
axisLine: { axisLine: { // x线
show: false, show: true,
lineStyle: {
color: '#ffffff',
}
}, },
axisTick: { axisTick: { //
show: true,
},
axisLabel: {
show: false, show: false,
}, },
//position: 'bottom', data: [],
},
],
yAxis: [
{
gridIndex: 0,
show: true,
scale: true, // 0,false0
axisLabel: { axisLabel: {
show: true, show: true,
textStyle: { textStyle: {
color: '#ffffff', color: '#ffffff',
fontSize: 12, fontSize: 14,
}, },
}, },
axisLine: { // 线
show: true,
lineStyle: {
color: '#ffffff',
},
}, },
],
yAxis: [
{
gridIndex: 0,
scale: true,
splitLine: { splitLine: {
show: false, show: false,
lineStyle: {
color: '#ffffff',
},
}, },
}, },
{ {
gridIndex: 1, gridIndex: 1,
scale: true, scale: false, // 0
inverse: true, inverse: true, //
axisLabel: {
show: true,
textStyle: {
color: '#ffffff',
fontSize: 14,
},
},
axisLine: { // 线
show: true,
lineStyle: {
color: '#ffffff',
},
},
splitLine: { splitLine: {
show: false, show: false,
lineStyle: {
color: '#ffffff',
},
}, },
}, },
], ],
@ -115,32 +161,21 @@ export default {
type: 'line', type: 'line',
xAxisIndex: 0, xAxisIndex: 0,
yAxisIndex: 0, yAxisIndex: 0,
smooth: true, smooth: true, // 线线
barGap: 20,
barWidth: 15,
/*label: {
normal: {
show: true,
color: 'red',
position: 'insideLeft',
textStyle: {
color: '#ffffff',
}
},
emphasis: {
show: false,
},
},
itemStyle: { itemStyle: {
normal: {
color: '#36c5e7', color: '#36c5e7',
barBorderRadius: [8, 0, 0, 8],
}, },
emphasis: { lineStyle: {
show: false, color: '#36c5e7',
width: 2,
},
label: {
position: 'top',
distance: 10,
show: true,
color: '#36c5e7',
fontSize: 14,
}, },
},*/
data: [], data: [],
}, },
{ {
@ -148,28 +183,21 @@ export default {
type: 'line', type: 'line',
xAxisIndex: 1, xAxisIndex: 1,
yAxisIndex: 1, yAxisIndex: 1,
smooth: true, smooth: true, // 线线
barGap: 20,
barWidth: 15,
/*label: {
normal: {
show: true,
color: 'red',
position: 'insideRight',
textStyle: {
color: '#ffffff',
}
},
},
itemStyle: { itemStyle: {
normal: {
color: '#e68b55', color: '#e68b55',
barBorderRadius: [0, 8, 8, 0],
}, },
emphasis: { lineStyle: {
show: false, color: '#e68b55',
width: 2,
},
label: {
position: 'bottom',
distance: 10,
show: true,
color: '#e68b55',
fontSize: 16,
}, },
},*/
data: [], data: [],
}, },
] ]
@ -522,6 +550,7 @@ export default {
this.options.series[1]['name'] = arrayList[1].name this.options.series[1]['name'] = arrayList[1].name
this.options.series[1]['data'] = arrayList[1].data this.options.series[1]['data'] = arrayList[1].data
this.options.xAxis[0]['data'] = xAxisList this.options.xAxis[0]['data'] = xAxisList
this.options.xAxis[1]['data'] = xAxisList
}, },
// //
dynamicDataFn(val, refreshTime, optionsSetup) { dynamicDataFn(val, refreshTime, optionsSetup) {

@ -180,7 +180,7 @@ export default {
axisLabel: { axisLabel: {
show: true, show: true,
textStyle: { textStyle: {
color: optionsCollapse.colorY, // x color: optionsCollapse.colorY, // y
fontSize: optionsCollapse.fontSizeY fontSize: optionsCollapse.fontSizeY
} }
}, },

Loading…
Cancel
Save