Custom Tethys Components
Custom Python components provided by Tethys.
Important
This module should not be used directly (e.g. via from tethys_components import custom) but is made accessible on the Tethys Component App Page Library lib object via the tethys namespace (i.e. lib.tethys).
When the API is access this way, the first lib argument for each component function below behaves much like self does for classes, meaning it should not be explicitly passed.
- tethys_components.custom.Chart(lib, data=None, width=400, height=300, color='red', title='', x_label='', y_label='', x_attr='x', y_attr='y')
A chart for displaying x-y coordinate pairs
- Parameters:
data (DataFrame|) -- Any dataset that can be initialized as a Panadas DataFrame, including a Pandas Dataframe itself.
width (int) -- The rendered width of the chart in pixels. Defaults to 500.
height (int) -- The rendered height of the chart in pixels. Defaults to 400.
x_label (str) -- The rendered label of the x-axis. Defauls to "".
color (str) -- The color of the chart. Defaults to "red".
title (str) -- The title of the chart. Defaults to "".
x_label -- The rendered label of the x-axis. Defauls to "".
y_label (str) -- The rendered label of the y-axis. Defauls to "".
x_attr (str) -- The name of the attribute in the data to use for the x-axis. Defaults to "x".
y_attr (str) -- The name of the attribute in the data to use for the y-axis. Defaults to "y".
- tethys_components.custom.Map(lib, default_basemap='OpenStreetMap', projection='EPSG:3857', center=None, zoom=1, children=None, **kwargs)
A Map for displaying geospatial data. Fixed to the EPSG:3857 projection.
- Parameters:
center ([int|float,int|float]) -- The center point of the rendered map, in [lon, lat] or [x, y] format. Defaults to [-100, 40].
zoom (int|float) -- The initial zoom level of the map, where 1 is at the global scale and 20 is at the neighborhood scale. Defaults to 3.5.
on_click (callable) -- A function that should be called when the map is clicked. Defaults to None.
children (list[]) -- A list of layers to be rendered. These can also be passed in as nested components (i.e. Map()(layer1, layer2, layer3)). Defaults to [].
- tethys_components.custom.Panel(lib, show=True, on_close=<function <lambda>>, anchor='right', extent='500px', title='Panel', style=None, children=None)
A pop out panel with custom content anchored to the left, right, top or bottom
- Parameters:
show (bool) -- Whether to show initially. Defaults to False.
set_show (callable) -- The function that will be used to update the show state. It accepts
anchor (str) -- Where to anchor the panel. Must be one of: right, left, top, or bottom. Defaults to "right".
extent (str) -- The height/width of the panel. Defaults to "500px".
title (str) -- The title to display at the top of the panel. Defaults to "Panel".
(dict[str (style) -- str]|Style): Any CSS styles as key:value pairs to be applied to the panel. Defaults to {}.
children -- The actual nested content that is to be rendered. Can also be supplied as call args to Panel (i.e. Panel()(panel_content)).