Skip to content

Chart

QuantConnect.Chart

Chart()
Chart(name: str)
Chart(name: str, symbol: Union[Symbol, str, BaseContract])
Chart(name: str, type: ChartType = ...)

Bases: Object

Single Parent Chart Object for Custom Charting

Signature descriptions:

  • Default constructor for chart:

  • Constructor for a chart

  • Chart Constructor:

Parameters:

Name Type Description Default
name Optional[str]

String name of the chart

None
symbol Optional[Union[Symbol, str, BaseContract]]

Associated symbol if any

None
type Optional[ChartType]

Type of the chart

...

name

name: str

Name of the Chart

chart_type

chart_type: ChartType

ChartType is now obsolete. Please use Series indexes instead by setting index in the series constructor.

series

series: Dictionary[str, BaseSeries]

symbol

symbol: Symbol

Associated symbol if any, making this an asset plot

legend_disabled

legend_disabled: bool

True to hide this series legend from the chart

try_add_and_get_series

try_add_and_get_series(
    name: str,
    type: SeriesType,
    index: int,
    unit: str,
    color: Color,
    symbol: ScatterMarkerSymbol,
    force_add_new: bool = False,
) -> Series
try_add_and_get_series(
    name: str,
    template_series: BaseSeries,
    force_add_new: bool = False,
) -> BaseSeries

Gets Series if already present in chart, else will add a new series and return it

Parameters:

Name Type Description Default
name str

Name of the series

required
type Optional[SeriesType]

Type of the series

None
index Optional[int]

Index position on the chart of the series

None
unit Optional[str]

Unit for the series axis

None
color Optional[Color]

Color of the series

None
symbol Optional[ScatterMarkerSymbol]

Symbol for the marker in a scatter plot series

None
force_add_new bool

True will always add a new Series instance, stepping on existing if any

False
template_series Optional[BaseSeries]

Series to be used as a template. It will be clone without values if the series is added to the chart

None

add_series

add_series(series: BaseSeries) -> None

Add a reference to this chart series:

Parameters:

Name Type Description Default
series BaseSeries

Chart series class object

required

aggregate

aggregate(series_type: SeriesType = ...) -> Chart

Helper method to consolidate a chart into a single series chart by summing all values

clone

clone() -> Chart

Return a new instance clone of this object

clone_empty

clone_empty() -> Chart

Return a new empty instance clone of this object

get_updates

get_updates() -> Chart

Fetch a chart with only the updates since the last request, Underlying series will save the index position.