|
|
@ -1,6 +1,6 @@
|
|
|
|
<template>
|
|
|
|
<template>
|
|
|
|
<div :style="styleObj">
|
|
|
|
<div :style="styleObj">
|
|
|
|
<v-chart ref="myVChart" :options="options" autoresize />
|
|
|
|
<v-chart ref="myVChart" :options="options" autoresize/>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
|
@ -317,10 +317,10 @@ export default {
|
|
|
|
optionsData.dataType == "staticData"
|
|
|
|
optionsData.dataType == "staticData"
|
|
|
|
? this.staticDataFn(optionsData.staticData, optionsSetup)
|
|
|
|
? this.staticDataFn(optionsData.staticData, optionsSetup)
|
|
|
|
: this.dynamicDataFn(
|
|
|
|
: this.dynamicDataFn(
|
|
|
|
optionsData.dynamicData,
|
|
|
|
optionsData.dynamicData,
|
|
|
|
optionsData.refreshTime,
|
|
|
|
optionsData.refreshTime,
|
|
|
|
optionsSetup
|
|
|
|
optionsSetup
|
|
|
|
);
|
|
|
|
);
|
|
|
|
},
|
|
|
|
},
|
|
|
|
//去重
|
|
|
|
//去重
|
|
|
|
setUnique(arr) {
|
|
|
|
setUnique(arr) {
|
|
|
@ -406,7 +406,7 @@ export default {
|
|
|
|
this.options.yAxis.type = "value";
|
|
|
|
this.options.yAxis.type = "value";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// 根据图表的宽度 x轴的字体大小、长度来估算X轴的label能展示多少个字
|
|
|
|
// 根据图表的宽度 x轴的字体大小、长度来估算X轴的label能展示多少个字
|
|
|
|
const wordNum = parseInt((this.optionsStyle.width / xAxisList.length) / optionsSetup.fontSizeX);
|
|
|
|
const rowsNum = optionsSetup.textRowsNum !== "" ? optionsSetup.textRowsNum : parseInt((this.optionsStyle.width / xAxisList.length) / optionsSetup.fontSizeX);
|
|
|
|
const axisLabel = {
|
|
|
|
const axisLabel = {
|
|
|
|
show: true,
|
|
|
|
show: true,
|
|
|
|
interval: optionsSetup.textInterval,
|
|
|
|
interval: optionsSetup.textInterval,
|
|
|
@ -423,7 +423,7 @@ export default {
|
|
|
|
let str = ''
|
|
|
|
let str = ''
|
|
|
|
for (let i = 0, s; s = strs[i++];) {
|
|
|
|
for (let i = 0, s; s = strs[i++];) {
|
|
|
|
str += s;
|
|
|
|
str += s;
|
|
|
|
if (!(i % wordNum)) str += '\n';
|
|
|
|
if (!(i % rowsNum)) str += '\n';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return str
|
|
|
|
return str
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -509,10 +509,10 @@ export default {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// 根据图表的宽度 x轴的字体大小、长度来估算X轴的label能展示多少个字
|
|
|
|
// 根据图表的宽度 x轴的字体大小、长度来估算X轴的label能展示多少个字
|
|
|
|
let xAxisDataLength = 1;
|
|
|
|
let xAxisDataLength = 1;
|
|
|
|
if (val.length !== 0){
|
|
|
|
if (val.length !== 0) {
|
|
|
|
xAxisDataLength = val.xAxis.length;
|
|
|
|
xAxisDataLength = val.xAxis.length;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
const wordNum = parseInt((this.optionsStyle.width / xAxisDataLength) / optionsSetup.fontSizeX);
|
|
|
|
const rowsNum = optionsSetup.textRowsNum !== "" ? optionsSetup.textRowsNum : parseInt((this.optionsStyle.width / xAxisDataLength) / optionsSetup.fontSizeX);
|
|
|
|
const axisLabel = {
|
|
|
|
const axisLabel = {
|
|
|
|
show: true,
|
|
|
|
show: true,
|
|
|
|
interval: optionsSetup.textInterval,
|
|
|
|
interval: optionsSetup.textInterval,
|
|
|
@ -529,7 +529,7 @@ export default {
|
|
|
|
let str = ''
|
|
|
|
let str = ''
|
|
|
|
for (let i = 0, s; s = strs[i++];) {
|
|
|
|
for (let i = 0, s; s = strs[i++];) {
|
|
|
|
str += s;
|
|
|
|
str += s;
|
|
|
|
if (!(i % wordNum)) str += '\n';
|
|
|
|
if (!(i % rowsNum)) str += '\n';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return str
|
|
|
|
return str
|
|
|
|
}
|
|
|
|
}
|
|
|
|