Skip to content

chart class

Displays data sets in a chart or a group of charts.

Methods

__init__()

__init__(
    data=None,
    type="scatter",
    mode="lines+markers",
    x=None,
    y=None,
    z=None,
    lon=None,
    lat=None,
    r=None,
    theta=None,
    high=None,
    low=None,
    open=None,
    close=None,
    measure=None,
    locations=None,
    values=None,
    labels=None,
    parents=None,
    text=None,
    base=None,
    title=None,
    render=True,
    on_range_change=None,
    columns=None, # All columns
    label=None,
    name=None,
    selected=None,
    color=None,
    selected_color=None,
    marker=None,
    line=None,
    selected_marker=None,
    layout=None,
    plot_config=None,
    options=None,
    orientation=None,
    text_anchor=None,
    xaxis=None,
    yaxis=None,
    width="100%",
    height=None,
    template=None,
    decimator=None,
    rebuild=False,
    figure=None,
    on_click=None,
    on_change=None,
    propagate=None, # App config
    active=True,
    id=None,
    properties=None,
    class_name=None,
    hover_text=None,
) -> None

Create a new chart element.

Parameters:

Name Type Description Default
data dynamic(Any)

The data object bound to this chart control.
See the section on the data property below for more details.

None
type indexed(str)

Chart type.
See the Plotly chart type documentation for more details.

scatter
mode indexed(str)

Chart mode.
See the Plotly chart mode documentation for more details.

lines+markers
x indexed(str)

Column name for the x axis.

None
y indexed(str)

Column name for the y axis.

None
z indexed(str)

Column name for the z axis.

None
lon indexed(str)

Column name for the longitude value, for 'scattergeo' charts. See Plotly Map traces.

None
lat indexed(str)

Column name for the latitude value, for 'scattergeo' charts. See Plotly Map traces.

None
r indexed(str)

Column name for the r value, for 'scatterpolar' charts. See Plotly Polar charts.

None
theta indexed(str)

Column name for the theta value, for 'scatterpolar' charts. See Plotly Polar charts.

None
high indexed(str)

Column name for the high value, for 'candlestick' charts. See Plotly Candlestick charts.

None
low indexed(str)

Column name for the low value, for 'candlestick' charts. See Ploty Candlestick charts.

None
open indexed(str)

Column name for the open value, for 'candlestick' charts. See Plotly Candlestick charts.

None
close indexed(str)

Column name for the close value, for 'candlestick' charts. See Plotly Candlestick charts.

None
measure indexed(str)

Column name for the measure value, for 'waterfall' charts. See Plotly Waterfall charts.

None
locations indexed(str)

Column name for the locations value. See Plotly Choropleth maps.

None
values indexed(str)

Column name for the values value. See Plotly Pie charts or Plotly Funnel Area charts.

None
labels indexed(str)

Column name for the labels value. See Plotly Pie charts.

None
parents indexed(str)

Column name for the parents value. See Plotly Treemap charts.

None
text indexed(str)

Column name for the text associated to the point for the indicated trace.
This is meaningful only when mode has the text option.

None
base indexed(str)

Column name for the base value. Used in bar charts only.
See the Plotly bar chart base documentation for more details."

None
title str

The title of the chart control.

None
render dynamic(bool)

If True, this chart is visible on the page.

True
on_range_change Union[str, Callable]

A function or the name of a function that is triggered when the visible part of the x axis changes.
This function is invoked with the following parameters:

  • state (State): the state instance.
  • id (str): the identifier of the chart control if it has one.
  • payload (dict[str, Any]): the full details on this callback's invocation, as emitted by Plotly.

None
columns Union[str, list[str], dict[str, dict[str, str]]]

The list of column names to represent.

  • str: ;-separated list of column names
  • list[str]: list of names
  • dict: {"column_name": {format: "format", index: 1}} if index is specified, it represents the display order of the columns. If not, the list order defines the index

If columns is omitted or set to None, all columns of data are represented.

All columns
label indexed(str)

The label for the indicated trace.
This is used when the mouse hovers over a trace.

None
name indexed(str)

The name of the indicated trace.

None
selected indexed(dynamic(Union[list[int], str]))

The list of the indices of the rows to be displayed as selected.

None
color indexed(str)

The color of the indicated trace (or a column name for scattered).

None
selected_color indexed(str)

The color of the selected points for the indicated trace.

None
marker indexed(dict[str, Any])

The type of markers used for the indicated trace.
See marker for more details.
Color, opacity, size and symbol can be column names.

None
line indexed(Union[str, dict[str, Any]])

The configuration of the line used for the indicated trace.
See line for more details.
If the value is a string, it must be a dash type or pattern (see dash style of lines for more details).

None
selected_marker indexed(dict[str, Any])

The type of markers used for selected points in the indicated trace.
See selected marker for more details.

None
layout dynamic(dict[str, Any])

The plotly.js compatible layout object.

None
plot_config dict[str, Any]

The plotly.js compatible configuration options object.

None
options indexed(dict[str, Any]) None
orientation indexed(str)

The orientation of the indicated trace.

None
text_anchor indexed(str)

Position of the text relative to the point.
Valid values are: top, bottom, left, and right.

None
xaxis indexed(str)

The x axis identifier for the indicated trace.

None
yaxis indexed(str)

The y axis identifier for the indicated trace.

None
width Union[str, int, float]

The width of the chart, in CSS units.

100%
height Union[str, int, float]

The height of the chart, in CSS units.

None
template dict

The Plotly layout template.

None
decimator indexed(str)

The name of the Python variable that holds a decimator instance for the indicated trace.
If defined as indexed, it impacts only the indicated trace; if not, it applies to the first trace only.

None
rebuild dynamic(bool)

Allows dynamic config refresh if set to True.

False
figure dynamic(Figure)

A figure as produced by Plotly.

None
on_click Union[str, Callable]

A function or the name of a function that is triggered when the user clicks in the chart background.
This function is invoked with the following parameters:

  • state (State): the state instance.
  • id (str): the identifier of the chart control if it has one.
  • payload (dict[str, Any]): a dictionary containing the x and y coordinates of the click or latitude and longitude in the case of a map. This feature relies on non-public Plotly structured information.

None
on_change Union[str, Callable]

A function or the name of a function that is triggered when the value changes.
The callback function receives the following parameters:

  • state (State): the state instance.
  • var_name (str): the bound variable name.
  • value (Any): the updated value.

None
propagate bool

Determines whether the control's value is automatically reflected in the bound application variable.
The default value is defined at the application configuration level by the propagate configuration option.
If True, any change to the control's value is immediately reflected in the variable.

App config
active dynamic(bool)

Indicates if this element is active.
If False, the element is disabled, and user interaction is not allowed.

True
id str

The identifier assigned to the rendered HTML component.
This can be used in callbacks or to target the element for styling.

None
properties dict[str, Any]

A dictionary of additional properties that can be set to the element.

None
class_name dynamic(str)

A space-separated list of CSS class names to be applied to the generated HTML element.
These classes are added to the default taipy-chart class.

None
hover_text dynamic(str)

The text that is displayed when the user hovers over the element.

None