1

我有一张美国地图及其 600 x 400。我如何强制它使用我在示例中看到但无法在我自己的代码中重现的缩写州名称。

我使用下面的代码和一些示例数据来显示我传递的代码的格式。我必须从更大的 json 响应中解析数据。

var data = [{"code":"AK","value":225}, {...} ];

这是地图:

$('#ha-worst-map-1').highcharts('Map', {
    title : {
        text : result.data[1][2] + ': ' + result.data[1][4]
    },
    subtitle : {
        text : 'stuff and things'
    },
    mapNavigation: {
        enabled: true,
        buttonOptions: {
            verticalAlign: 'top'
        }
    },
    colorAxis: {
        min: 0
    },
    credits: {
        text: '',
        href: ''
    },
    series : [{
        data : data,
        mapData: Highcharts.maps['countries/us/us-all'],
        joinBy: ['postal-code', 'code'],
        name: 'metric',
        states: {
            hover: {
                color: '#BADA55'
            }
        },
        dataLabels: {
            enabled: true,
            format: '{point.name}'
        },
        tooltip: {
            valueSuffix: ''
        }
    }, {
        name: 'Separators',
        type: 'mapline',
        data: Highcharts.geojson(Highcharts.maps['countries/us/us-all'], 'mapline'),
        color: 'silver',
        showInLegend: true,
        enableMouseTracking: true
    }]
});
4

0 回答 0