fix:pie treemap bar 添加legend 修改 stat刷新无效的问题
This commit is contained in:
@@ -38,7 +38,11 @@ export default {
|
|||||||
topology
|
topology
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
initChart () {
|
||||||
|
this.queryAllProjectData()
|
||||||
|
},
|
||||||
queryAllProjectData () {
|
queryAllProjectData () {
|
||||||
|
this.isInit = false
|
||||||
this.$get('monitor/project', { pageSize: -1 }).then(res => {
|
this.$get('monitor/project', { pageSize: -1 }).then(res => {
|
||||||
this.topologyLoading = true
|
this.topologyLoading = true
|
||||||
const axiosAll = []
|
const axiosAll = []
|
||||||
|
|||||||
@@ -11,6 +11,7 @@
|
|||||||
:chart-data="chartData"
|
:chart-data="chartData"
|
||||||
:chart-info="chartInfo"
|
:chart-info="chartInfo"
|
||||||
:legends="legends"
|
:legends="legends"
|
||||||
|
:series="series"
|
||||||
:is-fullscreen="isFullscreen"
|
:is-fullscreen="isFullscreen"
|
||||||
></chart-legend>
|
></chart-legend>
|
||||||
</div>
|
</div>
|
||||||
@@ -80,7 +81,7 @@ export default {
|
|||||||
initChart (chartOption = this.chartOption) {
|
initChart (chartOption = this.chartOption) {
|
||||||
const self = this
|
const self = this
|
||||||
this.legends = []
|
this.legends = []
|
||||||
chartOption.series = this.initBarData(this.chartInfo, chartOption.series[0], this.chartData) // 生成series和legends
|
this.series = chartOption.series = this.initBarData(this.chartInfo, chartOption.series[0], this.chartData) // 生成series和legends
|
||||||
if (this.isNoData) {
|
if (this.isNoData) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -129,12 +130,13 @@ export default {
|
|||||||
const mapping = this.selectMapping(value, chartInfo.param.valueMapping, chartInfo.param.enable && this.chartInfo.param.enable.valueMapping)
|
const mapping = this.selectMapping(value, chartInfo.param.valueMapping, chartInfo.param.enable && this.chartInfo.param.enable.valueMapping)
|
||||||
// eslint-disable-next-line vue/no-mutating-props
|
// eslint-disable-next-line vue/no-mutating-props
|
||||||
mapping && (this.chartOption.color[colorIndex] = mapping.color.bac)
|
mapping && (this.chartOption.color[colorIndex] = mapping.color.bac)
|
||||||
|
const legend = this.handleLegend(chartInfo, data, expressionIndex, dataIndex, colorIndex)
|
||||||
s.data.push({
|
s.data.push({
|
||||||
value: value,
|
value: value,
|
||||||
realValue: value,
|
realValue: value,
|
||||||
showValue: showValue,
|
showValue: showValue,
|
||||||
name: this.handleLegend(chartInfo, data, expressionIndex, dataIndex, colorIndex).name,
|
name: legend.name,
|
||||||
alias: this.handleLegend(chartInfo, data, expressionIndex, dataIndex, colorIndex).alias,
|
alias: legend.alias,
|
||||||
labels: data.metric,
|
labels: data.metric,
|
||||||
seriesIndex: expressionIndex,
|
seriesIndex: expressionIndex,
|
||||||
dataIndex: dataIndex,
|
dataIndex: dataIndex,
|
||||||
|
|||||||
@@ -61,6 +61,7 @@ export default {
|
|||||||
},
|
},
|
||||||
initGaugeData (chartInfo, originalDatas) {
|
initGaugeData (chartInfo, originalDatas) {
|
||||||
this.gaugeData = []
|
this.gaugeData = []
|
||||||
|
this.isInit = false
|
||||||
return new Promise(resolve => {
|
return new Promise(resolve => {
|
||||||
let colorIndex = 0
|
let colorIndex = 0
|
||||||
originalDatas.forEach((originalData, expressionIndex) => {
|
originalDatas.forEach((originalData, expressionIndex) => {
|
||||||
|
|||||||
@@ -56,6 +56,7 @@ export default {
|
|||||||
loadPromise = this.loadDataCenterMapData()
|
loadPromise = this.loadDataCenterMapData()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
this.isInit = false
|
||||||
return loadPromise
|
return loadPromise
|
||||||
}, 500)
|
}, 500)
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -106,12 +106,13 @@ export default {
|
|||||||
const mapping = this.selectMapping(value, chartInfo.param.valueMapping, chartInfo.param.enable && this.chartInfo.param.enable.valueMapping)
|
const mapping = this.selectMapping(value, chartInfo.param.valueMapping, chartInfo.param.enable && this.chartInfo.param.enable.valueMapping)
|
||||||
// eslint-disable-next-line vue/no-mutating-props
|
// eslint-disable-next-line vue/no-mutating-props
|
||||||
mapping && (this.chartOption.color[colorIndex] = mapping.color.bac)
|
mapping && (this.chartOption.color[colorIndex] = mapping.color.bac)
|
||||||
|
const legend = this.handleLegend(chartInfo, data, expressionIndex, dataIndex, colorIndex)
|
||||||
s.data.push({
|
s.data.push({
|
||||||
value: value,
|
value: value,
|
||||||
realValue: value,
|
realValue: value,
|
||||||
showValue: showValue,
|
showValue: showValue,
|
||||||
name: this.handleLegend(chartInfo, data, expressionIndex, dataIndex, colorIndex).name,
|
name: legend.name,
|
||||||
alias: this.handleLegend(chartInfo, data, expressionIndex, dataIndex, colorIndex).alias,
|
alias: legend.alias,
|
||||||
labels: data.metric,
|
labels: data.metric,
|
||||||
seriesIndex: expressionIndex,
|
seriesIndex: expressionIndex,
|
||||||
dataIndex: dataIndex,
|
dataIndex: dataIndex,
|
||||||
|
|||||||
@@ -137,6 +137,7 @@ export default {
|
|||||||
item.width = width
|
item.width = width
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
this.isInit = false
|
||||||
},
|
},
|
||||||
resize () {
|
resize () {
|
||||||
this.getLayout().then(layout => {
|
this.getLayout().then(layout => {
|
||||||
|
|||||||
@@ -87,6 +87,7 @@ export default {
|
|||||||
this.tableData = arr
|
this.tableData = arr
|
||||||
this.oldTableData = lodash.cloneDeep(arr)
|
this.oldTableData = lodash.cloneDeep(arr)
|
||||||
this.$refs.dataTable && this.$refs.dataTable.doLayout()
|
this.$refs.dataTable && this.$refs.dataTable.doLayout()
|
||||||
|
this.isInit = false
|
||||||
}, 200)
|
}, 200)
|
||||||
},
|
},
|
||||||
initTableData (chartInfo, originalDatas) {
|
initTableData (chartInfo, originalDatas) {
|
||||||
@@ -249,10 +250,8 @@ export default {
|
|||||||
// 本地正序
|
// 本地正序
|
||||||
asce (prop) {
|
asce (prop) {
|
||||||
return function (obj1, obj2) {
|
return function (obj1, obj2) {
|
||||||
console.log(obj1, obj2)
|
|
||||||
const val1 = obj1.display[prop + 'display'].replace(/\s*/g, '')
|
const val1 = obj1.display[prop + 'display'].replace(/\s*/g, '')
|
||||||
const val2 = obj2.display[prop + 'display'].replace(/\s*/g, '')
|
const val2 = obj2.display[prop + 'display'].replace(/\s*/g, '')
|
||||||
console.log(val1, val2, val1 < val2)
|
|
||||||
if (val1 < val2) {
|
if (val1 < val2) {
|
||||||
return -1
|
return -1
|
||||||
} else if (val1 > val2) {
|
} else if (val1 > val2) {
|
||||||
|
|||||||
@@ -43,7 +43,6 @@ export default {
|
|||||||
return {
|
return {
|
||||||
stackTotalColor: null,
|
stackTotalColor: null,
|
||||||
isStack: false,
|
isStack: false,
|
||||||
series: []
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
|||||||
@@ -11,6 +11,7 @@
|
|||||||
:chart-data="chartData"
|
:chart-data="chartData"
|
||||||
:chart-info="chartInfo"
|
:chart-info="chartInfo"
|
||||||
:legends="legends"
|
:legends="legends"
|
||||||
|
:series="series"
|
||||||
:is-fullscreen="isFullscreen"
|
:is-fullscreen="isFullscreen"
|
||||||
></chart-legend>
|
></chart-legend>
|
||||||
</div>
|
</div>
|
||||||
@@ -79,7 +80,7 @@ export default {
|
|||||||
methods: {
|
methods: {
|
||||||
initChart (chartOption = this.chartOption) {
|
initChart (chartOption = this.chartOption) {
|
||||||
this.legends = []
|
this.legends = []
|
||||||
chartOption.series[0] = this.initTreeMapData(this.chartInfo, chartOption.series[0], this.chartData) // 生成series和legends
|
this.series = chartOption.series = this.initTreeMapData(this.chartInfo, chartOption.series[0], this.chartData) // 生成series和legends
|
||||||
chartOption.tooltip.formatter = this.formatterFunc
|
chartOption.tooltip.formatter = this.formatterFunc
|
||||||
chartOption.tooltip.position = this.tooltipPosition
|
chartOption.tooltip.position = this.tooltipPosition
|
||||||
/* 使用setTimeout延迟渲染图表,避免样式错乱 */
|
/* 使用setTimeout延迟渲染图表,避免样式错乱 */
|
||||||
@@ -104,12 +105,13 @@ export default {
|
|||||||
const mapping = this.selectMapping(value, chartInfo.param.valueMapping, chartInfo.param.enable && this.chartInfo.param.enable.valueMapping)
|
const mapping = this.selectMapping(value, chartInfo.param.valueMapping, chartInfo.param.enable && this.chartInfo.param.enable.valueMapping)
|
||||||
// eslint-disable-next-line vue/no-mutating-props
|
// eslint-disable-next-line vue/no-mutating-props
|
||||||
this.chartOption.color && mapping && (this.chartOption.color[colorIndex] = mapping.color.bac)
|
this.chartOption.color && mapping && (this.chartOption.color[colorIndex] = mapping.color.bac)
|
||||||
|
const legend = this.handleLegend(chartInfo, data, expressionIndex, dataIndex, colorIndex)
|
||||||
s.data.push({
|
s.data.push({
|
||||||
value: value,
|
value: value,
|
||||||
realValue: value,
|
realValue: value,
|
||||||
showValue: showValue,
|
showValue: showValue,
|
||||||
name: this.handleLegend(chartInfo, data, expressionIndex, dataIndex, colorIndex).name,
|
name: legend.name,
|
||||||
alias: this.handleLegend(chartInfo, data, expressionIndex, dataIndex, colorIndex).alias,
|
alias: legend.alias,
|
||||||
labels: data.metric,
|
labels: data.metric,
|
||||||
seriesIndex: expressionIndex,
|
seriesIndex: expressionIndex,
|
||||||
dataIndex: dataIndex,
|
dataIndex: dataIndex,
|
||||||
@@ -130,7 +132,7 @@ export default {
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
this.$emit('chartIsNoData', this.isNoData)
|
this.$emit('chartIsNoData', this.isNoData)
|
||||||
return s
|
return [s]
|
||||||
},
|
},
|
||||||
formatterFunc (params, ticket, callback) {
|
formatterFunc (params, ticket, callback) {
|
||||||
const self = this
|
const self = this
|
||||||
|
|||||||
@@ -79,6 +79,15 @@ export default {
|
|||||||
const curIsGrey = this.isGrey[index] // 当前legend的状态
|
const curIsGrey = this.isGrey[index] // 当前legend的状态
|
||||||
const currentIsTheOnlyOneHighlight = !curIsGrey && highlightNum === 1 // 当前legend是否是目前唯一高亮的
|
const currentIsTheOnlyOneHighlight = !curIsGrey && highlightNum === 1 // 当前legend是否是目前唯一高亮的
|
||||||
const echarts = getChart(this.chartId)
|
const echarts = getChart(this.chartId)
|
||||||
|
if (this.chartInfo.type === 'bar') {
|
||||||
|
this.clickLegendBar(legendName, index, hasGrey, curIsGrey, currentIsTheOnlyOneHighlight)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (this.chartInfo.type === 'treemap') {
|
||||||
|
this.clickLegendTreemap(legendName, index, hasGrey, curIsGrey, currentIsTheOnlyOneHighlight)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
if (echarts) {
|
if (echarts) {
|
||||||
if (!hasGrey) { // 1.除当前legend外全置灰
|
if (!hasGrey) { // 1.除当前legend外全置灰
|
||||||
echarts.dispatchAction({
|
echarts.dispatchAction({
|
||||||
@@ -102,6 +111,7 @@ export default {
|
|||||||
})
|
})
|
||||||
this.$set(this.isGrey, index, !this.isGrey[index])
|
this.$set(this.isGrey, index, !this.isGrey[index])
|
||||||
}
|
}
|
||||||
|
if (this.chartInfo.type !== 'pie' && this.chartInfo.type !== 'bar' && this.chartInfo.type !== 'treemap') {
|
||||||
// 处理点击后的 Y轴
|
// 处理点击后的 Y轴
|
||||||
const chartInfo = this.chartInfo
|
const chartInfo = this.chartInfo
|
||||||
const dataArg = this.series.filter((seriesItem, seriesIndex) => !this.isGrey[seriesIndex])
|
const dataArg = this.series.filter((seriesItem, seriesIndex) => !this.isGrey[seriesIndex])
|
||||||
@@ -130,6 +140,59 @@ export default {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
clickLegendBar (legendName, index, hasGrey, curIsGrey, currentIsTheOnlyOneHighlight) {
|
||||||
|
const echarts = getChart(this.chartId)
|
||||||
|
if (echarts) {
|
||||||
|
let data = []
|
||||||
|
const xAxis = {
|
||||||
|
data: []
|
||||||
|
}
|
||||||
|
data = lodash.cloneDeep(this.series)
|
||||||
|
if (!hasGrey) { // 1.除当前legend外全置灰
|
||||||
|
this.isGrey = this.isGrey.map((g, i) => i !== index)
|
||||||
|
} else if (currentIsTheOnlyOneHighlight) { // 2.全高亮
|
||||||
|
this.isGrey = this.isGrey.map(() => false)
|
||||||
|
} else { // 对应高亮
|
||||||
|
this.$set(this.isGrey, index, !this.isGrey[index])
|
||||||
|
}
|
||||||
|
data[0].data = data[0].data.filter((item, i) => !this.isGrey[i])
|
||||||
|
xAxis.data = data[0].data.map(item => {
|
||||||
|
if (this.chartInfo.param.text == 'all' || this.chartInfo.param.text == 'legend') {
|
||||||
|
return item.name
|
||||||
|
} else {
|
||||||
|
return ''
|
||||||
|
}
|
||||||
|
})
|
||||||
|
echarts.setOption({
|
||||||
|
series: data,
|
||||||
|
xAxis: {
|
||||||
|
data: xAxis.data
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
clickLegendTreemap (legendName, index, hasGrey, curIsGrey, currentIsTheOnlyOneHighlight) {
|
||||||
|
const echarts = getChart(this.chartId)
|
||||||
|
if (echarts) {
|
||||||
|
let data = []
|
||||||
|
const xAxis = {
|
||||||
|
data: []
|
||||||
|
}
|
||||||
|
data = lodash.cloneDeep(this.series)
|
||||||
|
if (!hasGrey) { // 1.除当前legend外全置灰
|
||||||
|
this.isGrey = this.isGrey.map((g, i) => i !== index)
|
||||||
|
} else if (currentIsTheOnlyOneHighlight) { // 2.全高亮
|
||||||
|
this.isGrey = this.isGrey.map(() => false)
|
||||||
|
} else { // 对应高亮
|
||||||
|
this.$set(this.isGrey, index, !this.isGrey[index])
|
||||||
|
}
|
||||||
|
data[0].data = data[0].data.filter((item, i) => !this.isGrey[i])
|
||||||
|
echarts.setOption({
|
||||||
|
series: data
|
||||||
|
})
|
||||||
|
}
|
||||||
},
|
},
|
||||||
getMaxValue (dataArg, chartInfo) {
|
getMaxValue (dataArg, chartInfo) {
|
||||||
let maxValue = 0
|
let maxValue = 0
|
||||||
@@ -181,7 +244,7 @@ export default {
|
|||||||
unit,
|
unit,
|
||||||
oldDot
|
oldDot
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
legends (n) {
|
legends (n) {
|
||||||
|
|||||||
@@ -9,6 +9,9 @@ const chartGaugeOption = {
|
|||||||
appendToBody: true,
|
appendToBody: true,
|
||||||
className: 'chart-gauge'
|
className: 'chart-gauge'
|
||||||
},
|
},
|
||||||
|
legend: {
|
||||||
|
show: false
|
||||||
|
},
|
||||||
series: [
|
series: [
|
||||||
{
|
{
|
||||||
type: 'gauge',
|
type: 'gauge',
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ export default {
|
|||||||
},
|
},
|
||||||
chartId: '',
|
chartId: '',
|
||||||
isNoData: true,
|
isNoData: true,
|
||||||
|
series: []
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
|
|||||||
@@ -385,6 +385,7 @@
|
|||||||
:label="$t('dashboard.panel.chartForm.legendValues')"
|
:label="$t('dashboard.panel.chartForm.legendValues')"
|
||||||
class="form-item--half-width"
|
class="form-item--half-width"
|
||||||
prop="param.legend.values"
|
prop="param.legend.values"
|
||||||
|
v-if="isShowLegendVlaues(chartConfig.type)"
|
||||||
>
|
>
|
||||||
<el-select
|
<el-select
|
||||||
id="chart-box-legend-value"
|
id="chart-box-legend-value"
|
||||||
@@ -802,11 +803,8 @@ export default {
|
|||||||
})
|
})
|
||||||
break
|
break
|
||||||
case 'stat':
|
case 'stat':
|
||||||
case 'bar':
|
|
||||||
case 'treemap':
|
|
||||||
case 'guage':
|
case 'guage':
|
||||||
case 'pie':
|
if (this.oldType === 'stat' || this.oldType === 'guage') {
|
||||||
if (this.oldType === 'stat' || this.oldType === 'bar' || this.oldType === 'treemap' || this.oldType === 'guage' || this.oldType === 'pie') {
|
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
this.chartConfig.param = {
|
this.chartConfig.param = {
|
||||||
@@ -824,6 +822,28 @@ export default {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
break
|
break
|
||||||
|
case 'bar':
|
||||||
|
case 'treemap':
|
||||||
|
case 'pie':
|
||||||
|
if (this.oldType === 'bar' || this.oldType === 'treemap' || this.oldType === 'pie') {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
this.chartConfig.param = {
|
||||||
|
nullType: this.chartConfig.param.nullType,
|
||||||
|
link: this.chartConfig.param.link,
|
||||||
|
statistics: 'last',
|
||||||
|
text: 'value',
|
||||||
|
valueMapping: [],
|
||||||
|
legend: { placement: 'bottom', values: [], show: true },
|
||||||
|
min: 0,
|
||||||
|
max: 100,
|
||||||
|
enable: {
|
||||||
|
legend: true,
|
||||||
|
valueMapping: false,
|
||||||
|
thresholds: false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break
|
||||||
case 'table':
|
case 'table':
|
||||||
if (this.oldType === 'table') {
|
if (this.oldType === 'table') {
|
||||||
break
|
break
|
||||||
|
|||||||
@@ -436,6 +436,9 @@ export default {
|
|||||||
if (!this.editChart.param.link) {
|
if (!this.editChart.param.link) {
|
||||||
this.$set(this.editChart.param, 'link', '')
|
this.$set(this.editChart.param, 'link', '')
|
||||||
}
|
}
|
||||||
|
if (this.editChart.param.enable.legend && !this.editChart.param.legend) {
|
||||||
|
this.editChart.param.legend = { placement: 'bottom', values: [], show: true }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -79,17 +79,26 @@ export default {
|
|||||||
case 'line':
|
case 'line':
|
||||||
case 'area':
|
case 'area':
|
||||||
case 'point':
|
case 'point':
|
||||||
|
case 'treemap':
|
||||||
|
case 'pie':
|
||||||
|
case 'bar':
|
||||||
return true
|
return true
|
||||||
case 'table':
|
case 'table':
|
||||||
case 'stat':
|
case 'stat':
|
||||||
case 'bar':
|
|
||||||
case 'guage':
|
case 'guage':
|
||||||
case 'treemap':
|
|
||||||
case 'pie':
|
|
||||||
return false
|
return false
|
||||||
default: return false
|
default: return false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
isShowLegendVlaues (type) {
|
||||||
|
switch (type) {
|
||||||
|
case 'line':
|
||||||
|
case 'area':
|
||||||
|
case 'point':
|
||||||
|
return true
|
||||||
|
default: return false
|
||||||
|
}
|
||||||
|
},
|
||||||
isShowValueMapping (type) {
|
isShowValueMapping (type) {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case 'line':
|
case 'line':
|
||||||
|
|||||||
@@ -278,7 +278,67 @@
|
|||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</div>
|
</div>
|
||||||
|
<!--legend-->
|
||||||
|
<div v-if="isShowLegend(chartConfig.type)">
|
||||||
|
<!--legendConfig-->
|
||||||
|
<div class="form__sub-title">
|
||||||
|
<span>{{$t('dashboard.panel.chartForm.legendConfig')}}</span>
|
||||||
|
<el-switch v-model="chartConfig.param.enable.legend" size="small" @change="change"></el-switch>
|
||||||
|
</div>
|
||||||
|
<transition name="el-zoom-in-top">
|
||||||
|
<div
|
||||||
|
v-if="chartConfig.param.enable.legend"
|
||||||
|
class="form-items--half-width-group"
|
||||||
|
>
|
||||||
|
<el-form-item
|
||||||
|
:label="$t('dashboard.panel.chartForm.legendPosition')"
|
||||||
|
class="form-item--half-width"
|
||||||
|
prop="param.legend.placement"
|
||||||
|
>
|
||||||
|
<el-select
|
||||||
|
id="chart-box-legend-show"
|
||||||
|
v-model="chartConfig.param.legend.placement"
|
||||||
|
placeholder=""
|
||||||
|
popper-class="right-box-select-top prevent-clickoutside"
|
||||||
|
size="small"
|
||||||
|
@change="change"
|
||||||
|
>
|
||||||
|
<el-option
|
||||||
|
v-for="item in legendPositionList"
|
||||||
|
:key="item.value"
|
||||||
|
:label="$t(item.label)"
|
||||||
|
:value="item.value"
|
||||||
|
></el-option>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item
|
||||||
|
:label="$t('dashboard.panel.chartForm.legendValues')"
|
||||||
|
class="form-item--half-width"
|
||||||
|
prop="param.legend.values"
|
||||||
|
v-if="isShowLegendVlaues(chartConfig.type)"
|
||||||
|
>
|
||||||
|
<el-select
|
||||||
|
id="chart-box-legend-value"
|
||||||
|
v-model="chartConfig.param.legend.values"
|
||||||
|
multiple
|
||||||
|
collapse-tags
|
||||||
|
:placeholder="$t('el.select.placeholder')"
|
||||||
|
popper-class="right-box-select-top prevent-clickoutside"
|
||||||
|
size="small"
|
||||||
|
@change="change"
|
||||||
|
>
|
||||||
|
<el-option
|
||||||
|
v-for="item in statisticsList"
|
||||||
|
:key="item.value"
|
||||||
|
:label="$t(item.label)"
|
||||||
|
:value="item.value"
|
||||||
|
>
|
||||||
|
</el-option>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
</div>
|
||||||
|
</transition>
|
||||||
|
</div>
|
||||||
<!-- table column-->
|
<!-- table column-->
|
||||||
<div v-if="isTable(chartConfig.type)">
|
<div v-if="isTable(chartConfig.type)">
|
||||||
<div class="form__sub-title">
|
<div class="form__sub-title">
|
||||||
@@ -590,38 +650,45 @@ export default {
|
|||||||
chartTypeChange (type) {
|
chartTypeChange (type) {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case 'stat':
|
case 'stat':
|
||||||
case 'bar':
|
|
||||||
case 'pie':
|
|
||||||
case 'guage':
|
case 'guage':
|
||||||
case 'treemap':
|
if (this.oldType === 'stat' || this.oldType === 'guage') {
|
||||||
if (this.oldType !== 'table') {
|
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
this.chartConfig.param = {
|
this.chartConfig.param = {
|
||||||
|
nullType: this.chartConfig.param.nullType,
|
||||||
link: this.chartConfig.param.link,
|
link: this.chartConfig.param.link,
|
||||||
refer: 1,
|
|
||||||
nullType: 'null',
|
|
||||||
statistics: 'last',
|
statistics: 'last',
|
||||||
valueMapping: [],
|
|
||||||
text: 'value',
|
text: 'value',
|
||||||
|
valueMapping: [],
|
||||||
|
min: 0,
|
||||||
|
max: 100,
|
||||||
|
enable: {
|
||||||
|
legend: true,
|
||||||
|
valueMapping: false,
|
||||||
|
thresholds: false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break
|
||||||
|
case 'bar':
|
||||||
|
case 'treemap':
|
||||||
|
case 'pie':
|
||||||
|
if (this.oldType === 'bar' || this.oldType === 'treemap' || this.oldType === 'pie') {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
this.chartConfig.param = {
|
||||||
|
nullType: this.chartConfig.param.nullType,
|
||||||
|
link: this.chartConfig.param.link,
|
||||||
|
statistics: 'last',
|
||||||
|
text: 'value',
|
||||||
|
valueMapping: [],
|
||||||
|
legend: { placement: 'bottom', values: [], show: true },
|
||||||
min: 0,
|
min: 0,
|
||||||
max: 100,
|
max: 100,
|
||||||
enable: {
|
enable: {
|
||||||
legend: true,
|
legend: true,
|
||||||
valueMapping: false,
|
valueMapping: false,
|
||||||
thresholds: false
|
thresholds: false
|
||||||
},
|
|
||||||
datasource: [{
|
|
||||||
name: 'System',
|
|
||||||
type: '',
|
|
||||||
systemGroup: '',
|
|
||||||
systemSelect: '',
|
|
||||||
group: '',
|
|
||||||
select: '',
|
|
||||||
limit: 100,
|
|
||||||
sort: 'desc'
|
|
||||||
}
|
}
|
||||||
]
|
|
||||||
}
|
}
|
||||||
break
|
break
|
||||||
case 'table':
|
case 'table':
|
||||||
|
|||||||
Reference in New Issue
Block a user