forked from github/dataease
Merge pull request #574 from dataease/pr@dev@feat_视图返回字段构建
feat: 视图返回字段构建
This commit is contained in:
commit
d57ef618b8
@ -625,7 +625,7 @@ export const BASE_MAP = {
|
||||
{
|
||||
name: '',
|
||||
type: 'map',
|
||||
map: 'HK',
|
||||
map: 'MAP',
|
||||
roam: true,
|
||||
// label: {
|
||||
// show: true
|
||||
|
@ -33,16 +33,22 @@ export function baseMapOption(chart_option, chart) {
|
||||
}
|
||||
// visualMap
|
||||
const valueArr = chart.data.series[0].data
|
||||
chart_option.visualMap.min = Math.min(...valueArr)
|
||||
chart_option.visualMap.max = Math.max(...valueArr)
|
||||
const values = []
|
||||
valueArr.forEach(function(ele) {
|
||||
values.push(ele.value)
|
||||
})
|
||||
chart_option.visualMap.min = Math.min(...values)
|
||||
chart_option.visualMap.max = Math.max(...values)
|
||||
if (customAttr.color && customAttr.color.colors) {
|
||||
chart_option.visualMap.inRange.color = customAttr.color.colors
|
||||
}
|
||||
for (let i = 0; i < valueArr.length; i++) {
|
||||
const y = {
|
||||
name: chart.data.x[i],
|
||||
value: valueArr[i]
|
||||
}
|
||||
// const y = {
|
||||
// name: chart.data.x[i],
|
||||
// value: valueArr[i]
|
||||
// }
|
||||
const y = valueArr[i]
|
||||
y.name = chart.data.x[i]
|
||||
// color
|
||||
// y.itemStyle = {
|
||||
// color: hexColorToRGBA(customAttr.color.colors[i % 9], customAttr.color.alpha),
|
||||
|
@ -152,7 +152,7 @@ export default {
|
||||
},
|
||||
initMapChart(geoJson, chart) {
|
||||
// this.$echarts.registerMap('HK', geoJson)
|
||||
this.$echarts.getMap('HK') || this.$echarts.registerMap('HK', geoJson)
|
||||
this.$echarts.getMap('MAP') || this.$echarts.registerMap('MAP', geoJson)
|
||||
const base_json = JSON.parse(JSON.stringify(BASE_MAP))
|
||||
const chart_option = baseMapOption(base_json, chart)
|
||||
this.myEcharts(chart_option)
|
||||
|
@ -37,7 +37,7 @@ export default {
|
||||
series: [
|
||||
{
|
||||
type: 'map',
|
||||
map: 'HK', // 自定义扩展图表类型
|
||||
map: 'MAP', // 自定义扩展图表类型
|
||||
roam: true,
|
||||
label: {
|
||||
show: false
|
||||
|
Loading…
Reference in New Issue
Block a user