Skip to content

try to enable click anywhere in Geo mode #2

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

Merged
merged 2 commits into from
Feb 18, 2021

Conversation

yiyuezhuo
Copy link

@yiyuezhuo yiyuezhuo commented Feb 15, 2021

The original PR will break when one clicks "anywhere" on the Map figure. This PR fix it:

Basic test case with dev tools:

       var TESTER = Tabs.getGraph()

        var data = [{
            type: 'scattergeo',
            lat: [ 40.7127, 51.5072 ],
            lon: [ -74.0059, 0.1275 ],
            mode: 'lines',
            line:{
                width: 2,
                color: 'blue'
            }
        }];

        var layout = {
            title: 'London to NYC Great Circle',
            showlegend: false,
            geo: {
                resolution: 50,
                showland: true,
                showlakes: true,
                landcolor: 'rgb(204, 204, 204)',
                countrycolor: 'rgb(204, 204, 204)',
                lakecolor: 'rgb(255, 255, 255)',
                projection: {
                    type: 'equirectangular'
                },
                coastlinewidth: 2,
                lataxis: {
                    range: [ 20, 60 ],
                    showgrid: true,
                    tickmode: 'linear',
                    dtick: 10
                },
                lonaxis:{
                    range: [-100, 20],
                    showgrid: true,
                    tickmode: 'linear',
                    dtick: 20
                }
            },
            clickmode: "event+anywhere"
        };

        Plotly.newPlot(TESTER, data, layout);

        TESTER.on('plotly_click', function(clickData) {
            console.log(clickData);
            var x = clickData["points"][0]["x"];
        });

@yiyuezhuo
Copy link
Author

Run unit tests locally using npm run test-jasmine give many random errors so that I can't find a proper way to test locally...

@sleighsoft sleighsoft merged commit 0956827 into sleighsoft:click_v1 Feb 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants