NEZ-1914 feat:根据chartShare参数开启图表联动
This commit is contained in:
@@ -158,9 +158,10 @@ export default {
|
||||
// timeSeries类型图表设置group 用于多表联动
|
||||
myChart.group = 'timeSeriesGroup'
|
||||
myChart.getZr().on('mousemove', params => {
|
||||
if (this.$store.state.panel.isconnect !== 1) {
|
||||
if (this.$store.state.panel.isConnect !== 'crosshair') {
|
||||
return false
|
||||
}
|
||||
// crosshair 模式才会执行
|
||||
if (this.$store.state.panel.currentMousemove !== this.chartId) {
|
||||
this.$store.commit('setCurrentMousemove', this.chartId)
|
||||
}
|
||||
|
||||
@@ -69,8 +69,8 @@ export default {
|
||||
return !lodash.isEmpty(this.chartInfo.param.legend.values)
|
||||
},
|
||||
// timeSeries类型图表联动
|
||||
isconnect () {
|
||||
return this.$store.state.panel.isconnect
|
||||
isConnect () {
|
||||
return this.$store.state.panel.isConnect
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
@@ -101,7 +101,7 @@ export default {
|
||||
|
||||
if (echarts) {
|
||||
// 判断timeSeries类型图表 先取消多表联动
|
||||
if (isTimeSeries(this.chartInfo.type) && this.isconnect) {
|
||||
if (isTimeSeries(this.chartInfo.type) && (this.isConnect && this.isConnect !== 'none')) {
|
||||
chart.disconnect('timeSeriesGroup')
|
||||
}
|
||||
if (!hasGrey) { // 1.除当前legend外全置灰
|
||||
@@ -127,7 +127,7 @@ export default {
|
||||
this.$set(this.isGrey, index, !this.isGrey[index])
|
||||
}
|
||||
// 判断timeSeries类型图表 建立多表联动
|
||||
if (isTimeSeries(this.chartInfo.type) && this.isconnect) {
|
||||
if (isTimeSeries(this.chartInfo.type) && (this.isConnect && this.isConnect !== 'none')) {
|
||||
chart.connect('timeSeriesGroup')
|
||||
}
|
||||
if (this.chartInfo.type !== 'pie' && this.chartInfo.type !== 'bar' && this.chartInfo.type !== 'treemap') {
|
||||
|
||||
@@ -40,19 +40,6 @@
|
||||
</el-input>
|
||||
</div> -->
|
||||
|
||||
<!-- 测试图表联动 -->
|
||||
<button slot="reference" class="top-tool-btn margin-r-10" @click="connect(1)" :class="{active:this.isconnect===1}">
|
||||
on-1
|
||||
</button>
|
||||
<!-- 测试图表联动 -->
|
||||
<button slot="reference" class="top-tool-btn margin-r-10" @click="connect(2)" :class="{active:this.isconnect===2}">
|
||||
on-2
|
||||
</button>
|
||||
<!-- 测试图表联动 -->
|
||||
<button slot="reference" class="top-tool-btn margin-r-10" @click="connect(false)" :class="{active:this.isconnect===false}">
|
||||
off
|
||||
</button>
|
||||
|
||||
<pick-time id="panel" ref="pickTime" v-model="searchTime" :refresh-data-func="dateChange" :use-chart-unit="false" class="margin-r-10" :sign="showPanel.id"></pick-time>
|
||||
|
||||
<!-- 切换查看模式 -->
|
||||
@@ -294,9 +281,7 @@ export default {
|
||||
// 导出html 以及 pdf的弹窗
|
||||
exportBoxShow: false,
|
||||
// 查看模式
|
||||
mode: '',
|
||||
// 多表联动(timeSeries类型图表)
|
||||
isconnect: false
|
||||
mode: ''
|
||||
}
|
||||
},
|
||||
components: {
|
||||
@@ -319,32 +304,6 @@ export default {
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
/**
|
||||
* @param {*} value // 1 表示不显示tooltip // 2 表示显示tooltip // false 表示不联动
|
||||
*/
|
||||
connect (value) {
|
||||
// 每次切换联动模式 tooltip设置显示
|
||||
const option = {
|
||||
tooltip: {
|
||||
className: 'chart-time-series'
|
||||
}
|
||||
}
|
||||
for (const key in chartCache) {
|
||||
if (!chartCache[key] || chartCache[key].group !== 'timeSeriesGroup') {
|
||||
continue
|
||||
}
|
||||
chartCache[key].setOption(option)
|
||||
}
|
||||
this.$store.commit('setCurrentMousemove', 0)
|
||||
this.isconnect = value
|
||||
if (this.isconnect) {
|
||||
this.$store.commit('setConnect', this.isconnect)
|
||||
echarts.connect('timeSeriesGroup')
|
||||
} else {
|
||||
this.$store.commit('setConnect', this.isconnect)
|
||||
echarts.disconnect('timeSeriesGroup')
|
||||
}
|
||||
},
|
||||
// 更新Weight
|
||||
updateWeight (value) {
|
||||
this.panelData = JSON.parse(JSON.stringify(value))
|
||||
@@ -1022,8 +981,6 @@ export default {
|
||||
time: this.searchTime,
|
||||
nowTimeType: this.nowTimeType
|
||||
})
|
||||
// 设置图表联动
|
||||
this.isconnect = this.$store.state.panel.isconnect
|
||||
},
|
||||
mounted () {
|
||||
// 监听键盘ESC事件
|
||||
@@ -1044,6 +1001,30 @@ export default {
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
'showPanel.params.chartShare': {
|
||||
handler (value) {
|
||||
// 每次切换联动模式 tooltip设置显示
|
||||
const option = {
|
||||
tooltip: {
|
||||
className: 'chart-time-series'
|
||||
}
|
||||
}
|
||||
for (const key in chartCache) {
|
||||
if (!chartCache[key] || chartCache[key].group !== 'timeSeriesGroup') {
|
||||
continue
|
||||
}
|
||||
chartCache[key].setOption(option)
|
||||
}
|
||||
this.$store.commit('setCurrentMousemove', 0)
|
||||
if (value && value !== 'none') {
|
||||
this.$store.commit('setConnect', value)
|
||||
echarts.connect('timeSeriesGroup')
|
||||
} else {
|
||||
this.$store.commit('setConnect', value)
|
||||
echarts.disconnect('timeSeriesGroup')
|
||||
}
|
||||
}
|
||||
},
|
||||
'filter.searchName': function (n, o) {
|
||||
const temp = this
|
||||
setTimeout(function () {
|
||||
|
||||
@@ -21,7 +21,7 @@ const panel = {
|
||||
// 查看模式
|
||||
mode: '',
|
||||
// timeSeries类型图表联动
|
||||
isconnect: false,
|
||||
isConnect: false,
|
||||
// 当前鼠标所在的图表id
|
||||
currentMousemove: 0
|
||||
},
|
||||
@@ -80,7 +80,7 @@ const panel = {
|
||||
},
|
||||
// 设置timeSeries类型图表联动
|
||||
setConnect (state, value) {
|
||||
state.isconnect = value
|
||||
state.isConnect = value
|
||||
},
|
||||
// 设置当前鼠标所在的图表id (timeSeries类型图表联动)
|
||||
setCurrentMousemove (state, value) {
|
||||
|
||||
Reference in New Issue
Block a user