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

Popup API #677

Closed
3 tasks done
Jesus89 opened this issue May 17, 2019 · 1 comment
Closed
3 tasks done

Popup API #677

Jesus89 opened this issue May 17, 2019 · 1 comment
Assignees

Comments

@Jesus89
Copy link
Member

Jesus89 commented May 17, 2019

This is a proposal based on #641.

The proposed changes are:

  • Rename Interactivity to Popup
  • Allow setting up 'hover' and 'click' event at the same time
  • Use columns directly (without manually declaring the variables in the style)
  • Use expressions directly

Examples:

  • Columns
# Popup: columns
Map(
    Layer(
        Source('populated_places'),
        Style('color: blue'),
        Popup({
            'hover': ['$name'],
            'click': ['$name', '$pop_max']
        })
    )
)

# Popup: columns + sugar
Map(
    Layer(
        'populated_places',
        'color: blue',
        {
            'hover': ['$name'],
            'click': ['$name', '$pop_max']
        }
    )
)
  • Expressions
# Popup: expressions
Map(
    Layer(
        Source('populated_places'),
        Style('color: blue'),
        Popup({
            'hover': ['sqrt($pop_max)', '$pop_min % 100']
        })
    )
)

# Popup: expressions + sugar
Map(
    Layer(
        'populated_places',
        'color: blue',
        {
            'hover': ['sqrt($pop_max)', '$pop_min % 100']
        }
    )
)
  • Labels
# Popup: with labels
Map(
    Layer(
        Source('populated_places'),
        Style('color: blue'),
        Popup({
            'hover': [{
                'label': 'Name',
                'value': '$name'
            }],
            'click': [{
                'label': 'Name',
                'value': '$name'
            }, {
                'label': 'Pop max',
                'value': '$pop_max'
            }]
        })
    )
)

# Popup: with labels + sugar
Map(
    Layer(
        'populated_places',
        'color: blue',
        {
            'hover': [{
                'label': 'Name',
                'value': '$name'
            }],
            'click': [{
                'label': 'Name',
                'value': '$name'
            }, {
                'label': 'Pop max',
                'value': '$pop_max'
            }]
        }
    )
)
@Jesus89
Copy link
Member Author

Jesus89 commented May 21, 2019

Closed via #682

@Jesus89 Jesus89 closed this as completed May 21, 2019
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

No branches or pull requests

1 participant