Skip to content

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