admin管理员组文章数量:1122832
i.e. it should work like this:
- when zooming in, "OpenStreetMap" is loaded
- when zooming out, "HighchartMap" is returned
It would be great if you could help me with the example.
my examle
i.e. it should work like this:
- when zooming in, "OpenStreetMap" is loaded
- when zooming out, "HighchartMap" is returned
It would be great if you could help me with the example.
my examle
1 Answer
Reset to default 0Inside of the redraw
event, you can check current zoom level, and if it exceeds certain threshold, you can dynamically add tiledwebmap
series. Then, on zooming out, you can also check the zoom level and based on it's value hide or show the tiledwebmap
series.
events: {
redraw() {
const chart = this;
const zoom = chart.mapView.zoom;
const zoomThreshold = 3;
if (chart.series.length <= 1) {
if (zoom >= zoomThreshold) {
chart.addSeries({
type: 'tiledwebmap',
provider: {
type: 'OpenStreetMap'
}
}, false);
}
} else
chart.series[1].setVisible(zoom >= zoomThreshold, false);
}
}
}
Demo: https://jsfiddle.net/BlackLabel/pczrf1ah/
API:
https://api.highcharts.com/class-reference/Highcharts.Chart#addSeries
https://api.highcharts.com/class-reference/Highcharts.Series#setVisible
本文标签:
版权声明:本文标题:highcharts - how to make "HighchartMap" change to "OpenStreetMap" after several scrolls of t 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736305035a1932447.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论