perf: statisticslegend样式调整
This commit is contained in:
@@ -43,7 +43,7 @@ export default {
|
|||||||
</script>
|
</script>
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
.chart__legend {
|
.chart__legend {
|
||||||
width: calc(100% - 60px);
|
width: calc(100% - 40px);
|
||||||
height: 105px;
|
height: 105px;
|
||||||
border: 1px solid #E7EAED;
|
border: 1px solid #E7EAED;
|
||||||
color: #5f6368;
|
color: #5f6368;
|
||||||
|
|||||||
@@ -94,8 +94,9 @@ const lineWithStatistics = {
|
|||||||
color: chartColor,
|
color: chartColor,
|
||||||
grid: {
|
grid: {
|
||||||
left: 55,
|
left: 55,
|
||||||
bottom: 25,
|
bottom: 30,
|
||||||
top: 30
|
top: 20,
|
||||||
|
right: 20
|
||||||
},
|
},
|
||||||
legend: {
|
legend: {
|
||||||
show: false
|
show: false
|
||||||
|
|||||||
@@ -30,7 +30,7 @@
|
|||||||
<template #title>{{chartInfo.i18n ? $t(chartInfo.i18n) : chartInfo.name}}</template>
|
<template #title>{{chartInfo.i18n ? $t(chartInfo.i18n) : chartInfo.name}}</template>
|
||||||
<template #operations>
|
<template #operations>
|
||||||
<i class="cn-icon cn-icon-more-light"></i>
|
<i class="cn-icon cn-icon-more-light"></i>
|
||||||
<!-- <i class="cn-icon cn-icon-refresh" @click="mapReload"></i>-->
|
<!-- <i class="cn-icon cn-icon-refresh" @click="loadMap"></i>-->
|
||||||
</template>
|
</template>
|
||||||
<template #default>
|
<template #default>
|
||||||
<div class="chart-drawing" :id="`chart${chartInfo.id}`"></div>
|
<div class="chart-drawing" :id="`chart${chartInfo.id}`"></div>
|
||||||
@@ -220,55 +220,18 @@ export default {
|
|||||||
if (this.isMap) {
|
if (this.isMap) {
|
||||||
this.myChart = this.initMap(`chart${this.chartInfo.id}`)
|
this.myChart = this.initMap(`chart${this.chartInfo.id}`)
|
||||||
if (chartParams) {
|
if (chartParams) {
|
||||||
this.mapReload()
|
this.loadMap()
|
||||||
}
|
}
|
||||||
} else if (this.isEcharts) {
|
} else if (this.isEcharts) {
|
||||||
const dom = document.getElementById(`chart${this.chartInfo.id}`)
|
const dom = document.getElementById(`chart${this.chartInfo.id}`)
|
||||||
this.myChart = echarts.init(dom)
|
this.myChart = echarts.init(dom)
|
||||||
if (chartParams) {
|
if (chartParams) {
|
||||||
if (this.isEchartsWithTable) {
|
if (this.isEchartsWithTable) {
|
||||||
this.chartWithPieTableInit(chartParams)
|
this.initEchartsWithPieTable(chartParams)
|
||||||
} else if (this.isEchartsWithStatistics) {
|
} else if (this.isEchartsWithStatistics) {
|
||||||
const queryParams = { startTime: parseInt(this.startTime / 1000), endTime: parseInt(this.endTime / 1000) }
|
this.initEchartsWithStatistics(chartParams)
|
||||||
get(replaceUrlPlaceholder(chartParams.url, queryParams)).then(response => {
|
|
||||||
if (response.code === 200) {
|
|
||||||
this.statisticsData = response.data.result
|
|
||||||
const seriesTemplate = this.chartOption.series[0]
|
|
||||||
this.chartOption.series = response.data.result.map((r, i) => {
|
|
||||||
return {
|
|
||||||
...seriesTemplate,
|
|
||||||
name: r.legend,
|
|
||||||
data: r.values.map(v => [Number(v[0]) * 1000, Number(v[1])]),
|
|
||||||
lineStyle: {
|
|
||||||
color: getChartColor[i]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
this.myChart.setOption(this.chartOption)
|
|
||||||
this.$nextTick(() => {
|
|
||||||
this.myChart.resize()
|
|
||||||
})
|
|
||||||
})
|
|
||||||
} else {
|
} else {
|
||||||
const queryParams = { startTime: parseInt(this.startTime / 1000), endTime: parseInt(this.endTime / 1000) }
|
this.initECharts(chartParams)
|
||||||
get(replaceUrlPlaceholder(chartParams.url, queryParams)).then(response => {
|
|
||||||
if (response.code === 200) {
|
|
||||||
this.statisticsData = response.data.result
|
|
||||||
const seriesTemplate = this.chartOption.series[0]
|
|
||||||
this.chartOption.series = response.data.result.map(r => {
|
|
||||||
return {
|
|
||||||
...seriesTemplate,
|
|
||||||
name: r.legend,
|
|
||||||
data: r.values.map(v => [Number(v[0]) * 1000, Number(v[1])])
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
this.myChart.setOption(this.chartOption)
|
|
||||||
this.$nextTick(() => {
|
|
||||||
this.myChart.resize()
|
|
||||||
})
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (this.isTable) {
|
} else if (this.isTable) {
|
||||||
@@ -315,7 +278,7 @@ export default {
|
|||||||
hs.properties.fill = am4Core.color('#ccc') */
|
hs.properties.fill = am4Core.color('#ccc') */
|
||||||
return chart
|
return chart
|
||||||
},
|
},
|
||||||
mapReload () {
|
loadMap () {
|
||||||
const chartParams = this.chartInfo.params ? JSON.parse(this.chartInfo.params) : null // 图表参数
|
const chartParams = this.chartInfo.params ? JSON.parse(this.chartInfo.params) : null // 图表参数
|
||||||
const queryParams = { startTime: parseInt(this.startTime / 1000), endTime: parseInt(this.endTime / 1000), country: '', region: '' } // 统计数据的查询参数
|
const queryParams = { startTime: parseInt(this.startTime / 1000), endTime: parseInt(this.endTime / 1000), country: '', region: '' } // 统计数据的查询参数
|
||||||
get(replaceUrlPlaceholder(chartParams.url, queryParams)).then(response => {
|
get(replaceUrlPlaceholder(chartParams.url, queryParams)).then(response => {
|
||||||
@@ -414,10 +377,53 @@ export default {
|
|||||||
if (this.chart.type === 31) {
|
if (this.chart.type === 31) {
|
||||||
const chartParams = this.chartInfo.params ? JSON.parse(this.chartInfo.params) : null // 图表参数
|
const chartParams = this.chartInfo.params ? JSON.parse(this.chartInfo.params) : null // 图表参数
|
||||||
this.myChart.off('click')
|
this.myChart.off('click')
|
||||||
this.chartWithPieTableInit(chartParams)
|
this.initEchartsWithPieTable(chartParams)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
chartWithPieTableInit (chartParams) {
|
initECharts (chartParams) {
|
||||||
|
const queryParams = { startTime: parseInt(this.startTime / 1000), endTime: parseInt(this.endTime / 1000) }
|
||||||
|
get(replaceUrlPlaceholder(chartParams.url, queryParams)).then(response => {
|
||||||
|
if (response.code === 200) {
|
||||||
|
this.statisticsData = response.data.result
|
||||||
|
const seriesTemplate = this.chartOption.series[0]
|
||||||
|
this.chartOption.series = response.data.result.map(r => {
|
||||||
|
return {
|
||||||
|
...seriesTemplate,
|
||||||
|
name: r.legend,
|
||||||
|
data: r.values.map(v => [Number(v[0]) * 1000, Number(v[1])])
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
this.myChart.setOption(this.chartOption)
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.myChart.resize()
|
||||||
|
})
|
||||||
|
})
|
||||||
|
},
|
||||||
|
initEchartsWithStatistics (chartParams) {
|
||||||
|
const queryParams = { startTime: parseInt(this.startTime / 1000), endTime: parseInt(this.endTime / 1000) }
|
||||||
|
get(replaceUrlPlaceholder(chartParams.url, queryParams)).then(response => {
|
||||||
|
if (response.code === 200) {
|
||||||
|
this.statisticsData = response.data.result
|
||||||
|
const seriesTemplate = this.chartOption.series[0]
|
||||||
|
this.chartOption.series = response.data.result.map((r, i) => {
|
||||||
|
return {
|
||||||
|
...seriesTemplate,
|
||||||
|
name: r.legend,
|
||||||
|
data: r.values.map(v => [Number(v[0]) * 1000, Number(v[1])]),
|
||||||
|
lineStyle: {
|
||||||
|
color: getChartColor[i]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
this.myChart.setOption(this.chartOption)
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.myChart.resize()
|
||||||
|
})
|
||||||
|
})
|
||||||
|
},
|
||||||
|
initEchartsWithPieTable (chartParams) {
|
||||||
const self = this
|
const self = this
|
||||||
chartParams.valueColumn = this.orderPieTable
|
chartParams.valueColumn = this.orderPieTable
|
||||||
const queryParams = { startTime: parseInt(this.startTime / 1000), endTime: parseInt(this.endTime / 1000), limit: 10, order: this.orderPieTable } // 统计数据的查询参数
|
const queryParams = { startTime: parseInt(this.startTime / 1000), endTime: parseInt(this.endTime / 1000), limit: 10, order: this.orderPieTable } // 统计数据的查询参数
|
||||||
|
|||||||
Reference in New Issue
Block a user