Plotly#

pydantic model zero_true.PlotlyComponent#

Component to display a Plotly figure

Show JSON schema
{
   "title": "PlotlyComponent",
   "description": "Component to display a Plotly figure",
   "type": "object",
   "properties": {
      "id": {
         "description": "ID for the component",
         "title": "Id",
         "type": "string"
      },
      "variable_name": {
         "default": "",
         "description": "Optional variable name associated with a component",
         "title": "Variable Name",
         "type": "string"
      },
      "component": {
         "default": "plotly-plot",
         "description": "Vue component name for Plotly",
         "title": "Component",
         "type": "string"
      },
      "figure_json": {
         "description": "Serialized Plotly figure as JSON string",
         "title": "Figure Json",
         "type": "string"
      }
   },
   "required": [
      "id",
      "figure_json"
   ]
}

field component: str = 'plotly-plot'#

Vue component name for Plotly

field figure_json: str [Required]#

Serialized Plotly figure as JSON string

field id: str [Required]#

ID for the component

Validated by:
  • validate_unique_component_id

classmethod from_figure(figure: Figure, id: str)#

Creates a PlotlyComponent instance from a Plotly figure.

to_json()#

Converts the component to a JSON-serializable dictionary.