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

feat: 视图返回字段构建

上级 21722001
...@@ -625,7 +625,7 @@ export const BASE_MAP = { ...@@ -625,7 +625,7 @@ export const BASE_MAP = {
{ {
name: '', name: '',
type: 'map', type: 'map',
map: 'HK', map: 'MAP',
roam: true, roam: true,
// label: { // label: {
// show: true // show: true
......
...@@ -33,16 +33,22 @@ export function baseMapOption(chart_option, chart) { ...@@ -33,16 +33,22 @@ export function baseMapOption(chart_option, chart) {
} }
// visualMap // visualMap
const valueArr = chart.data.series[0].data const valueArr = chart.data.series[0].data
chart_option.visualMap.min = Math.min(...valueArr) const values = []
chart_option.visualMap.max = Math.max(...valueArr) 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) { if (customAttr.color && customAttr.color.colors) {
chart_option.visualMap.inRange.color = customAttr.color.colors chart_option.visualMap.inRange.color = customAttr.color.colors
} }
for (let i = 0; i < valueArr.length; i++) { for (let i = 0; i < valueArr.length; i++) {
const y = { // const y = {
name: chart.data.x[i], // name: chart.data.x[i],
value: valueArr[i] // value: valueArr[i]
} // }
const y = valueArr[i]
y.name = chart.data.x[i]
// color // color
// y.itemStyle = { // y.itemStyle = {
// color: hexColorToRGBA(customAttr.color.colors[i % 9], customAttr.color.alpha), // color: hexColorToRGBA(customAttr.color.colors[i % 9], customAttr.color.alpha),
......
...@@ -152,7 +152,7 @@ export default { ...@@ -152,7 +152,7 @@ export default {
}, },
initMapChart(geoJson, chart) { initMapChart(geoJson, chart) {
// this.$echarts.registerMap('HK', geoJson) // 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 base_json = JSON.parse(JSON.stringify(BASE_MAP))
const chart_option = baseMapOption(base_json, chart) const chart_option = baseMapOption(base_json, chart)
this.myEcharts(chart_option) this.myEcharts(chart_option)
......
...@@ -37,7 +37,7 @@ export default { ...@@ -37,7 +37,7 @@ export default {
series: [ series: [
{ {
type: 'map', type: 'map',
map: 'HK', // 自定义扩展图表类型 map: 'MAP', // 自定义扩展图表类型
roam: true, roam: true,
label: { label: {
show: false show: false
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论