@@ -591,7 +614,7 @@
placeholder=""
popper-class="dc-dropdown right-box-select-top right-public-box-dropdown-top prevent-clickoutside chart-box-unit"
size="small"
- style="width: 100%"
+ style="flex: 1"
@change="unitSelected"
>
@@ -622,6 +645,7 @@ import publicConfig from '@/components/common/rightBox/chart/publicConfig'
import chartTypeShow from '@/components/common/rightBox/chart/chartTypeShow'
import VueTagsInput from '@johmun/vue-tags-input'
import draggable from 'vuedraggable'
+import { randomcolor } from '@/components/common/js/radomcolor/randomcolor'
export default {
name: 'chartConfig',
components: {
@@ -650,6 +674,7 @@ export default {
return {
rules: {
},
+ oldType: '',
promqlType: 'log',
chartTypeList: [
{
@@ -657,7 +682,7 @@ export default {
name: this.$t('dashboard.panel.chartForm.typeVal.line.label')
},
{
- id: 'stackArea',
+ id: 'area',
name: this.$t('dashboard.panel.chartForm.typeVal.stackArea.label')
},
{
@@ -666,7 +691,7 @@ export default {
},
{
id: 'stat',
- name: this.$t('dashboard.panel.chartForm.typeVal.stat.label')
+ name: this.$t('dashboard.panel.chartForm.typeVal.singleStat.label')
},
{
id: 'bar',
@@ -703,6 +728,7 @@ export default {
},
init () {
this.chartConfig = JSON.parse(JSON.stringify(this.params))
+ this.oldType = this.chartConfig.type
// 重置相关属性
this.expressions = []
this.expressionsShow = []
@@ -718,8 +744,11 @@ export default {
chartTypeChange (type) {
switch (type) {
case 'line':
- case 'stackArea':
+ case 'area':
case 'point':
+ if (this.oldType === 'line' || this.oldType === 'area' || this.oldType === 'point') {
+ break
+ }
this.chartConfig.param = {
stack: 0,
nullType: this.chartConfig.param.nullType,
@@ -728,16 +757,21 @@ export default {
thresholds: []
}
this.$nextTick(() => {
- this.chartConfig.param.thresholds.push({ value: undefined, color: '#eeeeeeff' })
+ this.chartConfig.param.thresholds.push({ value: undefined, color: randomcolor() })
})
break
case 'stat':
case 'bar':
case 'treemap':
+ case 'guage':
case 'pie':
+ if (this.oldType === 'stat' || this.oldType === 'bar' || this.oldType === 'treemap' || this.oldType === 'guage' || this.oldType === 'pie') {
+ break
+ }
this.chartConfig.param = {
nullType: this.chartConfig.param.nullType,
statistics: 'last',
+ text: 'all',
valueMapping: {
show: true,
mapping: []
@@ -745,6 +779,9 @@ export default {
}
break
case 'table':
+ if (this.oldType === 'table') {
+ break
+ }
this.chartConfig.param = {
nullType: this.chartConfig.param.nullType,
statistics: 'last',
@@ -754,11 +791,15 @@ export default {
}
break
case 'log':
+ if (this.oldType === 'log') {
+ break
+ }
this.chartConfig.param = {
limit: 100
}
break
}
+ this.oldType = type
this.change()
},
sortThresholds () {
@@ -782,7 +823,7 @@ export default {
addThresholds () {
this.chartConfig.param.thresholds.push({
value: undefined,
- color: '#eeeeeeff'
+ color: randomcolor()
})
this.change()
},
diff --git a/nezha-fronted/src/components/common/rightBox/chart/chartTypeShow.js b/nezha-fronted/src/components/common/rightBox/chart/chartTypeShow.js
index 80855e33d..cc612b4fd 100644
--- a/nezha-fronted/src/components/common/rightBox/chart/chartTypeShow.js
+++ b/nezha-fronted/src/components/common/rightBox/chart/chartTypeShow.js
@@ -1,98 +1,9 @@
export default {
methods: {
- isStackShow (type) {
+ isDiagram (type) {
switch (type) {
- case 'line':
- case 'stackArea':
- case 'point':
+ case 'diagram':
return true
- case 'table':
- case 'stat':
- case 'bar':
- case 'treemap':
- case 'guage':
- case 'pie':
- return false
- default: return false
- }
- },
- isStatisticsShow (type) {
- switch (type) {
- case 'line':
- case 'stackArea':
- case 'point':
- return false
- case 'table':
- case 'stat':
- case 'bar':
- case 'treemap':
- case 'guage':
- case 'pie':
- return true
- default: return false
- }
- },
- isShowLegend (type) {
- switch (type) {
- case 'line':
- case 'stackArea':
- case 'point':
- return true
- case 'table':
- case 'stat':
- case 'bar':
- case 'guage':
- case 'treemap':
- case 'pie':
- return false
- default: return false
- }
- },
- isShowValueMapping (type) {
- switch (type) {
- case 'line':
- case 'stackArea':
- case 'point':
- case 'table':
- return false
- case 'stat':
- case 'bar':
- case 'guage':
- case 'treemap':
- case 'pie':
- return true
- default: return false
- }
- },
- isTable (type) {
- switch (type) {
- case 'table':
- return true
- case 'line':
- case 'stackArea':
- case 'point':
- case 'stat':
- case 'bar':
- case 'guage':
- case 'treemap':
- case 'pie':
- return false
- default: return false
- }
- },
- isLog (type) {
- switch (type) {
- case 'log':
- return true
- case 'table':
- case 'line':
- case 'stackArea':
- case 'point':
- case 'stat':
- case 'bar':
- case 'treemap':
- case 'pie':
- return false
default: return false
}
},
@@ -103,13 +14,6 @@ export default {
default: return false
}
},
- isDiagram (type) {
- switch (type) {
- case 'diagram':
- return true
- default: return false
- }
- },
isText (type) {
switch (type) {
case 'text':
@@ -123,6 +27,117 @@ export default {
return true
default: return false
}
+ },
+ isTable (type) {
+ switch (type) {
+ case 'table':
+ return true
+ default: return false
+ }
+ },
+ isLog (type) {
+ switch (type) {
+ case 'log':
+ return true
+ default: return false
+ }
+ },
+ isStackShow (type) {
+ switch (type) {
+ case 'line':
+ case 'area':
+ case 'point':
+ return true
+ case 'table':
+ case 'stat':
+ case 'bar':
+ case 'treemap':
+ case 'guage':
+ case 'pie':
+ return false
+ default: return false
+ }
+ },
+ isStatisticsShow (type) {
+ switch (type) {
+ case 'line':
+ case 'area':
+ case 'point':
+ return false
+ case 'table':
+ case 'stat':
+ case 'bar':
+ case 'treemap':
+ case 'guage':
+ case 'pie':
+ return true
+ default: return false
+ }
+ },
+ isShowLegend (type) {
+ switch (type) {
+ case 'line':
+ case 'area':
+ case 'point':
+ return true
+ case 'table':
+ case 'stat':
+ case 'bar':
+ case 'guage':
+ case 'treemap':
+ case 'pie':
+ return false
+ default: return false
+ }
+ },
+ isShowValueMapping (type) {
+ switch (type) {
+ case 'line':
+ case 'area':
+ case 'point':
+ case 'table':
+ return false
+ case 'stat':
+ case 'bar':
+ case 'guage':
+ case 'treemap':
+ case 'pie':
+ return true
+ default: return false
+ }
+ },
+ isShowNullType (type) {
+ switch (type) {
+ case 'log':
+ case 'bar':
+ case 'treemap':
+ case 'pie':
+ case 'stat':
+ case 'guage':
+ return false
+ case 'line':
+ case 'area':
+ case 'point':
+ case 'table':
+ return true
+ default: return false
+ }
+ },
+ isShowText (type) {
+ switch (type) {
+ case 'bar':
+ case 'treemap':
+ case 'pie':
+ case 'stat':
+ case 'guage':
+ return true
+ case 'line':
+ case 'area':
+ case 'point':
+ case 'table':
+ return false
+ default: return false
+ }
}
}
}
diff --git a/nezha-fronted/src/components/common/rightBox/chart/publicConfig.js b/nezha-fronted/src/components/common/rightBox/chart/publicConfig.js
index 9abbe7a27..debf723bb 100644
--- a/nezha-fronted/src/components/common/rightBox/chart/publicConfig.js
+++ b/nezha-fronted/src/components/common/rightBox/chart/publicConfig.js
@@ -1,5 +1,6 @@
import chartDataFormat from '@/components/charts/chartDataFormat'
import { getUUID, resetZIndex } from '@/components/common/js/common'
+import { randomcolor } from '@/components/common/js/radomcolor/randomcolor'
const rz = {
methods: {
rz (e) {
@@ -142,6 +143,21 @@ export default {
name: this.$t('dashboard.panel.chartForm.typeVal.table.label')
}
+ ],
+ textList: [
+ {
+ label: 'All',
+ value: 'all'
+ }, {
+ label: 'Value',
+ value: 'value'
+ }, {
+ label: 'Legend',
+ value: 'legend'
+ }, {
+ label: 'None',
+ value: 'none'
+ }
]
}
},
@@ -281,14 +297,16 @@ export default {
this.change()
},
addMapping () {
+ const bacColor = randomcolor()
+ console.log(bacColor)
this.chartConfig.param.valueMapping.mapping.push({
type: 'value',
show: true,
value: undefined,
display: '',
color: {
- bac: '#FFFFFFFF',
- text: '#000000FF'
+ bac: bacColor,
+ text: randomcolor()
}
})
this.change()
diff --git a/nezha-fronted/src/components/common/rightBox/chart/systemChartConfig.vue b/nezha-fronted/src/components/common/rightBox/chart/systemChartConfig.vue
index b3fae2f5e..fce4848b9 100644
--- a/nezha-fronted/src/components/common/rightBox/chart/systemChartConfig.vue
+++ b/nezha-fronted/src/components/common/rightBox/chart/systemChartConfig.vue
@@ -107,6 +107,7 @@
:label="$t('dashboard.panel.chartForm.refer')"
class="form-item--half-width"
prop="param.stack"
+ style="display: none"
>
Title
-
+
@@ -358,7 +359,7 @@
placeholder=""
popper-class="dc-dropdown right-box-select-top right-public-box-dropdown-top prevent-clickoutside chart-box-unit"
size="small"
- style="width: 100%"
+ style="flex: 1"
@change="unitSelected"
>
@@ -398,6 +399,7 @@ export default {
rules: {},
groupList: [],
selectList: [],
+ oldType: '',
chartTypeList: [
{
id: 'stat',
@@ -436,6 +438,7 @@ export default {
methods: {
init () {
this.chartConfig = JSON.parse(JSON.stringify(this.params))
+ this.oldType = this.chartConfig.type
},
getSystemData () {
this.loading = true
@@ -468,19 +471,23 @@ export default {
case 'pie':
case 'guage':
case 'treemap':
+ if (this.oldType !== 'table') {
+ break
+ }
this.chartConfig.param.valueMapping = {
show: true,
mapping: []
}
- this.chartConfig.param.refer = 1
+ this.chartConfig.param.refer = 0
delete this.chartConfig.param.columns
break
case 'table':
this.chartConfig.param.columns = []
- this.chartConfig.param.refer = 1
+ this.chartConfig.param.refer = 0
delete this.chartConfig.param.valueMapping
break
}
+ this.oldType = type
this.change()
},
changeSystem (item) {
diff --git a/nezha-fronted/src/components/page/dashboard/panel.vue b/nezha-fronted/src/components/page/dashboard/panel.vue
index 6c4f9516f..32008d93e 100644
--- a/nezha-fronted/src/components/page/dashboard/panel.vue
+++ b/nezha-fronted/src/components/page/dashboard/panel.vue
@@ -154,6 +154,7 @@ import chartTempBox from '@/components/common/rightBox/chartTempBox'
import topToolMoreOptions from '@/components/common/popBox/topToolMoreOptions'
import { fromRoute } from '@/components/common/js/constants'
import chartData from '@/components/chart/testData'
+import { randomcolor } from '@/components/common/js/radomcolor/randomcolor'
export default {
name: 'panel',
@@ -199,7 +200,7 @@ export default {
nullType: 'null',
legend: { placement: 'bottom', values: [], show: true },
thresholdShow: true,
- thresholds: [{ value: undefined, color: '#eeeeeeff' }]
+ thresholds: [{ value: undefined, color: randomcolor() }]
},
elements: [{ expression: '', legend: '', type: 'expert', id: '', name: 'A' }],
panel: '',