addListener(name = "syncZoom", expression = paste("for (var x in charts) {
charts[x].addListener("zoomed", syncZoom);
charts[x].addListener("init", addCursorListeners);
}
function addCursorListeners(event) {
event.chart.chartCursor.addListener("changed", handleCursorChange);
event.chart.chartCursor.addListener("onHideCursor", handleHideCursor);
}
function syncZoom(event) {
for (x in charts) {
if (charts[x].ignoreZoom) {
charts[x].ignoreZoom = false;
}
if (event.chart != charts[x]) {
charts[x].ignoreZoom = true;
charts[x].zoomToDates(event.startDate, event.endDate);
}
}
}
function handleCursorChange(event) {
for (var x in charts) {
if (event.chart != charts[x]) {
charts[x].chartCursor.syncWithCursor(event.chart.chartCursor);
}
}
}
function handleHideCursor() {
for (var x in charts) {
if (charts[x].chartCursor.hideCursor) {
charts[x].chartCursor.forceShow = false;
charts[x].chartCursor.hideCursor(false);
}
}
}"))
Hi,
Nice package you put together. I use it a lot.
I'm trying to replicate the JS example in https://www.amcharts.com/kbase/syncing-zoom-across-several-date-based-serial-charts/ using listeners in rAmChart but I've not been able to get it to work after several trials. I added the JS below to my existing serial charts per your suggestion in http://datastorm-open.github.io/introduction_ramcharts/advance.html but nothing happened. Could you please tell me what I'm doing wrong. I'm not familiar with JS so this might be something simple that I'm missing.
Thank you.