简体   繁体   中英

AMCharts Maps v4 - colors in a heatLegend on resize?

In this question user asks how to use several colors in a heatLegend gradient.

This pen provides a way to do so. However, line 108 of the pen says "this needs to be repeated eg on window resize, orientation change, etc."

What would be the correct listener for this to happen? I tried to rebuild the gradient on "sizechanged" with

chart.events.on("sizechanged", function(ev) {
    heatLegendTop.markers.each(function(marker, markerIndex) {
    ... same gradient stuff ... 
})

but it still returns the 2-colored gradient on resize.

For anyone who comes across this question, here's an updated pen that does just that. It essentially involves listening for the sizechanged event on the heatLegend itself:

heatLegend.markers.template.events.on("sizechanged", function(event) {
    event.target.fill = event.target.fill;
});

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM