Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Syncing zoom across several date-based serial charts #74

Open
cegbuna opened this issue Oct 26, 2017 · 1 comment
Open

Syncing zoom across several date-based serial charts #74

cegbuna opened this issue Oct 26, 2017 · 1 comment

Comments

@cegbuna
Copy link

cegbuna commented Oct 26, 2017

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.

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);
                                                    }
                                                    }
                                                    }"))

Thank you.

@bthieurmel
Copy link
Contributor

Hi,

It's possible with ?amTimeSeries using group parameter

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: No status
Development

No branches or pull requests

2 participants