1

ハイチャート Web サイトのデモの例を使用しましたが、変更点は次のとおりです。

  • マップを world.js に変更
  • コメント付きの「allAreas」プロパティ

$(function () {


    // Instanciate the map
    $('#container').highcharts('Map', {
        chart: {
            spacingBottom: 20
        },
        title : {
            text : 'Europe time zones'
        },

        legend: {
            enabled: true
        },

        plotOptions: {
            map: {
                //allAreas: false,
                joinBy: ['iso-a2', 'code'],
                dataLabels: {
                    enabled: true,
                    color: 'white',
                    formatter: function () {
                        if (this.point.properties && this.point.properties.labelrank.toString() < 5) {
                            return this.point.properties['iso-a2'];
                        }
                    },
                    format: null,
                    style: {
                        fontWeight: 'bold'
                    }
                },
                mapData: Highcharts.maps['custom/world'],
                tooltip: {
                    headerFormat: '',
                    pointFormat: '{point.name}: <b>{series.name}</b>'
                }

            }
        },

        series : [{
            name: 'UTC',
            id: 'UTC',
            data: $.map(['IE', 'IS', 'GB', 'PT'], function (code) {
                return { code: code };
            })
        }, {
            name: 'UTC + 1',
            data: $.map(['NO', 'SE', 'DK', 'DE', 'NL', 'BE', 'LU', 'ES', 'FR', 'PL', 'CZ', 'AT', 'CH', 'LI', 'SK', 'HU',
                    'SI', 'IT', 'SM', 'HR', 'BA', 'YF', 'ME', 'AL', 'MK'], function (code) {
                return { code: code };
            })
        }, {
            name: 'UTC + 2',
            data: $.map(['FI', 'EE', 'LV', 'LT', 'BY', 'UA', 'MD', 'RO', 'BG', 'GR', 'TR', 'CY'], function (code) {
                return { code: code };
            })
        }, {
            name: 'UTC + 3',
            data: $.map(['RU'], function (code) {
                return { code: code };
            })
        }]
    });
});

JSFiddleのコード 1 つのシリーズしか表示されないのはなぜですか?

4

1 に答える 1

1

問題の原因となっている行は次のとおり//allAreas: falseです。

これは説明と修正方法です(Highcharts サポート フォーラムからの抜粋)

API によると、 に設定allAreasするtrueとすべての領域がレンダリングされるため、値のない領域も (null 値として) レンダリングされます。もう 1 つのオプションは、nullColor既定ではグレーの色合いで、null 値で使用される色を設定します。

したがって、 に設定allAreasするtrueと、各シリーズはすべての領域を描画し、null 値を持つ領域は灰色 ( nullColor) で塗りつぶされます。後のシリーズはより高いため、z-indexこれらは他のシリーズの上にあり、その下の形状を覆う灰色の形状になります。

allAreasに設定したいtrueが、別のシリーズを透視したい場合は、nullColorを透明に設定する必要があります。

rgba(0,0,0,0)

JSFiddle の作業はこちら

于 2015-01-07T03:49:37.890 に答える