Skip to content

globe.baseTexture 设置为echarts的map实例,设置map 的背景颜色没有正常显示(ps,在版本3.x是正常的) #7871

@xushimin

Description

@xushimin

One-line summary [问题简述]

globe.baseTexture 设置为echarts的map实例,设置map的背景颜色没有正常显示(ps,在版本3.x是正常的)

Version & Environment [版本及环境]

  • ECharts version [ECharts 版本]: 4.0.4
  • Browser version [浏览器类型和版本]: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.186 Safari/537.36"
  • OS Version [操作系统类型和版本]:"5.0 (Macintosh; Intel Mac OS X 10_13_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.186 Safari/537.36"

Expected behaviour [期望结果]

1 echarts的map实例作为globe的纹理,能准确显示原来map的纹理

ECharts option [ECharts配置项]

var mapOption = {
      backgroundColor: {
        type: 'linear',
        x: 0,
        y: 0,
        x2: 0,
        y2: 1,
        colorStops: [{
          offset: 0, color: 'red' // 0% 处的颜色
        }, {
          offset: 1, color: 'blue' // 100% 处的颜色
        }],
        globalCoord: false // 缺省为 false
      },
      geo: {
        type: 'map',
        map: 'world',
        top: 0,
        left: 0,
        right: 0,
        bottom: 0,
        boundingCoords: [[-180, 90], [180, -90]],
        silent: true,
        itemStyle: {
          normal: {
            borderColor: '#1b2149',
            areaColor: "#161727"
          },

          emphasis: {
            borderColor: '#54555f',
            areaColor: "#1f202e"
          }
        },

        label: {
          emphasis: {
            show: false
          }
        },

        regions: [
          {
            name: '广东',
            value: 4822023,
            itemStyle: regionColor,
            label: regionLabel
          },
          {
            name: '北京',
            value: 731449,
            itemStyle: regionColor,
            label: regionLabel
          },
          {name: '四川', value: 6553255, itemStyle: regionColor,label: regionLabel},
          {name: '重庆', value: 2949131, itemStyle: regionColor,label: regionLabel},
          {name: '西藏', value: 38041430, itemStyle: regionColor,label: regionLabel},
          {name: '新疆', value: 5187582, itemStyle: regionColor,label: regionLabel},
          {name: '云南', value: 3590347, itemStyle: regionColor,label: regionLabel},
          {name: '广西', value: 917092, itemStyle: regionColor,label: regionLabel},
          {name: 'District of Columbia', value: 632323, itemStyle: regionColor,label: regionLabel},
          {name: '湖南', value: 19317568, itemStyle: regionColor,label: regionLabel},
          {name: '上海', value: 9919945, itemStyle: regionColor,label: regionLabel},
          {name: '江西', value: 1392313, itemStyle: regionColor,label: regionLabel},
          {name: '黑龙江', value: 1595728, itemStyle: regionColor,label: regionLabel},
          {name: '内蒙古', value: 12875255, itemStyle: regionColor,label: regionLabel},
          {name: '湖北', value: 6537334, itemStyle: regionColor,label: regionLabel},
          {name: '河南', value: 3074186, itemStyle: regionColor,label: regionLabel},
          {name: '河北', value: 2885905, itemStyle: regionColor,label: regionLabel},
          {name: '山东', value: 4380415, itemStyle: regionColor,label: regionLabel},
          {name: '浙江', value: 4601893, itemStyle: regionColor,label: regionLabel},
          {name: '江苏', value: 1329192, itemStyle: regionColor,label: regionLabel},
          {name: '青海', value: 5884563, itemStyle: regionColor,label: regionLabel},
          {name: '福建', value: 6646144, itemStyle: regionColor,label: regionLabel},
          {name: '山西', value: 6646144, itemStyle: regionColor,label: regionLabel},
          {name: '贵州', value: 6646144, itemStyle: regionColor,label: regionLabel},
          {name: '甘肃', value: 6646144, itemStyle: regionColor,label: regionLabel},
          {name: '安徽', value: 6646144, itemStyle: regionColor,label: regionLabel},
          {name: '宁夏', value: 6646144, itemStyle: regionColor,label: regionLabel},
          {name: '陕西', value: 6646144, itemStyle: regionColor,label: regionLabel},
          {name: '吉林', value: 6646144, itemStyle: regionColor,label: regionLabel},
          {name: '辽宁', value: 6646144, itemStyle: regionColor,label: regionLabel},
          {name: '北京', value: 6646144, itemStyle: regionColor,label: regionLabel},
          {name: '上海', value: 6646144, itemStyle: regionColor,label: regionLabel},
          {name: 'China', value: 6646144, itemStyle: {
            emphasis: {
              areaColor: "rgba(0, 0, 0, 0)"
            }
          }},
        ],
      }
    };
    mapChart.setOption(mapOption);
    option = {
      backgroundColor: {
        type: 'linear',
        x: 0,
        y: 0,
        x2: 0,
        y2: 1,
        colorStops: [{
          offset: 0, color: '#1b1c26' // 0% 处的颜色
        }, {
          offset: 0.8, color: '#11121f' // 100% 处的颜色
        },
          {
            offset: 1, color: '#434572' // 100% 处的颜色
          }
        ],
        globalCoord: false // 缺省为 false
      },
      globe: {
        left: 0,
        top: 0,
//        width: 3000,
        environment: "",

        baseTexture: mapChart,
        globeRadius: 116,


        shading: 'realistic',
        realisticMaterial: {
          roughness: 0.8,
          metalness: 0
        },

        postEffect: {
          enable: true
        },
        temporalSuperSampling: {
          enable: true
        },
        light: {
          main: {
            color: "#eee",
            intensity: 1,
            shadow: false,
            time: new Date(2018, 7, 8, 11, 30, 0)
          },

          ambient: {
            intensity: 2.5
          },
        },
        viewControl: {
          targetCoord: [108, 15],
          autoRotate: false,
          distance: 200,
          rotateSensitivity: 0,
          zoomSensitivity: 0

        },
      },
      series: []
    };

Other comments [其他信息]

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugstaleInactive for a long time. Will be closed in 7 days.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions