Popups provide information about features through either click
or hover
interactivity events. Features can listen to both events or multiple properties from the same event.
For more information on popups, run help(Popup)
.
In this example, the click
and hover
events show attributes from the Layer with custom titles and formats.
In [1]:
from cartoframes.auth import set_default_credentials
from cartoframes.viz import Layer, basic_style, popup_element
set_default_credentials('cartoframes')
In [2]:
from cartoframes.viz import Layer, popup_element
Layer(
'spain_populated_places',
basic_style(size=10),
popup_hover=[
popup_element('name', 'City'),
popup_element('pop_max', title='Rounded population', format=',.2r')
]
)
Out[2]: