{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Multiple popup events\n",
"\n",
"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.\n",
"\n",
"For more information on popups, run `help(Popup)`.\n",
"\n",
"In this example, there are two different definitions for popup information depending on whether it is a `hover` or `click` event."
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"from cartoframes.auth import set_default_credentials\n",
"\n",
"set_default_credentials('cartoframes')"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {
"scrolled": false
},
"outputs": [
{
"data": {
"text/html": [
""
],
"text/plain": [
""
]
},
"execution_count": 1,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"from cartoframes.viz import Layer, popup_element\n",
"\n",
"Layer(\n",
" 'countries_africa',\n",
" popup_hover=[\n",
" popup_element('name', title='Country'),\n",
" ],\n",
" popup_click=[\n",
" popup_element('pop_est', title='Population'),\n",
" popup_element('gdp_md_est', title='GDP')\n",
" ]\n",
")"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.5"
}
},
"nbformat": 4,
"nbformat_minor": 2
}