sxmpasch commented on issue #9267: 如何设置TreeMap的板块的背景图片
URL: 
https://github.com/apache/incubator-echarts/issues/9267#issuecomment-432215701
 
 
   你可以通过使用“formatter”和“rich”来实现这样的目标。
   
   You can achieve something like that by using a formatter and rich:
   
   ```
   var richIcons = {
       nodeAa: {
           height: '120',
           backgroundColor: {
               image: './data/asset/img/weather/sunny_128.png'
           }
       },
       nodeAb: {
           height: 120,
           backgroundColor: {
               image: './data/asset/img/weather/cloudy_128.png'
           }
       },
       nodeBa1: {
           height: 260,
           backgroundColor: {
               image: './data/asset/img/weather/showers_128.png'
           }
       }
   };
   
   option = {
       series: [{
           type: 'treemap',
           label: {
             normal: {
                   formatter: function (params) {
                       return '{' + params.name + '|}';
                   },
                   rich: richIcons,
               },
           },
           data: [{
               name: 'nodeA',            // First tree
               value: 10,
               children: [{
                   name: 'nodeAa',       // First leaf of first tree
                   value: 4
               }, {
                   name: 'nodeAb',       // Second leaf of first tree
                   value: 6
               }]
           }, {
               name: 'nodeB',            // Second tree
               value: 17,
               children: [{
                   name: 'nodeBa',       // Son of first tree
                   value: 20,
                   children: [{
                       name: 'nodeBa1',  // Granson of first tree
                       value: 20,
                   }]
               }]
           }]
       }]
   };
   
   ```

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to