You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@echarts.apache.org by GitBox <gi...@apache.org> on 2019/01/29 18:17:03 UTC

[GitHub] stephanbochet commented on issue #9857: Geo map displays only one itemStyle areaColor when multiple series data have different itemStyle areaColor

stephanbochet commented on issue #9857: Geo map displays only one itemStyle areaColor when multiple series data have different itemStyle areaColor
URL: https://github.com/apache/incubator-echarts/issues/9857#issuecomment-458648432
 
 
   I was able to perform the expected chart using the visualMap piecewise type. 
   
   `myChart.showLoading();
   
   $.get('data/asset/geo/USA.json', function (usaJson) {
       myChart.hideLoading();
   
       echarts.registerMap('USA', usaJson, {
           Alaska: {              // 把阿拉斯加移到美国主大陆左下方
               left: -131,
               top: 25,
               width: 15
           },
           Hawaii: {
               left: -110,        // 夏威夷
               top: 28,
               width: 5
           },
           'Puerto Rico': {       // 波多黎各
               left: -76,
               top: 26,
               width: 2
           }
       });
       option = {
           title: {
               text: 'USA Population Estimates (2012)',
               subtext: 'Data from www.census.gov',
               sublink: 'http://www.census.gov/popest/data/datasets.html',
               left: 'right'
           },
           tooltip: {
               trigger: 'item',
               showDelay: 0,
               transitionDuration: 0.2,
               formatter: function (params) {
                   var value = (params.value + '').split('.');
                   value = value[0].replace(/(\d{1,3})(?=(?:\d{3})+(?!\d))/g, '$1,');
                   return params.seriesName + '<br/>' + params.name + ': ' + value;
               }
           },
               visualMap: {
                   type: 'piecewise',
                   pieces: [
                       {
                           min: 1,
                           max: 1,
                           color: 'red',
                           label: 'red'
                       },
                                           {
                           min: 2,
                           max: 2,
                           color: 'blue',
                           label: 'blue'
                       },
                       {
                           min: 3,
                           max: 3,
                           color: 'green',
                           label: 'green'
                       }
                   ]
               
               
               
           },
           toolbox: {
               show: true,
               //orient: 'vertical',
               left: 'left',
               top: 'top',
               feature: {
                   dataView: {readOnly: false},
                   restore: {},
                   saveAsImage: {}
               }
           },
           series: [
               {
                   
                   name: 'USA 333',
                   type: 'map',
                   roam: true,
                   map: 'USA',
                   // 文本位置修正
                   textFixed: {
                       Alaska: [20, -20]
                   },
                   data:[ {name: 'Alaska', value: 1},
                   {name: 'Texas', value: 1},
                   {name: 'Washington', value: 2},
                   {name: 'California', value: 2},
   
                   {name: 'Florida', value: 3},
                   {name: 'Puerto Rico', value: 3}
                   ]
               }
           ]
       };
   
       myChart.setOption(option);
   });`

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@echarts.apache.org
For additional commands, e-mail: dev-help@echarts.apache.org