LineChart

Draws a line chart.

Overview

  • Inherits from LayoutControl.
  • Used to visualize data as a series of connected points.
  • Properties

  • animation: AnimationValue - Controls chart implicit animation. Defaults to Animation(duration=150ms, curve=LINEAR).
  • baseline_x: Number | None - Baseline value for X axis.
  • baseline_y: Number | None - Baseline value for Y axis.
  • bgcolor: ColorValue | None - Background color of the chart.
  • border: Border | None - The border around the chart.
  • bottom_axis: ChartAxis | None - Appearance of the bottom axis.
  • data_series: list[LineChartData] - A list of LineChartData controls.
  • horizontal_grid_lines: ChartGridLines | None - Controls drawing of horizontal grid lines.
  • interactive: bool - Enables automatic tooltips and points highlighting. Defaults to True.
  • left_axis: ChartAxis | None - Appearance of the left axis.
  • max_x: Number | None - Maximum displayed value for X axis.
  • max_y: Number | None - Maximum displayed value for Y axis.
  • min_x: Number | None - Minimum displayed value for X axis.
  • min_y: Number | None - Minimum displayed value for Y axis.
  • point_line_end: Number | None - End of the vertical line drawn at selected point position. Defaults to data point's y value.
  • point_line_start: Number | None - Start of the vertical line drawn under the selected point. Defaults to chart's bottom edge.
  • right_axis: ChartAxis | None - Appearance of the right axis.
  • tooltip: LineChartTooltip | None - Tooltip configuration. If None, no tooltips are shown.
  • top_axis: ChartAxis | None - Appearance of the top axis.
  • vertical_grid_lines: ChartGridLines | None - Controls drawing of vertical grid lines.
  • Events

  • on_event: EventHandler[LineChartEvent] | None - Fires when a chart line is hovered or clicked.
  • Data Structures

  • LineChartData: Represents a single line on the chart.
  • * color: ColorValue - Line color. * curved: bool - Whether the line is curved. * points: list[LineChartDataPoint] - Data points for the line. * stroke_width: int - Thickness of the line. * rounded_stroke_cap: bool - Whether to use rounded stroke caps. * below_line_bgcolor: ColorValue | None - Background color below the line.
  • LineChartDataPoint: Represents a single point on a line.
  • * x: Number - X-coordinate. * y: Number - Y-coordinate.
  • ChartAxis: Configuration for chart axes.
  • * title: Text | None - Axis title. * labels: list[ChartAxisLabel] - Custom labels for the axis. * label_size: int - Size of axis labels. * show_labels: bool - Whether to show axis labels.
  • ChartGridLines: Configuration for chart grid lines.
  • * interval: Number - Interval between grid lines. * color: ColorValue - Color of grid lines. * width: int - Thickness of grid lines.
  • LineChartTooltip: Configuration for chart tooltips.
  • * bgcolor: ColorValue - Background color of the tooltip.

    Examples

    See documentation for detailed usage examples.