0

我正在开发报告页面。在这个页面中,我同时使用了 highcharts 和 highmaps。在第一次加载时没有更多问题,但是当用户单击另一个页面时,然后再次返回此报告页面 highmaps 区域向下滚动。

我有单页应用程序,所以每个链接都使用 ajax 调用。

我找到了这个解决方案,但是这样我不能存储任何 rootscope 元素。我也不想使用 cookie 或本地存储。

$('#mapsmaps').highcharts('Map', {
        title : {
            text : 'City Lived',  
            style: {
            color: '#008bff'
            }
        },

        subtitle : {
            text : ''
        },        
        legend: {
            title: {
                text: ' ',
                style: {
                    color: (Highcharts.theme && Highcharts.theme.textColor) || 'black'
                }
            },
            floating: true,
            valueDecimals: 0,
            valueSuffix: '',
            backgroundColor: (Highcharts.theme && Highcharts.theme.legendBackgroundColor) || 'rgba(255, 255, 255, 0.85)',
            symbolRadius: 0,
            symbolHeight: 10,

           },

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

        tooltip: {
           // backgroundColor: 'none',
            // borderWidth: 0,
            // shadow: false,
            useHTML: true,
            padding: 0,
            pointFormat: '<span class="f32"></span>'
                + ' {point.name}'
        },
        colorAxis: { 
            dataClasses: [{
                from: 1,
                to: 1000,
                color: "#5FA08F"
            }, {
                from: 1000,
                to: 2000,
                color: "#82A970"
            }, {
                from: 2000,
                to: 3000,
                color: "#E5AF47"
            }, {
                from: 3000,
                to: 4000,
                color: "#EC8A37"
            }, {
                from: 4000,
                to: 5000,
                color: "#F55126"
            }, {
                from: 5000,
                color: "#F30505"
            }]
        },

        series : [{
            data : data,
            mapData: Highcharts.maps['countries/en/en-all'],
            joinBy: 'hc-key',
            name: 'City',
            states: {
                hover: {
                    color: '#BADA55'
                }
            },
            animation: {
                duration: 1000
            },
            dataLabels: {
                enabled: false,
                format: '{point.name}'
            }

        }],
            navigation: {
                buttonOptions: {
                    enabled: false
                }
            }
        });
      }
4

0 回答 0