Skip to content

Commit

Permalink
Merge pull request jupyter-widgets#575 from martinRenou/clean_docs
Browse files Browse the repository at this point in the history
Clean docs
  • Loading branch information
martinRenou authored May 4, 2020
2 parents 9aa0620 + feeaab7 commit abe7fac
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 18 deletions.
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,8 @@ ipyleaflet/static/
.DS_Store

js/jupyter-leaflet-*.tgz

# Documentation data files
docs/*.csv
docs/*.json
docs/*.nc
37 changes: 20 additions & 17 deletions docs/source/api_reference/legend_control.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,29 +7,32 @@ Example
.. jupyter-execute::

from ipyleaflet import Map, LegendControl
mymap = Map(center=(-10,-45), zoom=4)
a_legend = LegendControl({"low":"#FAA", "medium":"#A55", "High":"#500"}, name="Legend", position="bottomright")
mymap.add_control(a_legend)
mymap

m = Map(center=(-10,-45), zoom=4)

legend = LegendControl({"low":"#FAA", "medium":"#A55", "High":"#500"}, name="Legend", position="bottomright")
m.add_control(legend)

m

.. jupyter-execute::

# manipulate the legend
# Manipulate the legend

# legend title
a_legend.name = "Risk" ## set name
a_legend.name # get name
# Set/Get legend title
legend.name = "Risk" # Set name
legend.name # Get name

# legend content
a_legend.legends = {"el1":"#FAA", "el2":"#A55", "el3":"#500"} #set content
a_legend.legends # get content
a_legend.add_legend_element("el5","#000") # add a legend element
a_legend.remove_legend_element("el5") # remove a legend element
# Set/Get legend content
legend.legends = {"el1":"#FAA", "el2":"#A55", "el3":"#500"} # Set content
legend.legends # Get content

legend.add_legend_element("el5","#000") # Add a legend element
legend.remove_legend_element("el5") # Remove a legend element

# legend position
a_legend.positionning ="topright"
a_legend.positionning # get current positionning
legend.position = "topright" # Set position
legend.position # Get current position

Attributes
----------
Expand All @@ -38,6 +41,6 @@ Attributes
Attribute Default Value Doc
================ ================ ===
position 'topleft' Position of the control, can be 'bottomleft', 'bottomright', 'topleft', or 'topright'
legend None a dictionnary that represents the legend
title "Legend" LegendControl name
legend None A dictionary containing the name->color mapping that represents the legend
title 'Legend' Legend name
================ ================ ===
2 changes: 1 addition & 1 deletion docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import sphinx_rtd_theme

extensions = [
'jupyter_sphinx.execute',
'jupyter_sphinx',
]

templates_path = ['_templates']
Expand Down

0 comments on commit abe7fac

Please sign in to comment.