fix: pie bar treemap tooltip不显示的问题 ,以及仪表盘全屏的问题
This commit is contained in:
@@ -84,7 +84,13 @@ export default {
|
||||
if (this.isNoData) {
|
||||
return
|
||||
}
|
||||
chartOption.xAxis.data = chartOption.series[0].data.map(item => item.name)
|
||||
chartOption.xAxis.data = chartOption.series[0].data.map(item => {
|
||||
if (this.chartInfo.param.text == 'all' || this.chartInfo.param.text == 'legend') {
|
||||
return item.name
|
||||
} else {
|
||||
return ''
|
||||
}
|
||||
})
|
||||
chartOption.axisLabel = {
|
||||
margin: 8,
|
||||
formatter (params) {
|
||||
|
||||
@@ -47,24 +47,39 @@ import { randomcolor } from '@/components/common/js/radomcolor/randomcolor'
|
||||
export default {
|
||||
name: 'chart-guage',
|
||||
mixins: [chartMixin, chartFormat],
|
||||
watch: {
|
||||
isFullscreen: {
|
||||
immediate: true,
|
||||
handler (n) {
|
||||
console.log(n)
|
||||
}
|
||||
}
|
||||
},
|
||||
data () {
|
||||
return {
|
||||
gaugeData: [],
|
||||
boxWidth: 0,
|
||||
boxHeight: 0,
|
||||
boxPadding: 5,
|
||||
chartInstances: []
|
||||
chartInstances: [],
|
||||
timer: null
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
initChart () {
|
||||
this.initGaugeData(this.chartInfo, this.chartData).then(() => {
|
||||
this.getLayout().then(layout => {
|
||||
this.renderGauge(layout).then(() => {
|
||||
this.gaugeChartInit()
|
||||
if (this.timer) {
|
||||
clearTimeout(this.timer)
|
||||
this.timer = null
|
||||
}
|
||||
this.timer = setTimeout(() => {
|
||||
this.initGaugeData(this.chartInfo, this.chartData).then(() => {
|
||||
this.getLayout().then(layout => {
|
||||
this.renderGauge(layout).then(() => {
|
||||
this.gaugeChartInit()
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
}, 200)
|
||||
},
|
||||
initGaugeData (chartInfo, originalDatas) {
|
||||
this.gaugeData = []
|
||||
@@ -161,7 +176,7 @@ export default {
|
||||
this.chartInstances = []
|
||||
const self = this
|
||||
this.gaugeData.forEach((item, index) => {
|
||||
const chartId = this.isFullScreen ? 'chart-gauge-screen-' : 'chart-gauge-'
|
||||
const chartId = this.isFullscreen ? 'chart-gauge-screen-' : 'chart-gauge-'
|
||||
const myChart = echarts.init(document.getElementById(chartId + this.chartInfo.id + '-' + index))
|
||||
const option = lodash.cloneDeep(this.chartOption)
|
||||
option.tooltip = {}
|
||||
@@ -252,6 +267,10 @@ export default {
|
||||
item.dispose()
|
||||
}
|
||||
})
|
||||
if (this.timer) {
|
||||
clearTimeout(this.timer)
|
||||
this.timer = null
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
const chartBarOption = {
|
||||
tooltip: {
|
||||
trigger: 'axis',
|
||||
show: true,
|
||||
trigger: 'item',
|
||||
confine: false,
|
||||
extraCssText: 'z-index:1000;',
|
||||
z: 9,
|
||||
@@ -11,7 +12,10 @@ const chartBarOption = {
|
||||
show: false
|
||||
},
|
||||
xAxis: {
|
||||
type: 'category'
|
||||
type: 'category',
|
||||
axisTick: {
|
||||
show: false
|
||||
}
|
||||
},
|
||||
yAxis: {
|
||||
type: 'value'
|
||||
|
||||
@@ -1,4 +1,13 @@
|
||||
const chartGaugeOption = {
|
||||
tooltip: {
|
||||
show: true,
|
||||
trigger: 'item',
|
||||
confine: false,
|
||||
extraCssText: 'z-index:1000;',
|
||||
z: 9,
|
||||
animation: false,
|
||||
appendToBody: true
|
||||
},
|
||||
series: [
|
||||
{
|
||||
type: 'gauge',
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
const chartPieOption = {
|
||||
tooltip: {
|
||||
trigger: 'axis',
|
||||
show: true,
|
||||
trigger: 'item',
|
||||
confine: false,
|
||||
extraCssText: 'z-index:1000;',
|
||||
z: 9,
|
||||
|
||||
@@ -2,7 +2,7 @@ import * as echarts from 'echarts'
|
||||
const formatUtil = echarts.format
|
||||
const chartTreemapOption = {
|
||||
tooltip: {
|
||||
trigger: 'axis',
|
||||
trigger: 'item',
|
||||
confine: false,
|
||||
extraCssText: 'z-index:1000;',
|
||||
z: 9,
|
||||
|
||||
@@ -3,6 +3,15 @@ export default {
|
||||
pieFormatterLabel (params) {
|
||||
const self = this
|
||||
let str = ''
|
||||
if (this.chartInfo.type == 'bar') { // 柱状图 单独处理
|
||||
if (this.chartInfo.param.text === 'value' || !this.chartInfo.param.text || this.chartInfo.param.text === 'all' ) {
|
||||
str += params.data.mapping && params.data.mapping.display ? self.handleDisplay(params.data.mapping.display, { ...params.data.labels, value: params.data.showValue }) : params.data.showValue
|
||||
return str
|
||||
}
|
||||
if (this.chartInfo.param.text === 'none' || this.chartInfo.param.text === 'legend') {
|
||||
return str
|
||||
}
|
||||
}
|
||||
if (this.chartInfo.param.text === 'all') {
|
||||
str += params.data.alias
|
||||
str += '\n'
|
||||
@@ -58,6 +67,6 @@ export default {
|
||||
minValue = valueSorted.length ? valueSorted[0][1] : ''
|
||||
maxValue = valueSorted.length ? valueSorted[valueSorted.length - 1][1] : ''
|
||||
return { minTime, maxTime, minValue, maxValue }
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@
|
||||
:loading="loading"
|
||||
:minusTime="minusTime"
|
||||
:multipleTime="multipleTime"
|
||||
:is-fullscreen="isFullscreen"
|
||||
:isFullscreen="isFullscreen"
|
||||
:showAllData="showAllData"
|
||||
v-if="!isGroup(chartInfo.type) || !chartInfo.param.collapse"
|
||||
></chart>
|
||||
|
||||
Reference in New Issue
Block a user