${seriesName}
@@ -377,41 +393,27 @@ export default {
tooltipLeftOffset = parseFloat(over.style.left)
tooltipTopOffset = parseFloat(over.style.top)
u.root.querySelector('.u-wrap').appendChild(tooltip)
-
- let clientX
- let clientY
- over.addEventListener('mouseleave', () => {
- if (!u.cursor._lock) {
- hideTooltip()
- }
- })
- over.addEventListener('mousedown', e => {
- clientX = e.clientX
- clientY = e.clientY
- })
- over.addEventListener('mouseup', e => {
- if (e.clientX == clientX && e.clientY == clientY) {
- if (seriesIdx != null && dataIdx != null) {
- onclick(u, seriesIdx, dataIdx)
- }
- }
- })
+ over.addEventListener('mouseenter', self.uplotMouseenter)
+ // over.addEventListener('mouseleave', self.uplotMouseleave.bind(self, hideTooltip, over)) 放入mouseenter 减少绑定事件数量
+ // over.addEventListener('mousemove', self.uplotMousemove)
+ // over.addEventListener('mousedown', self.uplotMousedown)
+ // over.addEventListener('mouseup', self.uplotMouseup.bind(self, nodeInfo))
}
],
setCursor: [
u => {
const c = u.cursor
- if (dataIdx != c.idx) {
- dataIdx = c.idx
+ if (self.dataIdx != c.idx) {
+ self.dataIdx = c.idx
setTooltip(u)
}
}
],
setSeries: [
(u, sidx) => {
- if (seriesIdx != sidx) {
- seriesIdx = sidx
- if (dataIdx != null) { setTooltip(u) }
+ if (self.seriesIdx != sidx) {
+ this.seriesIdx = sidx
+ if (self.dataIdx != null) { setTooltip(u) }
}
}
]
@@ -422,7 +424,6 @@ export default {
const self = this
return function (val, index) {
const value = self.momentStrToTimestamp(self.momentTz(val))
- console.log(value)
let offset = localStorage.getItem('nz-sys-timezone')
offset = moment.tz(offset).format('Z')
offset = Number.parseInt(offset)
@@ -462,5 +463,127 @@ export default {
}
}
},
+ uplotMouseenter () {
+ const chart = getChart(this.chartId)
+ const over = chart.over
+ over.addEventListener('mouseleave', this.uplotMouseleave)
+ over.addEventListener('mousemove', this.uplotMousemove)
+ over.addEventListener('mousedown', this.uplotMousedown)
+ over.addEventListener('mouseup', this.uplotMouseup)
+ this.$store.commit('setCurrentMousemove', this.chartId)
+ },
+ uplotMouseleave () {
+ const chart = getChart(this.chartId)
+ const over = chart.over
+ over.removeEventListener('mouseleave', this.uplotMouseleave)
+ over.removeEventListener('mousemove', this.uplotMousemove)
+ over.removeEventListener('mousedown', this.uplotMousedown)
+ over.removeEventListener('mouseup', this.uplotMouseup)
+ },
+ uplotMousemove (e) {
+ this.mousePosition = {
+ left: e.pageX,
+ top: e.pageY
+ }
+ },
+ uplotMousedown (e) {
+ this.toolbox.x = e.clientX
+ this.toolbox.y = e.clientY
+ },
+ uplotMouseup (e) {
+ if (e.clientX == this.toolbox.x && e.clientY == this.toolbox.y) {
+ if (this.seriesIdx) {
+ this.toolbox.show = true
+ this.datalinkClick(this.seriesIdx, this.dataIdx)
+ const windowWidth = window.innerWidth// 窗口宽度
+ const windowHeight = window.innerHeight// 窗口高度
+ this.$nextTick(() => {
+ const box = document.getElementById(`chart-toolbox-${this.chartId}`)
+ const left = e.pageX - this.$refs['timeSeries-chart-box'].getBoundingClientRect().left
+ const top = e.pageY - this.$refs['timeSeries-chart-box'].getBoundingClientRect().top
+ if (box) {
+ const boxWidth = box.offsetWidth
+ const boxHeight = box.offsetHeight
+ if (e.pageX < (windowWidth / 2)) { // 说明鼠标在左边放不下提示框
+ this.toolbox.x = left + 15
+ } else {
+ this.toolbox.x = left - boxWidth - 15
+ }
+ if (e.pageY + 50 + boxHeight < windowHeight) { // 说明鼠标上面放不下提示框
+ this.toolbox.y = top + 15
+ } else {
+ this.toolbox.y = top - boxHeight - 10
+ }
+ }
+ })
+ } else {
+ this.toolbox.show = false
+ }
+ }
+ },
+ datalinkClick (seriesIdx, dataIdx, e) { // 处理datalink数据
+ const obj = this.series[seriesIdx - 1]
+ const chart = getChart(this.chartId)
+ const params = {
+ seriesIndex: seriesIdx - 1,
+ yAxisIndex: obj.yAxisIndex,
+ value: [chart.data[0][dataIdx], chart.data[seriesIdx][dataIdx]],
+ seriesName: obj.label
+ }
+ console.log(params)
+ if (!params.seriesName) {
+ return
+ }
+ const nameArr = params.seriesName.split('-')
+ if (nameArr.length > 1) {
+ nameArr.splice(nameArr.length - 1, 1)
+ }
+ const seriesName = nameArr.join('-')
+ if (this.series[params.seriesIndex]) {
+ params.yAxisIndex = this.series[params.seriesIndex].yAxisIndex
+ }
+ const decimals = this.chartInfo.param.decimals || 2
+ let unit = this.chartInfo.unit ? this.chartInfo.unit : 2
+ if (params.yAxisIndex == 1) {
+ unit = lodash.get(this, 'chartInfo.param.rightYAxis.unit', 2)
+ }
+ // title
+ const value = bus.computeTimezone(params.value[0] * 1000)
+ const tData = new Date(value)
+ // value
+ let paramsDot = bus.countDecimals(params.value[1])
+ if (paramsDot < this.chartDot) {
+ paramsDot = this.chartDot
+ } else if (paramsDot > 6) {
+ paramsDot = 6
+ }
+ const val = formatScientificNotation(params.value[1], paramsDot)
+ // 根据左右轴设置图标
+ let className = 'row__color-block'
+ if (params.yAxisIndex == 0) {
+ className = 'yAxis-icon nz-icon nz-icon-zuozongzhou'
+ } else if (params.yAxisIndex == 1) {
+ className = 'yAxis-icon nz-icon nz-icon-youzongzhou'
+ }
+ const color = this.colorList[params.seriesIndex]
+ this.toolbox.tooltipHtml = `
+
+ `
+ this.toolbox.show = true
+ this.toolbox.metric.labels = this.series[params.seriesIndex].labels
+ this.toolbox.metric.expressionIndex = this.series[params.seriesIndex].expressionIndex
+ this.toolbox.clickIndex = params.seriesIndex
+ }
}
}
diff --git a/nezha-fronted/src/components/chart/chartMixin.js b/nezha-fronted/src/components/chart/chartMixin.js
index 38fc96eab..fc13db86d 100644
--- a/nezha-fronted/src/components/chart/chartMixin.js
+++ b/nezha-fronted/src/components/chart/chartMixin.js
@@ -189,7 +189,6 @@ export default {
},
// 单个legend
handleLegend (chartInfo, data, expressionIndexs, dataIndex, colorIndex) {
- console.log(chartInfo, data, expressionIndexs, dataIndex, colorIndex)
let expressionIndex = expressionIndexs
let legend = '' // up
let alias = ''
diff --git a/nezha-fronted/src/components/common/bottomBox/tabs/alertMessageTabNew.vue b/nezha-fronted/src/components/common/bottomBox/tabs/alertMessageTabNew.vue
index efbd9aefc..d2fc61184 100644
--- a/nezha-fronted/src/components/common/bottomBox/tabs/alertMessageTabNew.vue
+++ b/nezha-fronted/src/components/common/bottomBox/tabs/alertMessageTabNew.vue
@@ -583,7 +583,6 @@ export default {
routePathParams.body.startAt = this.searchTimeHeader[0] ? this.momentStrToTimestamp(this.searchTimeHeader[0]) : ''
routePathParams.body.endAt = this.searchTimeHeader[1] ? this.momentStrToTimestamp(this.searchTimeHeader[1]) : ''
routePathParams.body.timeType = this.searchTimeHeader[2]
- console.log(this.$route, this.$router)
if (!this.searchTimeHeader[2]) {
routePathParams.body.startAt = this.searchTimeHeader[0] ? this.momentStrToTimestamp(this.searchTimeHeader[0]) : ''
routePathParams.body.endAt = this.searchTimeHeader[1] ? this.momentStrToTimestamp(this.searchTimeHeader[1]) : ''
diff --git a/nezha-fronted/src/components/common/mixin/mainMixinFun.js b/nezha-fronted/src/components/common/mixin/mainMixinFun.js
index fe995bb3e..24356f389 100644
--- a/nezha-fronted/src/components/common/mixin/mainMixinFun.js
+++ b/nezha-fronted/src/components/common/mixin/mainMixinFun.js
@@ -223,7 +223,6 @@ export default {
this.nowTimeType = nowType || this.$refs.pickTime.$refs.timePicker.nowTimeType
const type = nowTimeType.type
const val = nowTimeType.value
- console.log(val)
const oneDTimestamp = 24 * 60 * 60 * 1000
if (type === 'relative') {
const now = new Date(bus.computeTimezone(new Date().getTime()))
diff --git a/nezha-fronted/src/components/common/timePicker.vue b/nezha-fronted/src/components/common/timePicker.vue
index 041f5fb13..5888b59f4 100644
--- a/nezha-fronted/src/components/common/timePicker.vue
+++ b/nezha-fronted/src/components/common/timePicker.vue
@@ -246,7 +246,6 @@ export default {
this.getUtcStr()
this.getRangeHistoryArr()
const timeTemp = this.$lodash.cloneDeep(this.searchTime)
- console.log(this.searchTime)
this.oldSearchTime[0] = timeTemp[0] || ''
this.oldSearchTime[1] = timeTemp[1] || ''
// 监听dateFormat变化 改变日期格式
diff --git a/nezha-fronted/src/components/page/alert/alertMessage.vue b/nezha-fronted/src/components/page/alert/alertMessage.vue
index ec667455f..4183bcc2b 100644
--- a/nezha-fronted/src/components/page/alert/alertMessage.vue
+++ b/nezha-fronted/src/components/page/alert/alertMessage.vue
@@ -937,7 +937,6 @@ export default {
const path = this.fromRoute.alertMessage
const routePathParams = JSON.parse(JSON.stringify(param))
delete routePathParams.statistics
- console.log(this.searchTime[2])
if (!this.searchTime[2]) {
routePathParams.body.startAt = this.searchTime[0] ? this.momentStrToTimestamp(this.searchTime[0]) : ''
routePathParams.body.endAt = this.searchTime[1] ? this.momentStrToTimestamp(this.searchTime[1]) : ''
@@ -952,7 +951,6 @@ export default {
...this.searchLabel,
body: encodeURIComponent(JSON.stringify(this.searchLabel.body))
}
- console.log(this.searchLabel.body)
this.$get('/alert/message/query', { ...queryParams }).then(response => {
this.tools.loading = false
if (response.code == 200) {
diff --git a/nezha-fronted/src/components/page/dashboard/explore/exploreItem.vue b/nezha-fronted/src/components/page/dashboard/explore/exploreItem.vue
index ecba8cb5d..f510986b6 100644
--- a/nezha-fronted/src/components/page/dashboard/explore/exploreItem.vue
+++ b/nezha-fronted/src/components/page/dashboard/explore/exploreItem.vue
@@ -3898,7 +3898,6 @@ export default {
this.saveDisabled = false
}
axios.all(requestArr).then(res => {
- console.log(res)
this.chartLoading = false
const errorRowIndex = []
res.forEach((r, i) => {
@@ -4593,7 +4592,6 @@ export default {
}
})
postArr = postArr.filter(item => item.queryValue)
- console.log(postArr)
this.$post('/sys/user/queryHistory', postArr).then(res => {
this.lastHistory = this.$lodash.cloneDeep(postArr)
})