Highmaps地图缩放问题



我正试图用新版本的highcharts/hightmaps来调整我的代码,但我在map&mappie渲染器。我需要的渲染与您的演示类似:https://jsfiddle.net/gh/get/library/pure/highcharts/highcharts/tree/master/samples/maps/demo/map-pies

目前,我需要保留我的非TOPOJson映射,并用新的库调整我现有的代码。结果如下:https://jsfiddle.net/vegaelce/bzy4xgm1/除非你放大/缩小,否则它是有效的。放大后馅饼越来越小。

从现有的代码中,我添加了以下代码

init: function () {
Highcharts.Series.prototype.init.apply(this, arguments);
// Respond to zooming and dragging the base map
Highcharts.addEvent(this.chart.mapView, 'afterSetView', () => {
this.isDirty = true;
});
},
render: function () {
const series = this,
chart = series.chart,
linkedSeries = chart.get(series.options.linkedMap);
Highcharts.seriesTypes.pie.prototype.render.apply(
series,
arguments
);
if (series.group && linkedSeries && linkedSeries.is('map')) {
series.group.add(linkedSeries.group);
}
},

并更新了以下

const zoomFactor = chart.mapView.zoom / chart.mapView.minZoom;

我需要的是馅饼不受缩放级别的影响。你能告诉我怎么做吗?

删除zoomFactor属性可以使饼图不受缩放级别的影响。

演示:https://jsfiddle.net/BlackLabel/ybL5e3au/

最新更新