echarts icon indicating copy to clipboard operation
echarts copied to clipboard

type为map区域纹理填充是整个地图的填充

Open xushimin opened this issue 8 years ago • 1 comments

One-line summary [问题简述]

type为map区域纹理填充是整个地图的填充。而不是对某个区域(省)的纹理填充

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 [期望结果]

type: map 能够对item进行纹理填充,渐变色的区域填充是准确的

ECharts option [ECharts配置项]

var img1 = document.createElement('img');
  img1.src = 'http://echarts.baidu.com/examples/images/logo.png';
option = {
      backgroundColor: "#234",
      series: [
        {
          type: 'map',
          map: 'china',
          center: [115.97, 29.71],
          top: 0,
          left: 0,
          right: 0,
          bottom: 0,
          boundingCoords: [[-180, 90], [180, -90]],
          itemStyle: {
            areaColor: "rgba(128, 128, 128, 0)",
            borderColor: "#3b4a98",
            borderWidth: 2,
            borderType: "dotted",
            opacity: 1,
            areaColor: {
              type: 'linear',
              x: 0,
              y: 0,
              x2: 0,
              y2: 1,
              colorStops: [{
                offset: 0, color: 'red' // 0% 处的颜色
              }, {
                offset: 1, color: 'blue' // 100% 处的颜色
              }],
              globalCoord: false // 缺省为 false
            },

            areaColor: {
              image: img1, // 支持为 HTMLImageElement, HTMLCanvasElement,不支持路径字符串
              repeat: 'repeat' // 是否平铺, 可以是 'repeat-x', 'repeat-y', 'no-repeat'
            }
          },
          data:[
            {
              name: '广东',
              value: 4822023,
              itemStyle: {
                areaColor: {
                  image: img1, // 支持为 HTMLImageElement, HTMLCanvasElement,不支持路径字符串
                  repeat: 'repeat' // 是否平铺, 可以是 'repeat-x', 'repeat-y', 'no-repeat'
                }
              }
            },
            {name: '北京', value: 731449},
            {
              name: '四川',
              value: 6553255,
              itemStyle: {
                areaColor: {
                  image: img1, //
                  repeat: 'no-repeat' //
                },

              }
            },
            {name: '重庆', value: 2949131},
            {name: '西藏', value: 38041430},
            {name: '新疆', value: 5187582},
            {name: '云南', value: 3590347},
            {name: '广西', value: 917092},
            {name: 'District of Columbia', value: 632323},
            {name: '湖南', value: 19317568},
            {name: '上海', value: 9919945},
            {name: '江西', value: 1392313},
            {name: '黑龙江', value: 1595728},
            {name: '内蒙古', value: 12875255},
            {name: '湖北', value: 6537334},
            {name: '河南', value: 3074186},
            {name: '河北', value: 2885905},
            {name: '山东', value: 4380415},
            {name: '浙江', value: 4601893},
            {name: '江苏', value: 1329192},
            {
              name: '青海',
              value: 5884563,
              itemStyle: {
                areaColor: {
                  image: img1, // 支持为 HTMLImageElement, HTMLCanvasElement,不支持路径字符串
                  repeat: 'no-repeat' // 是否平铺, 可以是 'repeat-x', 'repeat-y', 'no-repeat'
                }
              }
            },
            {name: '陕西', value: 6646144},
          ]
        }
      ]
    }



Other comments [其他信息]

https://codepen.io/xiongmaohema/pen/vdoeMP

xushimin avatar Mar 07 '18 03:03 xushimin

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Apr 01 '20 20:04 stale[bot]