{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Time-series widget\n",
"\n",
"The time series widget enables you to display animated data (by aggregation) over a specified date or numeric field. Time series widgets provide a status bar of the animation, controls to play or pause, and the ability to filter on a range of values.\n",
"\n",
"To see available parameters run `help(time_series_widget)`.\n",
"\n",
"In the example below, collisions in Seattle are animated by the date they occured. The number of incidents over time are shown in the time series widget bars."
]
},
{
"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": {},
"outputs": [
{
"data": {
"text/html": [
""
],
"text/plain": [
""
]
},
"execution_count": 1,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"from cartoframes.viz import Layer, animation_style, time_series_widget\n",
"\n",
"Layer(\n",
" 'seattle_collisions',\n",
" animation_style('incdate', duration=20, fade_in=0.5, fade_out=0.5),\n",
" widgets=[\n",
" time_series_widget(\n",
" value='incdate',\n",
" title='Number of Collisions by Date',\n",
" description= 'Play, pause, or select a range for the animation'\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
}