-
Notifications
You must be signed in to change notification settings - Fork 363
Add subitems to layers (either layers or controls or a mixture of both) #1011
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
Merged
martinRenou
merged 40 commits into
jupyter-widgets:master
from
HaudinFlorence:add_subitems_to_layers
Sep 23, 2022
Merged
Changes from all commits
Commits
Show all changes
40 commits
Select commit
Hold shift + click to select a range
f791429
Add subitems to a layer (either layers or controls).
HaudinFlorence e89f60f
Update the example notebook Subitems.ipynb.
HaudinFlorence bdd4af2
Fix flake8 formatting issue.
HaudinFlorence cba6f73
Remove Choropleth.ipynb notebook from commited files.
HaudinFlorence 8ccc3bd
Restore Choropleth notebook.
HaudinFlorence b2532f2
Take Choropleth notebook version from master.
HaudinFlorence 6845e66
Update the example notebook Subitems.ipynb.
HaudinFlorence 219d4be
Simplify importation from ipyleaflet.
HaudinFlorence e0eb639
Update ipyleaflet/leaflet.py
HaudinFlorence 4e52717
Update Map.js according to the review comments.
HaudinFlorence ac03e1f
Update js/src/Map.js
HaudinFlorence 362b484
Update js/src/Map.js
HaudinFlorence ce5dcec
Update Map.js and update example notebook Subitems.ipynb.
HaudinFlorence 60fa8ff
Update add_subitem_model and remove_subitem_view using instanceof che…
HaudinFlorence f3750c1
Remove files that should not be tracked.
HaudinFlorence cac3916
Update js/src/Map.js
HaudinFlorence 9157fc0
Update js/src/Map.js
HaudinFlorence cc9d01a
Update ipyleaflet/leaflet.py
HaudinFlorence efb1879
Add a Subitems.ipynb notebooks in ui-tests/notebooks and update the e…
HaudinFlorence c74e7ab
Retry the CI tests.
HaudinFlorence b078e34
Update Subitems.ipynb in ui-tests/notebooks.
HaudinFlorence 665018b
Add pandas in install_requires in setup.py.
HaudinFlorence 3bbcb57
Try to remove the MagnifyingGlass item in ui-tests/notebooks/Subitem…
HaudinFlorence 30558c3
Re try CI tests.
HaudinFlorence b62bf9a
Update Playwright Snapshots
github-actions[bot] 5c1ede7
Fix the failing ui-test by setting spin to false for the icon1 Awesom…
HaudinFlorence c992a40
Remove the marker with an icon and replace it by a simple one.
HaudinFlorence e53dc31
Restore the marker with the icon.
HaudinFlorence 70aa0b7
Update Playwright Snapshots
github-actions[bot] 7bedabf
Retry CI tests after the update of the galata references.
HaudinFlorence 57c8fa1
Update Layer.js and Map.js to deal with the model and view of subitem…
HaudinFlorence 88f78fc
Update Layer.js and the example notebook Subitems.ipynb.
HaudinFlorence b4f91bb
Update setup.py
HaudinFlorence e4b2804
Add pandas dependency in tests and fix linting in Layers.js.
HaudinFlorence 095ff12
Remove pandas version in tests dependencies.
HaudinFlorence c52fc55
Change layer2 basemap in ui-tests/notebooks/Subitems, to try to fix t…
HaudinFlorence e286bf1
Suppress an empty cell in ui-tests/notebooks/Subitems.ipynb.
HaudinFlorence 6e102e8
Remove ui-tests/tests/ipyleaflet.test.ts-snapshots/Subitems-linux.png.
HaudinFlorence 9481f92
Merge branch 'master' into add_subitems_to_layers
martinRenou 5552afc
Update Playwright Snapshots
github-actions[bot] File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,182 @@ | ||
| { | ||
| "cells": [ | ||
| { | ||
| "cell_type": "code", | ||
| "execution_count": null, | ||
| "metadata": {}, | ||
| "outputs": [], | ||
| "source": [ | ||
| "# Set up for JupyterLite\n", | ||
| "try:\n", | ||
| " import piplite\n", | ||
| " await piplite.install('ipyleaflet')\n", | ||
| "except ImportError:\n", | ||
| " pass" | ||
| ] | ||
| }, | ||
| { | ||
| "cell_type": "code", | ||
| "execution_count": null, | ||
| "metadata": {}, | ||
| "outputs": [], | ||
| "source": [ | ||
| "from ipyleaflet import Map, Marker, Choropleth, MagnifyingGlass, ColormapControl, AwesomeIcon, basemaps, basemap_to_tiles\n", | ||
| "import json\n", | ||
| "import pandas as pd\n", | ||
| "from ipywidgets import link, FloatSlider\n", | ||
| "from branca.colormap import linear\n", | ||
| "center = (43, -100)\n", | ||
| "zoom = 4" | ||
| ] | ||
| }, | ||
| { | ||
| "cell_type": "code", | ||
| "execution_count": null, | ||
| "metadata": {}, | ||
| "outputs": [], | ||
| "source": [ | ||
| "geo_json_data = json.load(open(\"us-states.json\"))\n", | ||
| "m1 = Map(center=center, zoom=zoom)" | ||
| ] | ||
| }, | ||
| { | ||
| "cell_type": "code", | ||
| "execution_count": null, | ||
| "metadata": {}, | ||
| "outputs": [], | ||
| "source": [ | ||
| "unemployment = pd.read_csv(\"US_Unemployment_Oct2012.csv\")\n", | ||
| "unemployment = dict(\n", | ||
| " zip(unemployment[\"State\"].tolist(), unemployment[\"Unemployment\"].tolist())\n", | ||
| ")\n", | ||
| "\n", | ||
| "marker1 = Marker(location=(center))\n", | ||
| "\n", | ||
| "layer1 = Choropleth(\n", | ||
| " geo_data=geo_json_data,\n", | ||
| " choro_data=unemployment,\n", | ||
| " colormap=linear.YlOrRd_04,\n", | ||
| " style={\"fillOpacity\": 0.8, \"dashArray\": \"5, 5\"},\n", | ||
| " subitems= (marker1,)\n", | ||
| ")" | ||
| ] | ||
| }, | ||
| { | ||
| "cell_type": "code", | ||
| "execution_count": null, | ||
| "metadata": {}, | ||
| "outputs": [], | ||
| "source": [ | ||
| "m1.add(layer1)\n", | ||
| "m1" | ||
| ] | ||
| }, | ||
| { | ||
| "cell_type": "code", | ||
| "execution_count": null, | ||
| "metadata": {}, | ||
| "outputs": [], | ||
| "source": [ | ||
| "m1.remove(layer1)\n", | ||
| "m1" | ||
| ] | ||
| }, | ||
| { | ||
| "cell_type": "code", | ||
| "execution_count": null, | ||
| "metadata": {}, | ||
| "outputs": [], | ||
| "source": [ | ||
| "m1.add(layer1)\n", | ||
| "colormap_control1 = ColormapControl(\n", | ||
| " caption='Unemployment rate',\n", | ||
| " colormap=layer1.colormap,\n", | ||
| " value_min=layer1.value_min,\n", | ||
| " value_max=layer1.value_max,\n", | ||
| " position='topright',\n", | ||
| " transparent_bg=True\n", | ||
| ")" | ||
| ] | ||
| }, | ||
| { | ||
| "cell_type": "code", | ||
| "execution_count": null, | ||
| "metadata": {}, | ||
| "outputs": [], | ||
| "source": [ | ||
| "layer1.subitems = layer1.subitems+(colormap_control1,)\n", | ||
| "m1" | ||
| ] | ||
| }, | ||
| { | ||
| "cell_type": "code", | ||
| "execution_count": null, | ||
| "metadata": {}, | ||
| "outputs": [], | ||
| "source": [ | ||
| "marker2 = Marker(location=(center[0]-4, center[1] - 4))\n", | ||
| "marker3 = Marker(location=(center[0]-8, center[1] - 8))\n", | ||
| "layer2 = basemap_to_tiles(basemaps.Strava.Water, subitems= (marker2,))\n", | ||
| "icon1 = AwesomeIcon(\n", | ||
| " name='gear',\n", | ||
| " marker_color='blue',\n", | ||
| " icon_color='darkblue',\n", | ||
| " spin=True\n", | ||
| " \n", | ||
| ")\n", | ||
| "marker4 = Marker(icon=icon1, location=(center[0], center[1] - 4))" | ||
| ] | ||
| }, | ||
| { | ||
| "cell_type": "code", | ||
| "execution_count": null, | ||
| "metadata": {}, | ||
| "outputs": [], | ||
| "source": [ | ||
| "layer2.subitems = layer2.subitems+(marker3, marker4)\n", | ||
| "m1.add(layer2)\n", | ||
| "m1" | ||
| ] | ||
| }, | ||
| { | ||
| "cell_type": "code", | ||
| "execution_count": null, | ||
| "metadata": {}, | ||
| "outputs": [], | ||
| "source": [ | ||
| "m1.remove(layer1)\n", | ||
| "m1" | ||
| ] | ||
| }, | ||
| { | ||
| "cell_type": "code", | ||
| "execution_count": null, | ||
| "metadata": {}, | ||
| "outputs": [], | ||
| "source": [ | ||
| "m1.remove(layer2)" | ||
| ] | ||
| } | ||
| ], | ||
| "metadata": { | ||
| "kernelspec": { | ||
| "display_name": "Python 3 (ipykernel)", | ||
| "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.9.12" | ||
| } | ||
| }, | ||
| "nbformat": 4, | ||
| "nbformat_minor": 4 | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.