2016-12-23 39 views
1

我有2个系列,你可以看到下面。Highmaps多个系列不能看到没有禁用一个

<script src="https://code.highcharts.com/maps/highmaps.js"></script> 
<script src="https://code.highcharts.com/maps/modules/exporting.js"></script> 
<script src="https://code.highcharts.com/mapdata/countries/tr/tr-all.js"></script> 

<div id="container"></div> 


$(function() { 

    Highcharts.mapChart('container', { 
     chart: { 
      spacingBottom: 20 
     }, 
     title: { 
      text: 'Multiple Map Series' 
     }, 

     legend: { 
      enabled: true 
     }, 

     plotOptions: { 
      map: { 
       allAreas: true, 
       // joinBy: 'code', 
       mapData: Highcharts.maps['countries/tr/tr-all'], 
       tooltip: { 
        headerFormat: '', 
        pointFormat: '{series.name}-{point.name}: <b>{point.value}</b>' 
       } 

      } 
     }, 

     series: [{ 
      name: 'AAA', 
      data: $.map(['tr-an','tr-iz'], function (code) { 
       return { "hc-key": code , value : 150}; 
      }) 
     }, 
     { 
      name: 'BBB', 
      data: $.map(['tr-ib','tr-or'], function (code) { 
       return { "hc-key": code , value : 122}; 
      }) 
     } 
     ] 
    }); 
}); 

jsfiddle is here; http://jsfiddle.net/usrt1Lrr/5/

第一个系列(AAA)包含2个城市的'tr-an'和'tr-iz'。

第二个系列(BBB)包含2个城市的'tr-ib'和'tr-or'。

2系列不能被看到,除非我通过图例禁用一个。如果您禁用BBB系列; AAA将可见。这是没有意义的。

我该如何解决这个问题?所有系列必须一起看

在此先感谢。

回答

1

既然你得到了plotOptions.map.allAreas: true它绘制了两个系列的所有区域,这意味着该系列绘制在彼此的顶部(隐藏下面的系列的颜色)。

的另一种方法是将有你的选择:

plotOptions: { 
    map: { 
     allAreas: false, 
     // ... 
    } 
} 

并增加了“背景”系列,你躲起来,像这样:

series: [{ 
     allAreas: true, // only show all areas for this series (as a "background") 
     showInLegend: false // hide it from the legend 
    }, 
    { 
     name: 'AAA', 
     data: $.map(['tr-an','tr-iz'], function (code) { 
      return { "hc-key": code , value : 150}; 
     }) 
    }, 
    { 
     name: 'BBB', 
     data: $.map(['tr-ib','tr-or'], function (code) { 
      return { "hc-key": code , value : 122}; 
     }) 
    }] 

看到它this JSFiddle demonstration在行动。

+0

谢谢,解决了我的问题 – user2761286

相关问题