fix:修改timebar的tooltip

This commit is contained in:
zhangyu
2022-01-25 19:16:31 +08:00
parent 50dccf6a3c
commit f22a1f30eb
2 changed files with 17 additions and 7 deletions

View File

@@ -40,6 +40,12 @@ import { getChartColor } from '@/components/charts/chart-options'
import * as echarts from 'echarts' import * as echarts from 'echarts'
export default { export default {
name: 'ChartIpOpenPortBar', name: 'ChartIpOpenPortBar',
setup () {
const myChart = null
return {
myChart
}
},
props: { props: {
chartInfo: Object, chartInfo: Object,
chartData: [Array, Object], chartData: [Array, Object],
@@ -48,7 +54,6 @@ export default {
}, },
data () { data () {
return { return {
myChart: null,
chartOption: null, chartOption: null,
tableData: [], tableData: [],
tableKey: [ tableKey: [

View File

@@ -15,9 +15,14 @@ import { getCharBartColor, timeBarTooltipFormatter } from '@/views/charts/charts
export default { export default {
name: 'ChaetTimeBar', name: 'ChaetTimeBar',
setup () {
const myChart = null
return {
myChart
}
},
data () { data () {
return { return {
myChart: null,
chartOption: null chartOption: null
} }
}, },
@@ -33,11 +38,11 @@ export default {
const dom = document.getElementById(id) const dom = document.getElementById(id)
!this.myChart && (this.myChart = echarts.init(dom)) !this.myChart && (this.myChart = echarts.init(dom))
this.chartOption = this.$_.cloneDeep(timeBar) this.chartOption = this.$_.cloneDeep(timeBar)
this.chartOption.tooltip.trigger = 'item' // this.chartOption.tooltip.trigger = 'item'
this.chartOption.tooltip.formatter = (params) => { // this.chartOption.tooltip.formatter = (params) => {
const str = timeBarTooltipFormatter(params, chartParams.direction) // const str = timeBarTooltipFormatter(params, chartParams.direction)
return str // return str
} // }
if (!chartParams.itemColorAlternately) { if (!chartParams.itemColorAlternately) {
this.chartOption.series[0].itemStyle.color = function (params) { this.chartOption.series[0].itemStyle.color = function (params) {
return getCharBartColor(0) return getCharBartColor(0)