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