class documentation
Displays a Plotly chart.
Note
See https://github.com/plotly/react-plotly.js/#basic-props for documentation.
All event handlers have the following default params:
- id: the corresponding data.ids[idx]
- path: the path of the property
- relative_path: the relative path of the property
- schema: the schema of the property
- view: the value of the PlotlyView
- event: the event name (eg. onClick, onSelected, onDoubleClick)
- value: the value of the clicked point (only pie chart-like plots)
- label: the label of the clicked point (only pie chart-like plots)
- shift_pressed: whether the shift key was pressed
Examples:
def render(self, ctx): panel.plot("my_plot", on_click=self.on_click, on_selected=self.on_selected) def print_params(self, ctx, params): for key, value in params.items(): ctx.print(f"{key}: {value}") def on_click(self, ctx): # available params self.print_prams(ctx, { "id": "id", # the corresponding data.ids[idx] "idx": 1, # the index of the clicked point "label": "label", # label (eg. on pie charts) "shift_pressed": false, # whether the shift key was pressed "trace": "my_trace", # data[trace_idx].name "trace_idx": 0, "value": "my_value", # data[trace_idx].values[idx] (eg. on a pie chart) "x": 2, # data[trace_idx].x[idx] (the x value on most plot types) "y": 3, # data[trace_idx].y[idx] (the y value on most plot types) "z": 4, # data[trace_idx].z[idx] (the z value on 3d plots eg. heatmap) }) def on_selected(self, ctx): prin(ctx.params['data']) # [ # { # "trace": "trace 0", # data[trace_idx].name # "trace_idx": 0, # the index of the trace # "idx": 1, # the index of the selected point # "id": "one", # the corresponding data.ids[idx] # "x": 2, # the x value of the selected point # "y": 15, # the y value of the selected point # "z": 22 # the z value of the selected point # } # ]
Parameters | |
data | the chart data |
config | the chart config |
layout | the chart layout |
on | event handler for click events |
on | event handler for selected events |
on | event handler for double click events |
Method | __init__ |
Undocumented |
Method | to |
Undocumented |
Instance Variable | config |
Undocumented |
Instance Variable | data |
Undocumented |
Instance Variable | layout |
Undocumented |
Inherited from View
:
Method | clone |
Undocumented |
Method | kwargs |
Undocumented |
Instance Variable | caption |
Undocumented |
Instance Variable | component |
Undocumented |
Instance Variable | components |
Undocumented |
Instance Variable | container |
Undocumented |
Instance Variable | description |
Undocumented |
Instance Variable | label |
Undocumented |
Instance Variable | placeholder |
Undocumented |
Instance Variable | read |
Undocumented |
Instance Variable | space |
Undocumented |
Instance Variable | _kwargs |
Undocumented |