fix: 图表的时间轴刻度跟图表宽度关联(小于500时)

This commit is contained in:
zhangyu
2021-07-28 17:05:03 +08:00
parent 6d8da439df
commit 335ede10b7
2 changed files with 20 additions and 2 deletions

View File

@@ -1757,7 +1757,11 @@ export default {
resize () { resize () {
this.init() this.init()
this.$nextTick(() => { this.$nextTick(() => {
if (this.$parent.$parent.dateChange) {
this.$parent.$parent.dateChange() this.$parent.$parent.dateChange()
} else {
this.$parent.dateChange()
}
}) })
}, },
init () { init () {

View File

@@ -939,7 +939,6 @@ export default {
dot = 1 dot = 1
} }
dot = bus.countDecimals(value) dot = bus.countDecimals(value)
// console.log(dot,val)
if (dot < self.chartDot) { if (dot < self.chartDot) {
dot = self.chartDot dot = self.chartDot
} }
@@ -972,6 +971,14 @@ export default {
} else { } else {
option.xAxis.minInterval = 20 * 60 * 1000 option.xAxis.minInterval = 20 * 60 * 1000
} }
} else {
if (this.$refs.resizeBox.offsetWidth < 200) {
option.xAxis.splitNumber = 1
} else if (this.$refs.resizeBox.offsetWidth < 300) {
option.xAxis.splitNumber = 3
} else if (this.$refs.resizeBox.offsetWidth < 500) {
option.xAxis.splitNumber = 5
}
} }
// params.series = dataArg; // params.series = dataArg;
if (chartSite === 'local') { // 本地显示 if (chartSite === 'local') { // 本地显示
@@ -1009,6 +1016,13 @@ export default {
} else { } else {
self.noData = true self.noData = true
option = chartConfig.getOptionNoData('noData') option = chartConfig.getOptionNoData('noData')
if (self.$refs.resizeBox.offsetWidth < 200) {
option.xAxis.splitNumber = 1
} else if (self.$refs.resizeBox.offsetWidth < 300) {
option.xAxis.splitNumber = 3
} else if (self.$refs.resizeBox.offsetWidth < 500) {
option.xAxis.splitNumber = 5
}
getChart(self.chartIndex).clear() getChart(self.chartIndex).clear()
getChart(self.chartIndex).setOption(option)// 创建图表 getChart(self.chartIndex).setOption(option)// 创建图表
} }