fix chart编辑的bug
This commit is contained in:
@@ -78,25 +78,8 @@ export default {
|
|||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
initChart (chartOption) {
|
initChart (chartOption) {
|
||||||
const self = this
|
|
||||||
this.legends = []
|
this.legends = []
|
||||||
chartOption.series = this.initTreeMapData(this.chartInfo, chartOption.series[0], this.chartData) // 生成series和legends
|
chartOption.series = this.initTreeMapData(this.chartInfo, chartOption.series[0], this.chartData) // 生成series和legends
|
||||||
chartOption.xAxis.data = chartOption.series.data.map(item => item.name)
|
|
||||||
chartOption.axisLabel = {
|
|
||||||
margin: 8,
|
|
||||||
formatter (params) {
|
|
||||||
const dataLength = chartOption.series.data.length || 1
|
|
||||||
const chartWidth = (document.getElementById('chart-canvas-' + self.chartInfo.id).offsetWidth - 80) / dataLength// 容器宽 - padding - 空余
|
|
||||||
const length = Math.ceil((chartWidth) / 16)
|
|
||||||
let val = ''
|
|
||||||
if (params.length > length) {
|
|
||||||
val = params.substr(0, length) + '...'
|
|
||||||
return val
|
|
||||||
} else {
|
|
||||||
return params
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
chartOption.tooltip.formatter = this.formatterFunc
|
chartOption.tooltip.formatter = this.formatterFunc
|
||||||
/* 使用setTimeout延迟渲染图表,避免样式错乱 */
|
/* 使用setTimeout延迟渲染图表,避免样式错乱 */
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
@@ -131,6 +114,7 @@ export default {
|
|||||||
label: {
|
label: {
|
||||||
...s.label,
|
...s.label,
|
||||||
formatter: this.pieFormatterLabel,
|
formatter: this.pieFormatterLabel,
|
||||||
|
verticalAlign: 'middle',
|
||||||
rich: {
|
rich: {
|
||||||
color: {
|
color: {
|
||||||
color: mapping ? mapping.color.text : '#000000'
|
color: mapping ? mapping.color.text : '#000000'
|
||||||
@@ -149,6 +133,9 @@ export default {
|
|||||||
},
|
},
|
||||||
formatterFunc (params, ticket, callback) {
|
formatterFunc (params, ticket, callback) {
|
||||||
const self = this
|
const self = this
|
||||||
|
if (!params.data) {
|
||||||
|
return ''
|
||||||
|
}
|
||||||
return `
|
return `
|
||||||
<div>
|
<div>
|
||||||
<div style="white-space:nowrap;overflow-x:hidden;text-overflow:ellipsis; min-width: 150px; max-width: 600px; line-height: 18px; font-size: 14px;">
|
<div style="white-space:nowrap;overflow-x:hidden;text-overflow:ellipsis; min-width: 150px; max-width: 600px; line-height: 18px; font-size: 14px;">
|
||||||
|
|||||||
@@ -13,7 +13,6 @@ const chartTreemapOption = {
|
|||||||
'<div class="tooltip-title">' +
|
'<div class="tooltip-title">' +
|
||||||
formatUtil.encodeHTML(treePath.join('/')) +
|
formatUtil.encodeHTML(treePath.join('/')) +
|
||||||
'</div>',
|
'</div>',
|
||||||
'Disk Usage: ' + formatUtil.addCommas(value) + ' KB'
|
|
||||||
].join('')
|
].join('')
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -24,11 +23,16 @@ const chartTreemapOption = {
|
|||||||
visibleMin: 10,
|
visibleMin: 10,
|
||||||
label: {
|
label: {
|
||||||
show: true,
|
show: true,
|
||||||
formatter: '{b}'
|
position: 'inside',
|
||||||
|
formatter: '{b}',
|
||||||
|
verticalAlign: 'middle'
|
||||||
},
|
},
|
||||||
itemStyle: {
|
itemStyle: {
|
||||||
borderColor: '#fff'
|
borderColor: '#fff'
|
||||||
},
|
},
|
||||||
|
breadcrumb: {
|
||||||
|
show: false
|
||||||
|
},
|
||||||
levels: [
|
levels: [
|
||||||
{
|
{
|
||||||
itemStyle: {
|
itemStyle: {
|
||||||
|
|||||||
@@ -6,10 +6,10 @@ export default {
|
|||||||
if (this.chartInfo.param.text === 'all') {
|
if (this.chartInfo.param.text === 'all') {
|
||||||
str += params.data.name
|
str += params.data.name
|
||||||
str += ' : '
|
str += ' : '
|
||||||
str += params.data.mapping && params.data.mapping.display ? self.handleDisplay(params.data.mapping.display, { ...params.data.labels, value: params.data.value }) : params.data.value
|
str += params.data.mapping && params.data.mapping.display ? self.handleDisplay(params.data.mapping.display, { ...params.data.labels, value: params.data.showValue }) : params.data.showValue
|
||||||
}
|
}
|
||||||
if (this.chartInfo.param.text === 'value') {
|
if (this.chartInfo.param.text === 'value') {
|
||||||
str += params.data.mapping && params.data.mapping.display ? self.handleDisplay(params.data.mapping.display, { ...params.data.labels, value: params.data.value }) : params.data.value
|
str += params.data.mapping && params.data.mapping.display ? self.handleDisplay(params.data.mapping.display, { ...params.data.labels, value: params.data.showValue }) : params.data.showValue
|
||||||
}
|
}
|
||||||
if (this.chartInfo.param.text === 'legend') {
|
if (this.chartInfo.param.text === 'legend') {
|
||||||
str += params.data.name
|
str += params.data.name
|
||||||
|
|||||||
@@ -273,7 +273,7 @@
|
|||||||
placeholder=""
|
placeholder=""
|
||||||
popper-class="right-box-select-top prevent-clickoutside"
|
popper-class="right-box-select-top prevent-clickoutside"
|
||||||
size="small"
|
size="small"
|
||||||
@change="change, $forceUpdate()"
|
@change="change"
|
||||||
>
|
>
|
||||||
<el-option v-for="item in statisticsList" :key="item.value" :label="$t(item.label)" :value="item.value">
|
<el-option v-for="item in statisticsList" :key="item.value" :label="$t(item.label)" :value="item.value">
|
||||||
<span class="panel-dropdown-label-txt" >{{$t(item.label)}}</span>
|
<span class="panel-dropdown-label-txt" >{{$t(item.label)}}</span>
|
||||||
@@ -294,7 +294,7 @@
|
|||||||
placeholder=""
|
placeholder=""
|
||||||
popper-class="right-box-select-top prevent-clickoutside"
|
popper-class="right-box-select-top prevent-clickoutside"
|
||||||
size="small"
|
size="small"
|
||||||
@change="change, $forceUpdate()"
|
@change="change"
|
||||||
>
|
>
|
||||||
<el-option
|
<el-option
|
||||||
v-for="item in nullTypeList"
|
v-for="item in nullTypeList"
|
||||||
@@ -317,7 +317,7 @@
|
|||||||
placeholder=""
|
placeholder=""
|
||||||
popper-class="right-box-select-top prevent-clickoutside"
|
popper-class="right-box-select-top prevent-clickoutside"
|
||||||
size="small"
|
size="small"
|
||||||
@change="change, $forceUpdate()"
|
@change="change"
|
||||||
>
|
>
|
||||||
<el-option
|
<el-option
|
||||||
v-for="item in textList"
|
v-for="item in textList"
|
||||||
@@ -351,7 +351,7 @@
|
|||||||
placeholder=""
|
placeholder=""
|
||||||
popper-class="right-box-select-top prevent-clickoutside"
|
popper-class="right-box-select-top prevent-clickoutside"
|
||||||
size="small"
|
size="small"
|
||||||
@change="change, $forceUpdate()"
|
@change="change"
|
||||||
>
|
>
|
||||||
<el-option
|
<el-option
|
||||||
v-for="item in legendPositionList"
|
v-for="item in legendPositionList"
|
||||||
@@ -374,7 +374,7 @@
|
|||||||
:placeholder="$t('el.select.placeholder')"
|
:placeholder="$t('el.select.placeholder')"
|
||||||
popper-class="right-box-select-top prevent-clickoutside"
|
popper-class="right-box-select-top prevent-clickoutside"
|
||||||
size="small"
|
size="small"
|
||||||
@change="change, $forceUpdate()"
|
@change="change"
|
||||||
>
|
>
|
||||||
<el-option
|
<el-option
|
||||||
v-for="item in statisticsList"
|
v-for="item in statisticsList"
|
||||||
@@ -775,7 +775,7 @@ export default {
|
|||||||
this.chartConfig.param = {
|
this.chartConfig.param = {
|
||||||
nullType: this.chartConfig.param.nullType,
|
nullType: this.chartConfig.param.nullType,
|
||||||
statistics: 'last',
|
statistics: 'last',
|
||||||
text: 'all',
|
text: 'value',
|
||||||
valueMapping: {
|
valueMapping: {
|
||||||
show: true,
|
show: true,
|
||||||
mapping: []
|
mapping: []
|
||||||
|
|||||||
@@ -121,6 +121,7 @@
|
|||||||
<!-- ></chart-box>-->
|
<!-- ></chart-box>-->
|
||||||
<chart-right-box
|
<chart-right-box
|
||||||
v-if="chartRightBoxShow"
|
v-if="chartRightBoxShow"
|
||||||
|
v-loading="rightBox.loading"
|
||||||
ref="addChartModal"
|
ref="addChartModal"
|
||||||
:chart="chart"
|
:chart="chart"
|
||||||
:from="fromRoute.panel"
|
:from="fromRoute.panel"
|
||||||
@@ -172,7 +173,8 @@ export default {
|
|||||||
rightBox: { // 面板弹出框相关
|
rightBox: { // 面板弹出框相关
|
||||||
chart: { show: false },
|
chart: { show: false },
|
||||||
chartTemp: { show: false },
|
chartTemp: { show: false },
|
||||||
panel: { show: false }
|
panel: { show: false },
|
||||||
|
loading: false
|
||||||
},
|
},
|
||||||
tableHover: false,
|
tableHover: false,
|
||||||
searchTime: bus.getTimezontDateRange(),
|
searchTime: bus.getTimezontDateRange(),
|
||||||
@@ -304,7 +306,9 @@ export default {
|
|||||||
this.showPanel = val
|
this.showPanel = val
|
||||||
this.showPanel.type = 'dashboard'
|
this.showPanel.type = 'dashboard'
|
||||||
this.filter.panelId = this.showPanel.id
|
this.filter.panelId = this.showPanel.id
|
||||||
this.dateChange()
|
// this.dateChange()
|
||||||
|
this.getTableData()
|
||||||
|
this.getData(this.filter)
|
||||||
this.$refs.chartList.cleanData()
|
this.$refs.chartList.cleanData()
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -400,7 +404,9 @@ export default {
|
|||||||
this.chart.panelName = this.showPanel.name
|
this.chart.panelName = this.showPanel.name
|
||||||
this.chart.id = ''
|
this.chart.id = ''
|
||||||
} else {
|
} else {
|
||||||
|
this.rightBox.loading = true
|
||||||
this.$get('visual/panel/chart/' + data.id).then(res => {
|
this.$get('visual/panel/chart/' + data.id).then(res => {
|
||||||
|
this.rightBox.loading = false
|
||||||
if (res.code === 200) {
|
if (res.code === 200) {
|
||||||
const chartData = res.data.data
|
const chartData = res.data.data
|
||||||
this.chart = JSON.parse(JSON.stringify(chartData))
|
this.chart = JSON.parse(JSON.stringify(chartData))
|
||||||
@@ -418,6 +424,7 @@ export default {
|
|||||||
},
|
},
|
||||||
closeChartBox (refresh) {
|
closeChartBox (refresh) {
|
||||||
// this.rightBox.chart.show = false
|
// this.rightBox.chart.show = false
|
||||||
|
this.chart = {}
|
||||||
this.$store.dispatch('clearPanel')
|
this.$store.dispatch('clearPanel')
|
||||||
/* if (refresh) {
|
/* if (refresh) {
|
||||||
this.getData(this.filter)
|
this.getData(this.filter)
|
||||||
@@ -450,6 +457,8 @@ export default {
|
|||||||
message: this.$t('tip.deleteSuccess')
|
message: this.$t('tip.deleteSuccess')
|
||||||
})
|
})
|
||||||
this.getData(this.filter)
|
this.getData(this.filter)
|
||||||
|
this.chart = {}
|
||||||
|
this.$store.dispatch('clearPanel')
|
||||||
// this.$refs.chartList.loadChartData(this.scrollbarWrap.scrollTop)
|
// this.$refs.chartList.loadChartData(this.scrollbarWrap.scrollTop)
|
||||||
// if(nextChart&&prevChart){ //删除图表为中间位置
|
// if(nextChart&&prevChart){ //删除图表为中间位置
|
||||||
// prevChart.next = nextChart.id;
|
// prevChart.next = nextChart.id;
|
||||||
@@ -801,7 +810,7 @@ export default {
|
|||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
if (add) {
|
if (add) {
|
||||||
if (add === 'chart') {
|
if (add === 'chart') {
|
||||||
this.addChart()
|
this.addChartBefore()
|
||||||
}
|
}
|
||||||
if (add === 'panel') {
|
if (add === 'panel') {
|
||||||
this.toAdd()
|
this.toAdd()
|
||||||
|
|||||||
Reference in New Issue
Block a user