折线对比图

qianming 3 years ago
parent 893f623fbe
commit 22f31ae9ca

@ -31,27 +31,59 @@ export const widgetLineCompare = {
value: '' value: ''
}, },
[ [
/*{ {
name: '柱体设置', name: '折线设置',
list: [ list: [
{
type: 'el-switch',
label: '标记点',
name: 'markPoint',
required: false,
placeholder: '',
value: true,
},
{ {
type: 'el-slider', type: 'el-slider',
label: '最大宽度', label: '点大小',
name: 'maxWidth', name: 'pointSize',
required: false, required: false,
placeholder: '', placeholder: '',
value: 15, value: 10,
},
{
type: 'el-switch',
label: '平滑曲线',
name: 'smoothCurve',
required: false,
placeholder: '',
value: true,
},
{
type: 'el-switch',
label: '面积堆积',
name: 'area',
required: false,
placeholder: '',
value: true,
}, },
{ {
type: 'el-slider', type: 'el-slider',
label: '圆角', label: '面积厚度',
name: 'radius', name: 'areaThickness',
require: false, required: false,
placeholder: '', placeholder: '',
value: 5, value: 5,
}, },
{
type: 'el-slider',
label: '线条宽度',
name: 'lineWidth',
required: false,
placeholder: '',
value: 4,
},
], ],
},*/ },
{ {
name: '标题设置', name: '标题设置',
list: [ list: [
@ -117,12 +149,12 @@ export const widgetLineCompare = {
], ],
}, },
{ {
name: 'X轴设置', name: 'X轴设置',
list: [ list: [
{ {
type: 'el-switch', type: 'el-switch',
label: '显示', label: '显示',
name: 'hideXLeft', name: 'isShowX',
required: false, required: false,
placeholder: '', placeholder: '',
value: true, value: true,
@ -130,15 +162,23 @@ export const widgetLineCompare = {
{ {
type: 'el-input-number', type: 'el-input-number',
label: '数值间隔', label: '数值间隔',
name: 'splitNumberLeft', name: 'splitNumberX',
required: false, required: false,
placeholder: '', placeholder: '',
value: '' value: ''
}, },
{
type: 'el-switch',
label: '数值居中',
name: 'boundaryX',
required: false,
placeholder: '',
value: true,
},
{ {
type: 'vue-color', type: 'vue-color',
label: '数值颜色', label: '数值颜色',
name: 'XcolorLeft', name: 'colorX',
required: false, required: false,
placeholder: '', placeholder: '',
value: '#fff', value: '#fff',
@ -146,7 +186,7 @@ export const widgetLineCompare = {
{ {
type: 'el-input-number', type: 'el-input-number',
label: '数值字号', label: '数值字号',
name: 'fontSizeXLeft', name: 'fontSizeX',
required: false, required: false,
placeholder: '', placeholder: '',
value: 14, value: 14,
@ -154,68 +194,36 @@ export const widgetLineCompare = {
{ {
type: 'el-switch', type: 'el-switch',
label: '刻度线', label: '刻度线',
name: 'tickLineLeft', name: 'tickLineX',
require: false, require: false,
placeholder: '', placeholder: '',
value: false, value: true,
}, },
{ {
type: 'el-switch', type: 'el-switch',
label: 'X轴线', label: 'X轴线',
name: 'xLineLeft', name: 'lineX',
require: false, require: false,
placeholder: '', placeholder: '',
value: false, value: true,
}, },
{ {
type: 'vue-color', type: 'vue-color',
label: '轴颜色', label: '轴颜色',
name: 'lineColorXLeft', name: 'lineColorX',
required: false, required: false,
placeholder: '', placeholder: '',
value: '#fff', value: '#fff',
}, },
{
type: 'el-switch',
label: '竖分割线',
name: 'SplitLineLeft',
require: false,
placeholder: '',
value: false,
},
{
type: 'vue-color',
label: '分割线颜色',
name: 'SplitLineColorLeft',
required: false,
placeholder: '',
value: '#fff',
},
{
type: 'el-input-number',
label: '分割线宽度',
name: 'SplitLinefontSizeLeft',
required: false,
placeholder: '',
value: 1,
},
{
type: 'el-switch',
label: '边框线',
name: 'frameLineLeft',
require: false,
placeholder: '',
value: false,
},
], ],
}, },
{ {
name: '右X轴设置', name: '上y轴设置',
list: [ list: [
{ {
type: 'el-switch', type: 'el-switch',
label: '显示', label: '显示',
name: 'hideXRight', name: 'isShowYTop',
required: false, required: false,
placeholder: '', placeholder: '',
value: true, value: true,
@ -223,7 +231,7 @@ export const widgetLineCompare = {
{ {
type: 'el-input-number', type: 'el-input-number',
label: '数值间隔', label: '数值间隔',
name: 'splitNumberRight', name: 'splitNumberYTop',
required: false, required: false,
placeholder: '', placeholder: '',
value: '' value: ''
@ -303,7 +311,7 @@ export const widgetLineCompare = {
], ],
}, },
{ {
name: 'Y轴设置', name: 'Y轴设置',
list: [ list: [
{ {
type: 'el-switch', type: 'el-switch',

@ -29,13 +29,24 @@ export default {
}, },
tooltip: { tooltip: {
show: true, show: true,
trigger: "axis", trigger: 'axis',
axisPointer: { axisPointer: {
type: "line", type: 'line',
lineStyle: { lineStyle: {
type: "dashed", color: 'ffffff',
type: 'dashed',
},
}, },
/*axisPointer: {
type: 'cross',
lineStyle: {
color: 'ffffff',
type: 'dashed',
}, },
crossStyle: {
color: 'ffffff',
}
},*/
}, },
// //
grid: [ grid: [
@ -65,6 +76,7 @@ export default {
xAxis: [ xAxis: [
{// {//
gridIndex: 0, gridIndex: 0,
show: true,
type: 'category', type: 'category',
boundaryGap: true, // boundaryGap: true, //
axisLine: { //x线 axisLine: { //x线
@ -79,6 +91,7 @@ export default {
axisLabel: { // X axisLabel: { // X
show: true, show: true,
textStyle: { textStyle: {
interval: 0,
color: '#ffffff', color: '#ffffff',
fontSize: 14 fontSize: 14
} }
@ -87,6 +100,7 @@ export default {
}, },
{// {//
gridIndex: 1, gridIndex: 1,
show: true,
type: 'category', type: 'category',
position: 'top', position: 'top',
boundaryGap: true, // boundaryGap: true, //
@ -101,6 +115,7 @@ export default {
}, },
axisLabel: { axisLabel: {
show: false, show: false,
interval: 0,
}, },
data: [], data: [],
}, },
@ -129,6 +144,9 @@ export default {
color: '#ffffff', color: '#ffffff',
}, },
}, },
axisPointer: {
snap: true
},
}, },
{ {
gridIndex: 1, gridIndex: 1,
@ -153,6 +171,9 @@ export default {
color: '#ffffff', color: '#ffffff',
}, },
}, },
axisPointer: {
snap: true
},
}, },
], ],
series: [ series: [
@ -242,18 +263,18 @@ export default {
methods: { methods: {
// options // options
editorOptions() { editorOptions() {
/*this.setOptionsTitle(); this.setOptionsTitle();
this.setOptionsXLeft(); this.setOptionsX();
this.setOptionsXRight(); // this.setOptionsXRight();
this.setOptionsY(); // this.setOptionsY();
this.setOptionsTop(); // this.setOptionsTop();
this.setOptionsTooltip(); // this.setOptionsTooltip();
this.setOptionsGrid(); // this.setOptionsGrid();
this.setOptionsLegend(); // this.setOptionsLegend();
this.setOptionsColor();*/ // this.setOptionsColor();
this.setOptionsData(); this.setOptionsData();
}, },
/* // 标题修 //
setOptionsTitle() { setOptionsTitle() {
const optionsCollapse = this.optionsSetup; const optionsCollapse = this.optionsSetup;
const title = {}; const title = {};
@ -267,40 +288,54 @@ export default {
}; };
this.options.title = title; this.options.title = title;
}, },
// X // X
setOptionsXLeft() { setOptionsX() {
const optionsSetup = this.optionsSetup; const optionsSetup = this.optionsSetup;
const xAxisLeft = { const xAxis0 = {
splitNumber: optionsSetup.splitNumberLeft, gridIndex: 0,
type: 'value', show: optionsSetup.isShowX,
inverse: true, type: 'category',
axisLine: {//X线 boundaryGap: optionsSetup.boundaryX, //
show: optionsSetup.xLineLeft, axisLine: { //x线
show: optionsSetup.lineX,
lineStyle: { lineStyle: {
color: optionsSetup.lineColorXLeft, color: optionsSetup.lineColorX,
}, }
}, },
axisTick: { axisTick: { //
show: optionsSetup.tickLineLeft, show: optionsSetup.tickLineX,
}, },
position: 'bottom', axisLabel: { // X
axisLabel: { // x show: true,
show: optionsSetup.hideXLeft, interval: optionsSetup.splitNumberX,
textStyle: { textStyle: {
color: optionsSetup.XcolorLeft, color: optionsSetup.colorX,
fontSize: optionsSetup.fontSizeXLeft fontSize: optionsSetup.fontSizeX
} }
}, },
splitLine: { // 线
show: optionsSetup.SplitLineLeft,
lineStyle: {
color: optionsSetup.SplitLineColorLeft,
width: optionsSetup.SplitLinefontSizeLeft,
type: 'solid'
} }
const xAxis1 = {
gridIndex: 1,
show: optionsSetup.isShowX,
type: 'category',
position: 'top',
boundaryGap: optionsSetup.boundaryX, //
axisLine: { // x线
show: optionsSetup.lineX,
lineStyle: {
color: optionsSetup.lineColorX,
} }
},
axisTick: { //
show: optionsSetup.tickLineX,
},
axisLabel: {
show: false,
interval: optionsSetup.splitNumberX,
},
} }
this.options.xAxis[0] = xAxisLeft; this.options.xAxis[0] = xAxis0;
this.options.xAxis[1] = xAxis1;
}, },
// X // X
setOptionsXRight() { setOptionsXRight() {
@ -415,12 +450,12 @@ export default {
this.options.tooltip = tooltip; this.options.tooltip = tooltip;
}, },
// //
getOptionsBottom(){ getOptionsBottom() {
const optionsSetup = this.optionsSetup; const optionsSetup = this.optionsSetup;
let bottom = optionsSetup.marginBottom; let bottom = optionsSetup.marginBottom;
if (optionsSetup.hideXLeft) { if (optionsSetup.hideXLeft) {
bottom = optionsSetup.marginBottom + 15 bottom = optionsSetup.marginBottom + 15
}else if (optionsSetup.hideXRight){ } else if (optionsSetup.hideXRight) {
bottom = optionsSetup.marginBottom + 15 bottom = optionsSetup.marginBottom + 15
} }
return bottom return bottom
@ -495,7 +530,7 @@ export default {
} }
this.options.series[0].itemStyle = itemStyleLeft; this.options.series[0].itemStyle = itemStyleLeft;
this.options.series[1].itemStyle = itemStyleRight; this.options.series[1].itemStyle = itemStyleRight;
},*/ },
// //
setOptionsData() { setOptionsData() {
const optionsSetup = this.optionsSetup; const optionsSetup = this.optionsSetup;
@ -544,7 +579,6 @@ export default {
data: data data: data
}) })
} }
console.log(arrayList)
this.options.series[0]['name'] = arrayList[0].name this.options.series[0]['name'] = arrayList[0].name
this.options.series[0]['data'] = arrayList[0].data this.options.series[0]['data'] = arrayList[0].data
this.options.series[1]['name'] = arrayList[1].name this.options.series[1]['name'] = arrayList[1].name

Loading…
Cancel
Save