提交 b2162703 authored 作者: junjie's avatar junjie

feat: 视图返回字段构建

上级 21722001
......@@ -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
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论