diff --git a/nezha-fronted/src/components/chart/chart.vue b/nezha-fronted/src/components/chart/chart.vue
index 7c5585671..8eb0b7436 100644
--- a/nezha-fronted/src/components/chart/chart.vue
+++ b/nezha-fronted/src/components/chart/chart.vue
@@ -162,6 +162,15 @@
@chartIsNoData="chartIsNoData"
:chart-option="chartOption"
>
+
@@ -188,7 +197,7 @@ import chartUrl from './chart/chartUrl'
import chartValue from './chart/chartValue'
import chartHexagon from './chart/chartHexagon'
import chartMap from './chart/chartMap'
-import { getOption, isTimeSeries, isHexagon, isUrl, isText, isChartPie, isChartBar, isTreemap, isLog, isStat, isDiagram, isGroup, isAutotopology, isMap, isAssetInfo, isEndpointInfo, isTable, isGauge } from './chart/tools'
+import { getOption, isTimeSeries, isHexagon, isUrl, isText, isChartPie, isChartBar, isTreemap, isLog, isStat, isDiagram, isGroup, isAutotopology, isMap, isAssetInfo, isEndpointInfo, isTable, isGauge, isClock } from './chart/tools'
import lodash from 'lodash'
export default {
@@ -244,7 +253,7 @@ export default {
},
computed: {
isNoData () {
- return lodash.isEmpty(this.chartData) && ['text', 'url'].indexOf(this.chartInfo.type) === -1
+ return lodash.isEmpty(this.chartData) && ['text', 'url', 'clock'].indexOf(this.chartInfo.type) === -1
},
chartOption () {
if (this.customChartOption) {
@@ -272,6 +281,7 @@ export default {
isMap,
isTable,
isGauge,
+ isClock,
chartIsNoData (flag) {
this.chartChildrenData = flag
},
diff --git a/nezha-fronted/src/components/chart/chart/chartClock.vue b/nezha-fronted/src/components/chart/chart/chartClock.vue
index 5c8ab9eb9..1a1ffd44f 100644
--- a/nezha-fronted/src/components/chart/chart/chartClock.vue
+++ b/nezha-fronted/src/components/chart/chart/chartClock.vue
@@ -1,13 +1,184 @@
-
+
-
-
diff --git a/nezha-fronted/src/components/chart/chart/options/chartClock.js b/nezha-fronted/src/components/chart/chart/options/chartClock.js
new file mode 100644
index 000000000..50c02f9e5
--- /dev/null
+++ b/nezha-fronted/src/components/chart/chart/options/chartClock.js
@@ -0,0 +1,181 @@
+const chartClockOption = {
+ series: [
+ {
+ name: 'hour',
+ type: 'gauge',
+ startAngle: 90,
+ endAngle: -270,
+ min: 0,
+ max: 12,
+ splitNumber: 12,
+ clockwise: true,
+ axisLine: {
+ lineStyle: {
+ width: 15,
+ color: [[1, 'rgba(0,0,0,0.7)']],
+ shadowColor: 'rgba(0, 0, 0, 0.5)',
+ shadowBlur: 15
+ }
+ },
+ splitLine: {
+ lineStyle: {
+ shadowColor: 'rgba(0, 0, 0, 0.3)',
+ shadowBlur: 3,
+ shadowOffsetX: 1,
+ shadowOffsetY: 2
+ }
+ },
+ axisLabel: {
+ fontSize: 50,
+ distance: 25,
+ formatter: function (value) {
+ if (value === 0) {
+ return ''
+ }
+ return value + ''
+ }
+ },
+ pointer: {
+ icon: 'path://M2.9,0.7L2.9,0.7c1.4,0,2.6,1.2,2.6,2.6v115c0,1.4-1.2,2.6-2.6,2.6l0,0c-1.4,0-2.6-1.2-2.6-2.6V3.3C0.3,1.9,1.4,0.7,2.9,0.7z',
+ width: 12,
+ length: '55%',
+ offsetCenter: [0, '8%'],
+ itemStyle: {
+ color: '#C0911F',
+ shadowColor: 'rgba(0, 0, 0, 0.3)',
+ shadowBlur: 8,
+ shadowOffsetX: 2,
+ shadowOffsetY: 4
+ }
+ },
+ detail: {
+ show: false
+ },
+ title: {
+ offsetCenter: [0, '30%']
+ },
+ data: [
+ {
+ value: 0
+ }
+ ]
+ },
+ {
+ name: 'minute',
+ type: 'gauge',
+ startAngle: 90,
+ endAngle: -270,
+ min: 0,
+ max: 60,
+ clockwise: true,
+ axisLine: {
+ show: false
+ },
+ splitLine: {
+ show: false
+ },
+ axisTick: {
+ show: false
+ },
+ axisLabel: {
+ show: false
+ },
+ pointer: {
+ icon: 'path://M2.9,0.7L2.9,0.7c1.4,0,2.6,1.2,2.6,2.6v115c0,1.4-1.2,2.6-2.6,2.6l0,0c-1.4,0-2.6-1.2-2.6-2.6V3.3C0.3,1.9,1.4,0.7,2.9,0.7z',
+ width: 8,
+ length: '70%',
+ offsetCenter: [0, '8%'],
+ itemStyle: {
+ color: '#C0911F',
+ shadowColor: 'rgba(0, 0, 0, 0.3)',
+ shadowBlur: 8,
+ shadowOffsetX: 2,
+ shadowOffsetY: 4
+ }
+ },
+ anchor: {
+ show: true,
+ size: 20,
+ showAbove: false,
+ itemStyle: {
+ borderWidth: 15,
+ borderColor: '#C0911F',
+ shadowColor: 'rgba(0, 0, 0, 0.3)',
+ shadowBlur: 8,
+ shadowOffsetX: 2,
+ shadowOffsetY: 4
+ }
+ },
+ detail: {
+ show: false
+ },
+ title: {
+ offsetCenter: ['0%', '-40%']
+ },
+ data: [
+ {
+ value: 0
+ }
+ ]
+ },
+ {
+ name: 'second',
+ type: 'gauge',
+ startAngle: 90,
+ endAngle: -270,
+ min: 0,
+ max: 60,
+ animationEasingUpdate: 'bounceOut',
+ clockwise: true,
+ axisLine: {
+ show: false
+ },
+ splitLine: {
+ show: false
+ },
+ axisTick: {
+ show: false
+ },
+ axisLabel: {
+ show: false
+ },
+ pointer: {
+ icon: 'path://M2.9,0.7L2.9,0.7c1.4,0,2.6,1.2,2.6,2.6v115c0,1.4-1.2,2.6-2.6,2.6l0,0c-1.4,0-2.6-1.2-2.6-2.6V3.3C0.3,1.9,1.4,0.7,2.9,0.7z',
+ width: 4,
+ length: '85%',
+ offsetCenter: [0, '8%'],
+ itemStyle: {
+ color: '#C0911F',
+ shadowColor: 'rgba(0, 0, 0, 0.3)',
+ shadowBlur: 8,
+ shadowOffsetX: 2,
+ shadowOffsetY: 4
+ }
+ },
+ anchor: {
+ show: true,
+ size: 15,
+ showAbove: true,
+ itemStyle: {
+ color: '#C0911F',
+ shadowColor: 'rgba(0, 0, 0, 0.3)',
+ shadowBlur: 8,
+ shadowOffsetX: 2,
+ shadowOffsetY: 4
+ }
+ },
+ detail: {
+ show: false
+ },
+ title: {
+ offsetCenter: ['0%', '-40%']
+ },
+ data: [
+ {
+ value: 0
+ }
+ ]
+ }
+ ]
+}
+export default chartClockOption
diff --git a/nezha-fronted/src/components/chart/chart/tools.js b/nezha-fronted/src/components/chart/chart/tools.js
index b82cbcec2..7ffeeca48 100644
--- a/nezha-fronted/src/components/chart/chart/tools.js
+++ b/nezha-fronted/src/components/chart/chart/tools.js
@@ -9,6 +9,7 @@ import {
} from './options/chartTimeSeries'
import chartTreemapOption from './options/chartTreemap'
import chartGaugeOption from './options/chartGauge'
+import chartClockOption from '@/components/chart/chart/options/chartClock'
import { randomcolor } from '@/components/common/js/radomcolor/randomcolor'
export function getOption (type) {
@@ -46,6 +47,10 @@ export function getOption (type) {
chartOption = lodash.cloneDeep(chartGaugeOption)
break
}
+ case chartType.clock: {
+ chartOption = lodash.cloneDeep(chartClockOption)
+ break
+ }
default:
chartOption = {}
break
@@ -106,6 +111,9 @@ export function isTable (type) {
export function isGauge (type) {
return type === chartType.guage
}
+export function isClock (type) {
+ return type === chartType.clock
+}
export function getGroupHeight (arr) {
if (arr.length) {
let lastItem = []
diff --git a/nezha-fronted/src/components/common/js/constants.js b/nezha-fronted/src/components/common/js/constants.js
index 0e202a877..a9f1b343b 100644
--- a/nezha-fronted/src/components/common/js/constants.js
+++ b/nezha-fronted/src/components/common/js/constants.js
@@ -399,6 +399,7 @@ export const chartType = {
log: 'log',
text: 'text',
url: 'url',
+ clock: 'clock',
group: 'group',
diagram: 'diagram',
assetInfo: 'assetInfo',
diff --git a/nezha-fronted/src/components/common/rightBox/chart/chartTypeShow.js b/nezha-fronted/src/components/common/rightBox/chart/chartTypeShow.js
index 23901a398..17b7c12e6 100644
--- a/nezha-fronted/src/components/common/rightBox/chart/chartTypeShow.js
+++ b/nezha-fronted/src/components/common/rightBox/chart/chartTypeShow.js
@@ -145,6 +145,7 @@ export default {
case 'map' :
case 'topology' :
case 'hexagon' :
+ case 'clock' :
return false
default: return true
}
diff --git a/nezha-fronted/src/components/common/rightBox/chart/otherChartConfig.vue b/nezha-fronted/src/components/common/rightBox/chart/otherChartConfig.vue
index e240eb4b9..f3e14e219 100644
--- a/nezha-fronted/src/components/common/rightBox/chart/otherChartConfig.vue
+++ b/nezha-fronted/src/components/common/rightBox/chart/otherChartConfig.vue
@@ -99,6 +99,32 @@
+
+
+
+
+
+ {{item.label}}
+
+
+
@@ -178,6 +204,10 @@ export default {
{
id: 'hexagon',
name: this.$t('dashboard.panel.chartForm.typeVal.hexagonFigure.label')
+ },
+ {
+ id: 'clock',
+ name: this.$t('dashboard.panel.chartForm.typeVal.clock.label')
}
]
}
@@ -187,6 +217,7 @@ export default {
this.chartConfig = JSON.parse(JSON.stringify(this.params))
},
chartTypeChange (type) {
+ console.log(type)
switch (type) {
case 'group':
this.chartConfig.span = 12
@@ -213,6 +244,11 @@ export default {
url: ''
}
break
+ case 'clock':
+ this.chartConfig.param = {
+ timeType: this.chartConfig.param.timeType
+ }
+ break
}
this.change()
},
diff --git a/nezha-fronted/src/components/common/rightBox/chart/publicConfig.js b/nezha-fronted/src/components/common/rightBox/chart/publicConfig.js
index 0993513a8..95e006dc2 100644
--- a/nezha-fronted/src/components/common/rightBox/chart/publicConfig.js
+++ b/nezha-fronted/src/components/common/rightBox/chart/publicConfig.js
@@ -160,6 +160,16 @@ export default {
label: 'None',
value: 'none'
}
+ ],
+ timeType: [
+ {
+ value: 'local',
+ label: this.$t('dashboard.panel.chartForm.typeVal.local')
+ },
+ {
+ value: 'server',
+ label: this.$t('dashboard.panel.chartForm.typeVal.server')
+ }
]
}
},