diff --git a/nezha-fronted/src/assets/css/components/chart/chart.scss b/nezha-fronted/src/assets/css/components/chart/chart.scss index 6693b38c1..f83db9c15 100644 --- a/nezha-fronted/src/assets/css/components/chart/chart.scss +++ b/nezha-fronted/src/assets/css/components/chart/chart.scss @@ -507,6 +507,7 @@ font-weight: bold; } } + .endpoint-query-metrics.chart-fullscreen.nz-dialog,.recordRules-query-metrics.chart-fullscreen.nz-dialog { .chart-screen-header .chart-header__tools #browser-go { margin-left: 5px; @@ -683,8 +684,8 @@ } .chart-dataLink-tooltip{ - position: absolute; - padding-bottom: 2px; + position: absolute !important; + padding-bottom: 2px !important; z-index: 999999999; pointer-events: auto; .chart-dataLink-list{ @@ -714,6 +715,22 @@ } } +.chart-expolre-tooltip{ + display: block; + border-style: solid; + white-space: nowrap; + will-change: transform; + box-shadow: rgba(0, 0, 0, 0.2) 1px 2px 10px; + transition: opacity 0.2s cubic-bezier(0.23, 1, 0.32, 1) 0s, visibility 0.2s cubic-bezier(0.23, 1, 0.32, 1) 0s, transform 0.4s cubic-bezier(0.23, 1, 0.32, 1) 0s; + background-color: $--background-color-empty; + border-width: 1px; + border-radius: 4px; + color: rgb(0, 0, 0); + font: 14px / 21px "Microsoft YaHei"; + padding: 10px; + border-color: rgb(221, 228, 237); +} + .graph-icon-info-box{ position: absolute; top: 50%; @@ -798,3 +815,17 @@ color: $--color-text-primary; } } + +.chart-cursor-default{ + cursor: default !important; + *{ + cursor: default !important; + } +} + +.chart-cursor-pointer{ + cursor: pointer !important; + *{ + cursor: pointer !important; + } +} diff --git a/nezha-fronted/src/assets/css/components/page/dashboard/explore/explore.scss b/nezha-fronted/src/assets/css/components/page/dashboard/explore/explore.scss index fba99e61b..3998c50b5 100644 --- a/nezha-fronted/src/assets/css/components/page/dashboard/explore/explore.scss +++ b/nezha-fronted/src/assets/css/components/page/dashboard/explore/explore.scss @@ -150,6 +150,7 @@ .chart-room { width: 100%; height: 300px; + position: relative; } .introduce-view { .info-room { diff --git a/nezha-fronted/src/components/chart/chart/chartTimeSeries.vue b/nezha-fronted/src/components/chart/chart/chartTimeSeries.vue index 6085aff88..8951b4aab 100644 --- a/nezha-fronted/src/components/chart/chart/chartTimeSeries.vue +++ b/nezha-fronted/src/components/chart/chart/chartTimeSeries.vue @@ -166,6 +166,18 @@ export default { this.legends = [] this.series = chartOption.series = this.handleTimeSeries(this.chartInfo, chartOption.series[0], this.chartData) // 生成series和legends + const styleOption = this.$lodash.get(this.chartInfo, 'param.option') + if (styleOption) { + chartOption.series.forEach(item => { + if (item.lineStyle && styleOption.lineWidth != undefined) { + item.lineStyle.width = styleOption.lineWidth + } + if (styleOption.pointSize != undefined) { + item.symbolSize = styleOption.pointSize + } + }) + } + this.isGrey = this.legends.map(() => false) chartOption.color = this.colorList if (!this.series.length) { @@ -250,12 +262,11 @@ export default { if (this.tooltip.activeIndex != params.seriesIndex) { const option = myChart.getOption() option.series[params.seriesIndex].symbol = 'circle' - option.series[params.seriesIndex].emphasis.itemStyle = { - opacity: 1, + option.series[params.seriesIndex].itemStyle = { borderColor: this.hexToRgb(params.color, 0.4), - borderWidth: 6 + borderWidth: 5 } - myChart.setOption(option, true) + myChart.setOption(option) } } this.tooltip.activeIndex = params.seriesIndex @@ -265,11 +276,8 @@ export default { const option = myChart.getOption() option.series.forEach(item => { item.symbol = 'emptyCircle' - item.emphasis.itemStyle = { - opacity: 1 - } }) - myChart.setOption(option, true) + myChart.setOption(option) } this.tooltip.activeIndex = undefined }) diff --git a/nezha-fronted/src/components/chart/chart/legend.vue b/nezha-fronted/src/components/chart/chart/legend.vue index 59ae84482..2a8f0a3b4 100644 --- a/nezha-fronted/src/components/chart/chart/legend.vue +++ b/nezha-fronted/src/components/chart/chart/legend.vue @@ -127,11 +127,6 @@ export default { } }, methods: { - onCopy (txt) { - this.$copyText(txt).then(() => { - this.$message.success({ message: this.$t('overall.copySuccess') }) - }) - }, clickLegend (legendName, index) { /* 点击legend * 1.当前如果是全高亮状态,则全部置灰,只留被点击的legend高亮 diff --git a/nezha-fronted/src/components/chart/chart/options/chartTimeSeries.js b/nezha-fronted/src/components/chart/chart/options/chartTimeSeries.js index c10ebc33b..65b859d54 100644 --- a/nezha-fronted/src/components/chart/chart/options/chartTimeSeries.js +++ b/nezha-fronted/src/components/chart/chart/options/chartTimeSeries.js @@ -152,26 +152,23 @@ export const chartTimeSeriesLineOption = { type: 'line', symbol: 'emptyCircle', // 去掉点 connectNulls: true, - symbolSize: [6, 6], + symbolSize: 6, smooth: 0.2, // 曲线变平滑 - // showSymbol: false, - itemStyle: { - opacity: 0.001 - }, + showSymbol: false, data: [], lineStyle: { width: 1, opacity: 0.9 }, emphasis: { - focus: 'series', - itemStyle: { - opacity: 1 - } + focus: 'series' }, blur: { lineStyle: { opacity: 0.3 + }, + itemStyle: { + opacity: 1 } } }], diff --git a/nezha-fronted/src/components/chart/chartMixin.js b/nezha-fronted/src/components/chart/chartMixin.js index 544bc6508..2274da12e 100644 --- a/nezha-fronted/src/components/chart/chartMixin.js +++ b/nezha-fronted/src/components/chart/chartMixin.js @@ -324,31 +324,17 @@ export default { const pointX = point[0] const pointY = point[1] // 外层div大小 - const viewWidth = size.viewSize[0] + // const viewWidth = size.viewSize[0] // const viewHeight = size.viewSize[1] // 提示框大小 const boxWidth = size.contentSize[0] const boxHeight = size.contentSize[1] - if (!this.isFullscreen) { // 本地显示 - const chartDom = document.getElementById('chart-local-' + this.chartInfo.id) - if (chartDom) { - if (windowMouse.x < (windowWidth / 2)) { // 说明鼠标在左边放不下提示框 - x = pointX + 15 - } else { - x = pointX - boxWidth - 15 - } - if (windowMouse.y + 50 + boxHeight < windowHeight) { // 说明鼠标上面放不下提示框 - y = pointY + 15 - } else { - y = pointY - boxHeight - 10 - } - return [x, y] - } - } else { - if (pointX < (viewWidth / 2)) { // 说明鼠标在左边放不下提示框 - x = pointX + 10 + const chartDom = document.getElementById('chart-local-' + this.chartInfo.id) + if (chartDom) { + if (windowMouse.x < (windowWidth / 2)) { // 说明鼠标在左边放不下提示框 + x = pointX + 15 } else { - x = pointX - boxWidth + x = pointX - boxWidth - 15 } if (windowMouse.y + 50 + boxHeight < windowHeight) { // 说明鼠标上面放不下提示框 y = pointY + 15 diff --git a/nezha-fronted/src/components/common/bottomBox/tabs/dashboardTab.vue b/nezha-fronted/src/components/common/bottomBox/tabs/dashboardTab.vue index fc19cbb3a..39fee75a3 100644 --- a/nezha-fronted/src/components/common/bottomBox/tabs/dashboardTab.vue +++ b/nezha-fronted/src/components/common/bottomBox/tabs/dashboardTab.vue @@ -248,6 +248,10 @@ export default { label: '', min: undefined, max: undefined + }, + option: { + lineWidth: 1, + pointSize: 6 } }, elements: [{ expression: '', legend: '', type: 'expert', id: '', name: 'A', state: 1, orderNum: 0 }], @@ -446,14 +450,22 @@ export default { if (this.chart.type === 'group' && !this.chart.param.collapse == undefined) { this.chart.param.collapse = false } - if ((this.chart.type === 'line' || this.chart.type === 'area' || this.chart.type === 'point') && !this.chart.param.rightYAxis) { - this.chart.param.rightYAxis = { - elementNames: [], - style: 'line', - unit: 2, - label: '', - min: undefined, - max: undefined + if ((this.chart.type === 'line' || this.chart.type === 'area' || this.chart.type === 'point')) { + if (!this.chart.param.rightYAxis) { + this.chart.param.rightYAxis = { + elementNames: [], + style: 'line', + unit: 2, + label: '', + min: undefined, + max: undefined + } + } + if (!this.chart.param.option) { + this.chart.param.option = { + lineWidth: 1, + pointSize: 6 + } } } if (this.chart.type === 'stat') { @@ -480,14 +492,22 @@ export default { if (this.chart.type === 'group' && !this.chart.param.collapse == undefined) { this.chart.param.collapse = false } - if ((this.chart.type === 'line' || this.chart.type === 'area' || this.chart.type === 'point') && !this.chart.param.rightYAxis) { - this.chart.param.rightYAxis = { - elementNames: [], - style: 'line', - unit: 2, - label: '', - min: undefined, - max: undefined + if ((this.chart.type === 'line' || this.chart.type === 'area' || this.chart.type === 'point')) { + if (!this.chart.param.rightYAxis) { + this.chart.param.rightYAxis = { + elementNames: [], + style: 'line', + unit: 2, + label: '', + min: undefined, + max: undefined + } + } + if (!this.chart.param.option) { + this.chart.param.option = { + lineWidth: 1, + pointSize: 6 + } } } if (this.chart.type === 'stat') { diff --git a/nezha-fronted/src/components/common/rightBox/chart/chartConfig.vue b/nezha-fronted/src/components/common/rightBox/chart/chartConfig.vue index 7a11db015..18ce25508 100644 --- a/nezha-fronted/src/components/common/rightBox/chart/chartConfig.vue +++ b/nezha-fronted/src/components/common/rightBox/chart/chartConfig.vue @@ -448,8 +448,46 @@ + +