Highmaps,如何加载本地mapdata

时间:2015-01-14 02:58:17

标签: javascript angularjs highcharts highmaps

通过highmaps演示,我成功加载了地图。 脚本是:

<script src="http://code.highcharts.com/maps/modules/exporting.js"></script>
<script src="http://code.highcharts.com/mapdata/countries/cn/custom/cn-all-sar-taiwan.js"></script>

(highmaps已由require.js加载)

highmap指令:(我喜欢angular.js)

$scope.$on('mapInit', function(){

                element.highcharts('Map',{
                    title : {
                        text : 'Highmaps basic demo'
                    },

                    subtitle : {
                        text : 'Source map'
                    },

                    mapNavigation: {
                        enabled: true,
                        buttonOptions: {
                            verticalAlign: 'bottom'
                        }
                    },

                    colorAxis: {
                        min: 0
                    },

                    series : [{
                        data : data,
                        mapData: Highcharts.maps['countries/cn/custom/cn-all-sar-taiwan'],
                        joinBy: 'hc-key',
                        name: 'Random data',
                        states: {
                            hover: {
                                color: '#BADA55'
                            }
                        },
                        dataLabels: {
                            enabled: true,
                            format: '{point.name}'
                        }
                    }]
                });
            });

这很成功!但是当我下载文件时:

作为本地文件,

<script src="./maps/modules/exporting.js"></script>
<script src="./mapdata/countries/cn/cn-all-sar-taiwan.js"></script>'

并更改mapdata: mapData:Highcharts.maps['countries/cn/cn-all-sar-taiwan']

地图不会再显示!

我认为mapData有问题,所以我试图搜索highmaps API,没有什么......

请帮助我!

0 个答案:

没有答案