lightningchart.ui package¶
Submodules¶
lightningchart.ui.axis module¶
- class lightningchart.ui.axis.Axis(chart, axis: str, stack_index: int, parallel_index: int, opposite: bool, type: str, base: int)[source]¶
Bases:
GenericAxis,ComponentWithLinePaletteColoring,UserInteractions,GetCustomTicks,AxisGetMethods,AxisWithAddEventListener- add_band(on_top: bool = True, legend: LegendOptions | None = None)[source]¶
Add a highlighter Band to the Axis. A Band can be used to highlight an interval on the Axis.
- Parameters:
on_top (bool) – Is Band rendered above Series, or below. Default to above.
- legend (dict): Legend configuration dictionary with the following options:
show (bool): Whether to show this series in legend (default: True). text (str): Custom text for legend entry. button_shape (str): Button shape (‘Circle’, ‘Square’, ‘Triangle’, ‘Diamond’,
‘Plus’, ‘Cross’, ‘Minus’, ‘Star’, ‘Arrow’).
button_size (int | dict): Button size in pixels or {‘x’: width, ‘y’: height}. button_fill_style (str): Button color (“#ff0000”). button_stroke_style (dict): Button border {‘thickness’: 2, ‘color’: ‘#000’}. button_rotation (float): Button rotation in degrees. text_font (dict): Text font settings {‘size’: 12, ‘family’: ‘Arial’, ‘weight’: ‘bold’}. text_fill_style (str): Text color (“#000000”). match_style_exactly (bool): Whether button should match series style exactly. highlight (bool): Whether highlighting on hover is enabled. lut: LUT element for legends (None to disable). lut_length (int): LUT bar length in pixels. lut_thickness (int): LUT bar thickness in pixels. lut_display_proportional_steps (bool): LUT step display mode.
- Returns:
Reference to Band class.
- add_constant_line(on_top: bool = True, legend: LegendOptions | None = None)[source]¶
Add a highlighter ConstantLine to the Axis. A ConstantLine can be used to highlight a specific value on the Axis.
- Parameters:
on_top (bool) – Is ConstantLine rendered above Series, or below. Default to above.
- legend (dict): Legend configuration dictionary with the following options:
show (bool): Whether to show this series in legend (default: True). text (str): Custom text for legend entry. button_shape (str): Button shape (‘Circle’, ‘Square’, ‘Triangle’, ‘Diamond’,
‘Plus’, ‘Cross’, ‘Minus’, ‘Star’, ‘Arrow’).
button_size (int | dict): Button size in pixels or {‘x’: width, ‘y’: height}. button_fill_style (str): Button color (“#ff0000”). button_stroke_style (dict): Button border {‘thickness’: 2, ‘color’: ‘#000’}. button_rotation (float): Button rotation in degrees. text_font (dict): Text font settings {‘size’: 12, ‘family’: ‘Arial’, ‘weight’: ‘bold’}. text_fill_style (str): Text color (“#000000”). match_style_exactly (bool): Whether button should match series style exactly. highlight (bool): Whether highlighting on hover is enabled. lut: LUT element for legends (None to disable). lut_length (int): LUT bar length in pixels. lut_thickness (int): LUT bar thickness in pixels. lut_display_proportional_steps (bool): LUT step display mode.
- Returns:
Reference to ConstantLine class.
- add_custom_tick(tick_type: str = 'major')[source]¶
Add custom tick to Axis. Custom ticks can be used to expand on default tick placement, or completely override Axis ticks placement with custom logic.
- Parameters:
tick_type (str) – “major” | “minor” | “box”
- Returns:
Reference to CustomTick class.
- pan(amount: int | float)[source]¶
Pan scale by pixel value delta.
- Parameters:
amount (int | float) – Amount to shift scale of axis in pixels
- Returns:
The instance of the class for fluent interface.
- set_decimal_precision(decimals: int)[source]¶
Format the axis ticks to certain number of decimal numbers.
- Parameters:
decimals (int) – Decimal precision.
- Returns:
The instance of the class for fluent interface.
- set_fallback_to_extreme_ticks(enabled: bool = True)[source]¶
Enable or disable automatic fallback to extreme ticks when an axis becomes too small.
- Parameters:
enabled (bool) – If True, extreme ticks will be automatically displayed when needed. If False, restores the previous behavior (hides extreme ticks). This only applies for Numeric Tick Strategies.
- Returns:
The instance of the class for fluent interface.
- set_great_tick_style(color: any = None, size: int | float = None, length: int | float = None, family: str = None, style: str = None, weight: str = None, disable: bool = False)[source]¶
Set or disable the style of Great Ticks for a DateTime axis.
- Parameters:
color (Color, optional) – Tick label color.
size (int | float, optional) – Tick label font size.
length (int | float, optional) – Length of tick lines.
family (str, optional) – Font family.
style (str, optional) – Font style (‘normal’, ‘italic’).
weight (str, optional) – Font weight (‘normal’, ‘bold’).
disable (bool, optional) – Set to True to disable Great Ticks.
- Returns:
The instance of the class for fluent interface.
- set_keep_tick_labels_in_axis_bounds(enabled: bool = True)[source]¶
Configure whether axis should keep tick labels within its boundaries.
When enabled, tick labels are shifted to fit within the axis bounds, preventing them from going outside. This may cause labels to overlap in edge cases, but generally does not occur in normal scenarios.
- Parameters:
enabled (bool) – True to keep labels in bounds, False to allow overflow. Defaults to True.
- Returns:
The instance of the class for fluent interface.
Examples
Disable keeping tick labels in bounds:
>>> axis.set_keep_tick_labels_in_axis_bounds(False)
Re-enable (default behavior):
>>> axis.set_keep_tick_labels_in_axis_bounds(True)
- set_length(length: int | float, relative: bool)[source]¶
Configure length of axis. E.g. height for Y axis, width for X axis.
- Parameters:
length (int | float) – Length value
relative (bool) – If true, length value is interpreted as relative length across multiple axes. If false, length value is interpreted as length in pixels.
- Returns:
The instance of the class for fluent interface.
- set_margin_after_title(margin: int | float)[source]¶
Set padding after Axis title.
This is only applied when the title is visible.
- Parameters:
margin (int | float) – Gap between the title and the next axis in pixels. Can also affect chart margins.
- Returns:
The instance of the class for fluent interface.
Examples
>>> axis.set_margin_after_title(20)
- set_margins(start: int | float, end: int | float)[source]¶
Add empty space at either end of the axis, without affecting the relative size of the Axis.
- Parameters:
start (int | float) – Start margin in pixels.
end (int | float) – End margin in pixels.
- Returns:
The instance of the class for fluent interface.
- set_overlay_style(color: any)[source]¶
Set style of axis overlay.
- Parameters:
color (Color) – Fill color for the overlay. Use ‘transparent’ or None to hide.
- Returns:
The instance of the class for fluent interface.
Examples
>>> axis.set_overlay_style((255, 255, 0)) >>> axis.set_overlay_style('transparent') # Hide overlay
- set_stroke_style(style)[source]¶
Set style of Axis line stroke.
- Parameters:
style – Line style - ‘empty’, ‘solid’, ‘dashed’, or dict with thickness/color
Examples
axis.set_stroke_style(‘empty’) # Hide axis line axis.set_stroke_style({‘thickness’: 0}) # Hide with thickness 0 axis.set_stroke_style({‘thickness’: 2, ‘color’: ‘#ff0000’}) # Red line
- set_tick_formatting(text: str)[source]¶
- Parameters:
text (str)
- Returns:
The instance of the class for fluent interface.
- set_tick_labels(major_size: int | float = None, minor_size: int | float = None, family: str = None, style: str = None, weight: str = None, major_color=None, minor_color=None, major_rotation: float = None, minor_rotation: float = None, format_type: str = 'standard', operation: str = 'none', precision: int = None, unit: str = None, scale: float = 1.0)[source]¶
Style tick labels for this axis with comprehensive formatting options.
- Parameters:
major_size (int | float, optional) – Font size for major tick labels in pixels.
minor_size (int | float, optional) – Font size for minor tick labels in pixels.
family (str, optional) – CSS font family for both major and minor tick labels.
style (str, optional) – CSS font style (‘normal’, ‘italic’).
weight (str, optional) – CSS font weight (‘normal’, ‘bold’).
major_color (Color, optional) – Text color for major tick labels.
minor_color (Color, optional) – Text color for minor tick labels.
major_rotation (float, optional) – Rotation angle in degrees for major tick labels.
minor_rotation (float, optional) – Rotation angle in degrees for minor tick labels.
format_type (str) – Format style: - ‘standard’: Normal number formatting (default) - ‘currency’: Currency formatting with symbol - ‘percentage’: Percentage formatting (value * 100 + %) - ‘compact’: Compact notation (K, M, B, T) - ‘engineering’: Engineering notation - ‘scientific’: Scientific notation - ‘integer’: Rounded integer values
operation (str) – Mathematical operation to apply: - ‘none’ - No operation (default) - ‘round’ - Round to nearest integer - ‘ceil’ - Round up to nearest integer - ‘floor’ - Round down to nearest integer
precision (int, optional) – Number of decimal places (None = auto)
unit (str, optional) – Unit to append (e.g., “kg”, “ms”, “items”)
scale (float) – Scale factor to multiply value (default: 1.0)
- Returns:
The instance of the axis for fluent interface.
Examples
Basic font styling >>> axis.set_tick_labels(major_size=14, minor_size=10, weight=’bold’)
Rotated labels with color >>> axis.set_tick_labels( … major_size=12, … major_rotation=45, … major_color=’darkblue’ … )
Formatted with units >>> axis.set_tick_labels( … major_size=12, … precision=2, … unit=’Hz’, … scale=1000 … )
Percentage formatting >>> axis.set_tick_labels( … format_type=’percentage’, … precision=1 … )
Currency with rotation >>> axis.set_tick_labels( … format_type=’currency’, … precision=0, … major_rotation=45 … )
- set_tick_strategy(strategy: str, time_origin: int | float = None, utc: bool = False)[source]¶
Set TickStrategy of Axis. The TickStrategy defines the positioning and formatting logic of Axis ticks as well as the style of created ticks.
- Parameters:
strategy (str) – “Empty” | “Numeric” | “DateTime” | “Time”
time_origin (int | float) – Use with “DateTime” or “Time” strategy. If a time origin is defined, data points will be interpreted as milliseconds since time_origin.
utc (bool) – Use with DateTime strategy. By default, false, which means that tick placement is applied according to clients local time-zone/region and possible daylight saving cycle. When true, tick placement is applied in UTC which means no daylight saving adjustments & timestamps are displayed as milliseconds without any time-zone region offsets.
- Returns:
The instance of the class for fluent interface.
- set_title_margin(*args, **kwargs: Unpack[PaddingKwargs])[source]¶
Specifies padding after chart title.
- Parameters:
*args – A single numeric value (int or float) for uniform padding on all sides.
**kwargs – Optional named arguments to specify padding for individual sides: - left (int or float): Padding for the left side. - right (int or float): Padding for the right side. - top (int or float): Padding for the top side. - bottom (int or float): Padding for the bottom side.
Examples
set_title_margin(5): Sets uniform padding for all sides (integer or float).
set_title_margin(left=10, top=15): Sets padding for specific sides only.
set_title_margin(left=10, top=15, right=20, bottom=25): Fully define padding for all sides.
- Returns:
The instance of the class for fluent interface.
- set_title_position(position: str = None)[source]¶
Set axis title position.
- Parameters:
position (str) – None(default) | “center” | “end” | “start” | “center-chart”
- Returns:
The instance of the class for fluent interface.
- set_user_interactions(interactions=Ellipsis)[source]¶
Configure user interactions from a set of preset options.
- Parameters:
interactions (dict or None) –
None: disable all interactions
{} or no argument: restore default interactions
dict: configure specific interactions
Examples
# Disable all interactions: >>> axis.set_user_interactions(None)
# Restore default interactions: >>> axis.set_user_interactions() … axis.set_user_interactions({})
# Configure specific interactions: >>> axis.set_user_interactions( … { … ‘pan’: { … ‘lmb’: {‘drag’: True}, … ‘rmb’: False, … ‘mmb’: False, … }, … ‘rectangleZoom’: { … ‘lmb’: False, … ‘rmb’: {‘drag’: True}, … ‘mmb’: False, … }, … } … )
- zoom(reference_position: int | float, zoom_direction: int | float)[source]¶
Zoom scale from/to a position.
- Parameters:
reference_position (int | float) – Position to zoom towards or from on axis.
zoom_direction (int | float) – Amount and direction of zoom [-1, 1] as a guideline.
- Returns:
The instance of the class for fluent interface.
- class lightningchart.ui.axis.AxisGetMethods[source]¶
Bases:
object- get_default_interval() dict | None[source]¶
Get current configuration of default interval (set_default_interval).
Returns the current default interval configuration, or None if not set. When a dynamic interval function was configured on the JS side, returns a dict with type=’function’ indicating a function is configured.
- Returns:
- Interval configuration with optional keys:
start (float, optional): Interval start value
end (float, optional): Interval end value
animate (bool | int, optional): Animation setting
stopAxisAfter (bool, optional): Whether to stop axis after interval is applied
Returns None if no default interval is configured. Returns {‘type’: ‘function’, ‘description’: ‘…’} if a dynamic function is configured.
- Return type:
dict | None
Examples
Get current default interval configuration:
>>> config = axis.get_default_interval() >>> print(f"Default interval: {config.get('start')} to {config.get('end')}")
- get_interval() dict[source]¶
Get the currently applied axis scale interval.
- Returns:
- Object containing the current start and end of Axis with keys:
start (float): The start value of the axis interval
end (float): The end value of the axis interval
- Return type:
dict
Examples
Get current axis interval: >>> interval = axis.get_interval() >>> print(f”Start: {interval[‘start’]}, End: {interval[‘end’]}”)
- get_interval_restrictions() dict | None[source]¶
Get current interval restrictions configuration.
- Returns:
- Restrictions configuration with optional keys:
intervalMin (float, optional): Minimum interval length
intervalMax (float, optional): Maximum interval length
startMin (float, optional): Minimum interval start value
startMax (float, optional): Maximum interval start value
endMin (float, optional): Minimum interval end value
endMax (float, optional): Maximum interval end value
Returns None if no restrictions are configured.
- Return type:
dict | None
Examples
>>> restrictions = axis.get_interval_restrictions() >>> if restrictions: ... print(f"Interval min: {restrictions.get('intervalMin')}")
- get_keep_tick_labels_in_axis_bounds() bool[source]¶
Check whether axis keeps tick labels within its boundaries.
- Returns:
True if tick labels are kept in bounds, False otherwise.
- Return type:
bool
Examples
>>> is_enabled = axis.get_keep_tick_labels_in_axis_bounds() >>> print(f"Keep labels in bounds: {is_enabled}")
- get_length() dict[source]¶
Get relative or absolute size of axis in its own stack.
For example, if you have a chart with 2 stacked Y axes, by default they will have equal heights. By altering axis relative size, you can adjust how the chart height is distributed between these two axes.
- Returns:
- Either {‘pixels’: number} or {‘relative’: number}.
Defaults to {‘relative’: 1}.
- Return type:
dict
Examples
>>> length = axis.get_length() >>> if 'relative' in length: ... print(f"Relative size: {length['relative']}") >>> elif 'pixels' in length: ... print(f"Pixel size: {length['pixels']}")
- get_margin_after_ticks() float[source]¶
Get padding after axis ticks.
- Returns:
Padding after axis ticks in pixels.
- Return type:
float
Examples
>>> margin = axis.get_margin_after_ticks()
- get_margin_after_title() float[source]¶
Get padding after Axis title.
- Returns:
Gap between the title and the next axis in pixels.
- Return type:
float
Examples
>>> margin = axis.get_margin_after_title()
- get_margins() dict[source]¶
Get axis margins as set with set_margins.
- Returns:
- Object with keys:
start (float): Start margin
end (float): End margin
- Return type:
dict
Examples
>>> margins = axis.get_margins() >>> print(f"Start: {margins['start']}, End: {margins['end']}")
- get_overlay_style() str | None[source]¶
Get style of axis overlay (shown only when interacting with mouse/touch).
- Returns:
Color as rgba string, or None if transparent.
- Return type:
str | None
Examples
>>> color = axis.get_overlay_style()
- get_parallel_index() int[source]¶
Get index of Axis in its own parallel group.
This retrieves the same value which was used (or defaulted) when the axis was created.
- Returns:
Parallel index of the axis.
- Return type:
int
Examples
>>> index = axis.get_parallel_index()
- get_scroll_margins() bool | dict[source]¶
Get scroll margins configuration.
- Returns:
- Either False (disabled) or a dict with:
start (float): Start margin
end (float): End margin
- Return type:
bool | dict
Examples
>>> margins = axis.get_scroll_margins() >>> if isinstance(margins, dict): ... print(f"Start: {margins['start']}, End: {margins['end']}")
- get_scroll_strategy() dict | None[source]¶
Get current axis scroll strategy configuration.
- Returns:
- Strategy configuration with keys:
id (str): Strategy name (‘fitting’, ‘expansion’, ‘progressive’, etc.)
considerVisibleRangeOnly (bool): Whether scrolling only considers visible data range
Returns None if no strategy is set.
- Return type:
dict | None
Examples
>>> strategy = axis.get_scroll_strategy() >>> if strategy: ... print(f"Strategy: {strategy['id']}") ... print(f"Visible range only: {strategy['considerVisibleRangeOnly']}")
- get_series_data_range() dict | None[source]¶
Get data extents of series attached to the axis.
- Returns:
{‘min’: number, ‘max’: number} or None if no data.
- Return type:
dict | None
Examples
>>> data_range = axis.get_series_data_range() >>> if data_range: ... print(f"Data range: {data_range['min']} to {data_range['max']}")
- get_stack_index() int[source]¶
Get index of Axis in its own stack.
This retrieves the same value which was used (or defaulted) when the axis was created.
- Returns:
Stack index of the axis.
- Return type:
int
Examples
>>> index = axis.get_stack_index()
- get_stopped() bool[source]¶
Get whether the axis is stopped.
When an Axis is stopped it temporarily prevents the active scroll strategy from changing the Axis interval. Axis can be stopped programmatically or by built-in interactions such as panning/zooming.
- Returns:
True if axis is stopped, False otherwise.
- Return type:
bool
Examples
>>> is_stopped = axis.get_stopped() >>> print(f"Axis stopped: {is_stopped}")
- get_stroke_style() dict | None[source]¶
Get axis line stroke style.
- Returns:
- Stroke style with keys:
thickness (float): Line thickness in pixels
color (str): Color as rgba string
- Return type:
dict | None
Examples
>>> style = axis.get_stroke_style() >>> if style: ... print(f"Thickness: {style['thickness']}, Color: {style['color']}")
- get_thickness() dict[source]¶
Get axis thickness min/max limits in pixels.
For X Axis, this means Axis height. For Y Axis, this means Axis width.
- Returns:
- Thickness limits with keys:
min (float | None): Minimum thickness, None if not set
max (float | None): Maximum thickness, None if not set
- Return type:
dict
Examples
>>> thickness = axis.get_thickness() >>> print(f"Min: {thickness['min']}, Max: {thickness['max']}")
- get_tick_strategy() str[source]¶
Get the currently used tick strategy.
- Returns:
Tick strategy name - ‘Empty’, ‘Numeric’, ‘DateTime’, or ‘Time’
- Return type:
str
Examples
>>> strategy = axis.get_tick_strategy() >>> print(f"Tick strategy: {strategy}")
- get_title_effect() bool[source]¶
Get whether theme effect is enabled on axis title.
A theme can specify an Effect to add extra visual elements to chart applications, like Glow effects around data or other components.
- Returns:
True if theme effect is enabled, False otherwise.
- Return type:
bool
Examples
>>> effect_enabled = axis.get_title_effect()
- get_title_fill_style() str | None[source]¶
Get axis title fill style (color).
- Returns:
Color as rgba string, or None if transparent.
- Return type:
str | None
Examples
>>> color = axis.get_title_fill_style()
- get_title_font() dict[source]¶
Get font settings of axis title.
- Returns:
- Font settings with keys:
size (float): Font size
family (str): Font family
weight (str): Font weight (e.g., ‘normal’, ‘bold’)
style (str): Font style (e.g., ‘normal’, ‘italic’)
- Return type:
dict
Examples
>>> font = axis.get_title_font() >>> print(f"Size: {font['size']}, Family: {font['family']}")
- get_title_position() str[source]¶
Get axis title position.
- Returns:
Title position - ‘center’, ‘end’, ‘start’, or ‘center-chart’
- Return type:
str
Examples
>>> position = axis.get_title_position() >>> print(f"Title position: {position}")
- get_title_rotation() float[source]¶
Get rotation of axis title.
- Returns:
Rotation in degrees.
- Return type:
float
Examples
>>> rotation = axis.get_title_rotation() >>> print(f"Title rotation: {rotation} degrees")
- get_units() str | None[source]¶
Get unit that axis measures.
The unit is displayed after the Axis title (if defined), e.g., “Axis title (Hz)”. Default cursor formatters also place the unit next to axis values.
- Returns:
Unit string (e.g., ‘Hz’, ‘°C’), or None if not set.
- Return type:
str | None
Examples
>>> units = axis.get_units() >>> if units: ... print(f"Axis units: {units}")
- class lightningchart.ui.axis.AxisWithAddEventListener[source]¶
Bases:
object- add_event_listener(event: str, handler: callable | None = None, throttle_ms: int = 0, once: bool = False) str[source]¶
Add event listener to axis.
- Parameters:
event –
Event name. Common options include: - Interaction: ‘click’, ‘pointermove’, ‘pointerdown’, ‘pointerup’,
’pointerenter’, ‘pointerleave’, ‘dblclick’
Axis-specific: ‘intervalchange’ (when axis interval changes)
handler – Python callback receiving event data
throttle_ms – Minimum delay between callbacks in milliseconds
once – If True, listener removes itself after first trigger
- Returns:
callback_id identifying the registered handler
Examples
Listen for axis interval changes: >>> def on_interval_change(event): … print(f”Axis interval: {event[‘start’]} - {event[‘end’]}”) >>> axis.add_event_listener(‘intervalchange’, handler=on_interval_change)
Listen for clicks on axis: >>> def on_click(event): … print(f”Axis clicked at: {event}”) >>> axis.add_event_listener(‘click’, handler=on_click)
Throttled pointer move events: >>> def on_move(event): … print(f”Pointer at: {event}”) >>> axis.add_event_listener(‘pointermove’, handler=on_move, throttle_ms=100)
- class lightningchart.ui.axis.BarChartAxis(chart)[source]¶
Bases:
GenericAxis
- class lightningchart.ui.axis.CategoryAxis(chart)[source]¶
Bases:
BarChartAxis
- class lightningchart.ui.axis.DefaultAxis3D(chart, axis: str)[source]¶
Bases:
GenericAxis,GetCustomTicks,AxisGetMethods,AxisWithAddEventListener- add_custom_tick(tick_type: str = 'major')[source]¶
Add a 3D custom tick to the Axis. Custom ticks can be used to completely control tick placement, text, and styles in a 3D environment.
- Parameters:
tick_type (str) – “major” | “minor” | “box”
- Returns:
Reference to CustomTick3D class.
- set_tick_labels(major_size: int | float = None, minor_size: int | float = None, family: str = None, style: str = None, weight: str = None, major_color=None, minor_color=None, major_rotation: float = None, minor_rotation: float = None, format_type: str = 'standard', operation: str = 'none', precision: int = None, unit: str = None, scale: float = 1.0)[source]¶
Style tick labels for this axis with comprehensive formatting options.
- Parameters:
major_size (int | float, optional) – Font size for major tick labels in pixels.
minor_size (int | float, optional) – Font size for minor tick labels in pixels.
family (str, optional) – CSS font family for both major and minor tick labels.
style (str, optional) – CSS font style (‘normal’, ‘italic’).
weight (str, optional) – CSS font weight (‘normal’, ‘bold’).
major_color (Color, optional) – Text color for major tick labels.
minor_color (Color, optional) – Text color for minor tick labels.
major_rotation (float, optional) – Rotation angle in degrees for major tick labels.
minor_rotation (float, optional) – Rotation angle in degrees for minor tick labels.
format_type (str) – Format style: - ‘standard’: Normal number formatting (default) - ‘currency’: Currency formatting with symbol - ‘percentage’: Percentage formatting (value * 100 + %) - ‘compact’: Compact notation (K, M, B, T) - ‘engineering’: Engineering notation - ‘scientific’: Scientific notation - ‘integer’: Rounded integer values
operation (str) – Mathematical operation to apply: - ‘none’ - No operation (default) - ‘round’ - Round to nearest integer - ‘ceil’ - Round up to nearest integer - ‘floor’ - Round down to nearest integer
precision (int, optional) – Number of decimal places (None = auto)
unit (str, optional) – Unit to append (e.g., “kg”, “ms”, “items”)
scale (float) – Scale factor to multiply value (default: 1.0)
- Returns:
The instance of the axis for fluent interface.
Examples
Basic font styling >>> axis.set_tick_labels(major_size=14, minor_size=10, weight=’bold’)
Rotated labels with color >>> axis.set_tick_labels( … major_size=12, … major_rotation=45, … major_color=’darkblue’ … )
Formatted with units >>> axis.set_tick_labels( … major_size=12, … precision=2, … unit=’Hz’, … scale=1000 … )
Percentage formatting >>> axis.set_tick_labels( … format_type=’percentage’, … precision=1 … )
Currency with rotation >>> axis.set_tick_labels( … format_type=’currency’, … precision=0, … major_rotation=45 … )
- set_tick_strategy(strategy: str, time_origin: int | float = None, utc: bool = False)[source]¶
Set TickStrategy of Axis. The TickStrategy defines the positioning and formatting logic of Axis ticks as well as the style of created ticks.
- Parameters:
strategy (str) – “Empty” | “Numeric” | “DateTime” | “Time”
time_origin (int | float) – Define with time.time(). If a time origin is defined, data-points will instead be interpreted as milliseconds since time origin.
utc (bool) – Use with DateTime strategy. By default, false, which means that tick placement is applied according to clients local time-zone/region and possible daylight saving cycle. When true, tick placement is applied in UTC which means no daylight saving adjustments & timestamps are displayed as milliseconds without any time-zone region offsets.
- Returns:
The instance of the class for fluent interface.
- class lightningchart.ui.axis.GenericAxis(chart)[source]¶
Bases:
UIEWithTitle- fit(animate: int | bool = 0, stop_axis_after: bool = False)[source]¶
Fit axis view to attached series.
- Parameters:
animate (int | bool) – Boolean for animation enabled, or number for animation duration in milliseconds.
stop_axis_after (bool) – If true, stops Axis after fitting.
- Returns:
The instance of the class for fluent interface.
- set_animations_enabled(enabled: bool = True)[source]¶
Disable/Enable all animations of the Chart.
- Parameters:
enabled (bool) – Boolean value to enable or disable animations.
- Returns:
The instance of the class for fluent interface.
- set_default_interval(start: int | float = None, end: int | float = None, stop_axis_after: bool = None, animate: bool | int = None, apply_immediately: bool = None, skip_interval_restrictions: bool = None)[source]¶
Set Axis default interval.
This does the same as set_interval method, but is also applied again whenever fit is triggered, or the “zoom to fit” user interaction is triggered.
- Parameters:
start (int | float, optional) – Interval start point.
end (int | float, optional) – Interval end point.
stop_axis_after (bool, optional) – Whether to stop axis scrolling after applying interval. Defaults to True.
animate (bool | int, optional) – Animation setting. False for no animation, True for default, or milliseconds as int.
apply_immediately (bool, optional) – If False, don’t apply the interval immediately, only on next fit/restore. Defaults to True.
skip_interval_restrictions (bool, optional) – If False, respect interval restrictions. Defaults to True (skip restrictions).
- Returns:
The instance of the class for fluent interface.
Examples
Set default interval with start and end:
>>> axis.set_default_interval(start=0, end=100)
Set only end value:
>>> axis.set_default_interval(end=5000)
Set interval with animation:
>>> axis.set_default_interval(start=0, end=5000, animate=2000)
Configure default interval without applying immediately:
>>> axis.set_default_interval(start=0, end=10, apply_immediately=False)
Respect interval restrictions:
>>> axis.set_default_interval(start=0, end=10, skip_interval_restrictions=False)
- set_interval(start: int | float, end: int | float, stop_axis_after: bool = True, animate: bool = False)[source]¶
Set axis interval.
- Parameters:
start (int) – Start of the axis.
end (int) – End of the axis.
stop_axis_after (bool) – If false, the axis won’t stop from scrolling.
animate (bool) – Boolean for animation enabled, or number for animation duration in milliseconds.
- Returns:
The instance of the class for fluent interface.
- set_interval_restrictions(interval_min: int | float = None, interval_max: int | float = None, start_min: int | float = None, start_max: int | float = None, end_min: int | float = None, end_max: int | float = None)[source]¶
Set or clear restrictions on Axis interval (start/end).
These restrictions are not applied immediately but will affect all axis scrolling and user interactions afterward.
- Parameters:
interval_min (int | float, optional) – Minimum interval length.
interval_max (int | float, optional) – Maximum interval length.
start_min (int | float, optional) – Minimum interval start value.
start_max (int | float, optional) – Maximum interval start value.
end_min (int | float, optional) – Minimum interval end value.
end_max (int | float, optional) – Maximum interval end value.
- Usage:
axis.set_interval_restrictions(interval_min=10, interval_max=1000)
axis.set_interval_restrictions(start_min=0, end_max=5000)
axis.set_interval_restrictions(None) # Clears all restrictions
- Returns:
The instance of the class for fluent interface.
- set_scroll_margins(*args, **kwargs)[source]¶
Set scroll margins for the axis.
- Parameters:
*args –
Single int or float: symmetric scroll margins in pixels.
Single bool: if False, disables scroll margins.
Single None: clears all scroll margins.
**kwargs – start (int | float, optional): Start margin in pixels. end (int | float, optional): End margin in pixels.
Notes
If the axis interval is explicitly configured using
set_interval()orset_default_interval(), scroll margins are not applied.- Returns:
The instance of the class for fluent interface.
Example
>>> axis.set_scroll_margins(5) # Sets symmetric scroll margins as 5 pixels. >>> axis.set_scroll_margins(False) # Disables scroll margins entirely. >>> axis.set_scroll_margins(start = 0, end = 10) # Sets asymmetric scroll margins.
- set_scroll_strategy(strategy: str = 'scrolling', progressive: bool = None, realtime: bool | float = None, start: bool = None, end: bool = None, visibleonly: bool = None)[source]¶
Specify ScrollStrategy of the Axis.
- Parameters:
strategy (str) –
“expansion”: expand to fit new data without moving view
”fitting”: resize to fit all data
”scrolling” (default): scroll with incoming data
”fittingStepped” resize to fit data in larger steps
progressive (bool, optional) – Whether axis should scroll towards higher data value, or lower data value.
realtime (bool, optional) – If set to true axis will automatically scroll according to real time, rather than jumping to latest data point immediately. This is intended for applications where data arrives in chunks (for example, every 1 second). This assumes that Axis interval represents milliseconds!
start (bool, optional) – Whether should affect Axis interval start (left side for X axis, bottom side for Y axis).
end (bool, optional) – Whether should affect Axis interval end (right side for X axis, top side for Y axis).
visibleonly (bool, optional) – Whether axis scrolling should only consider data in visible range, rather than entire data set which may be partly outside the view.
- set_stroke(thickness: int | float, color: any = None)[source]¶
Set the Axis line stroke.
- Parameters:
thickness (int | float) – Thickness of the stroke.
color (Color) – Color of the stroke. Use ‘transparent’ or None to hide.
- Returns:
The instance of the class for fluent interface.
- set_title(title: str)[source]¶
Specifies an Axis title string
- Parameters:
title – Axis title as a string
- Returns:
Axis itself for fluent interface
- set_title_color(color: any)[source]¶
Set the color of the Chart title.
- Parameters:
color (Color) – Color of the title. Use ‘transparent’ or None to hide.
- Returns:
The instance of the class for fluent interface.
- set_title_effect(enabled: bool)[source]¶
Set theme effect enabled on component or disabled.
- Parameters:
enabled – Boolean flag.
- Returns:
The instance of the class for fluent interface.
- set_units(unit: str | None, display_on_axis: bool = None, display_in_cursor: bool = None)[source]¶
Set unit that axis measures (e.g., ‘Hz’, ‘°C’).
- Parameters:
unit (str | None) – Unit string, or None to clear.
display_on_axis (bool, optional) – Show unit after axis title. Defaults to True.
display_in_cursor (bool, optional) – Show unit in cursor formatters. Defaults to True.
- Returns:
The instance of the class for fluent interface.
Examples
>>> axis.set_title("Frequency").set_units("Hz") >>> axis.set_units("Hz", display_on_axis=False)
- class lightningchart.ui.axis.GetCustomTicks[source]¶
Bases:
object- get_custom_ticks()[source]¶
Get information about all custom ticks on this axis.
- Returns:
- List of custom tick information dictionaries, each containing:
id (str): Unique identifier for the tick
value (float): Axis value where tick is positioned
text (str): Label text displayed on the tick
visible (bool): Whether tick is visible
allocatesAxisSpace (bool): Whether tick reserves space on axis
tickLength (float): Length of tick line in pixels
gridStrokeLength (float): Length of grid line
tickLabelPadding (float): Padding around label
gridStrokeStyle (dict): Grid line style {‘thickness’: int, ‘color’: str}
tickStrokeStyle (dict): Tick line style {‘thickness’: int, ‘color’: str}
markerFont (dict): Font settings {‘size’: int, ‘family’: str, ‘weight’: str, ‘style’: str}
markerColor (str): Marker text color (rgba string)
textFont (dict): Text font settings
textColor (str): Text color (rgba string)
backgroundColor (str): Label background color (rgba string)
backgroundStrokeStyle (dict): Background border style {‘thickness’: int, ‘color’: str}
padding (float): Padding value
tickLabelRotation (float): Label rotation in degrees
- Return type:
list[dict]
Notes
Must be called in live mode and better after opening the chart window, chart.open(live=True).
Examples
Get all custom ticks with their properties: >>> ticks = axis.get_custom_ticks() >>> for tick in ticks: … print(f”Value: {tick[‘value’]}, Text: {tick[‘text’]}”) … print(f”Font: {tick[‘textFont’]}”) … print(f”Color: {tick[‘textColor’]}”)
- class lightningchart.ui.axis.SpiderChartAxis[source]¶
Bases:
objectA class containing axis-related methods for the SpiderChart.
- add_axis(tag: str)[source]¶
Add a new axis to Spider Chart.
- Parameters:
tag (str) – String tag for the axis.
- Returns:
The instance of the class for fluent interface.
- set_auto_axis_creation(enabled: bool)[source]¶
Specifies if auto creation of axis is turned on or not.
- Parameters:
enabled (bool) – State of automatic axis creation.
- Returns:
The instance of the class for fluent interface.
- set_axis_interval(start: int | float, end: int | float, stop_axis_after: bool = True)[source]¶
Set interval of Charts Axes
- Parameters:
start (int | float) – Value at edges of chart.
end (int | float) – Value at center of chart. Defaults to zero.
stop_axis_after (bool) – Stop axis after value.
- Returns:
The instance of the class for fluent interface.
- set_axis_label_color(color: any)[source]¶
Set the color of axis labels.
- Parameters:
color (Color) – Color of the labels. Use ‘transparent’ or None to hide.
- Returns:
The instance of the class for fluent interface.
- set_axis_label_effect(enabled: bool)[source]¶
Set theme effect enabled on component or disabled.
- Parameters:
enabled (bool) – Theme effect enabled.
- Returns:
The instance of the class for fluent interface.
- set_axis_label_font(size: int | float, family: str = 'Segoe UI, -apple-system, Verdana, Helvetica', style: str = 'normal', weight: str = 'normal')[source]¶
Set font of axis labels.
- Parameters:
size (int | float) – CSS font size. For example, 16.
family (str) – CSS font family. For example, ‘Arial, Helvetica, sans-serif’.
weight (str) – CSS font weight. For example, ‘bold’.
style (str) – CSS font style. For example, ‘italic’
- Returns:
The instance of the class for fluent interface.
- set_axis_label_padding(padding: int | float)[source]¶
Set padding of axis labels.
- Parameters:
padding (int | float) – Padding in pixels.
- Returns:
The instance of the class for fluent interface.
- set_axis_scroll_strategy(strategy: str, start: bool = None, end: bool = None, visibleonly: bool = None)[source]¶
Sets the scroll strategy of charts axes.
- Parameters:
strategy (str) –
“expansion”: expand to fit new data without moving view
”fitting”: resize to fit all data
”scrolling” (default): scroll with incoming data
”fittingStepped” resize to fit data in larger steps
start (bool, optional) – Lock scroll to start of data range
end (bool, optional) – Lock scroll to end of data range
visibleonly (bool, optional) – Limit effect to visible series only
- set_axis_style(thickness: int | float, color: any = None)[source]¶
Set the style of axis line.
- Parameters:
thickness (int | float) – Thickness of the axis line.
color (Color) – Color of the axis line. Use ‘transparent’ or None to hide.
- Returns:
The instance of the class for fluent interface.
- set_scale_label_color(color: any)[source]¶
Set the color of the scale labels.
- Parameters:
color (Color) – Color of the scale labels. Use ‘transparent’ or None to hide.
- Returns:
The instance of the class for fluent interface.
- set_scale_label_font(size: int | float, family: str = 'Segoe UI, -apple-system, Verdana, Helvetica', style: str = 'normal', weight: str = 'normal')[source]¶
Set font of scale labels.
- Parameters:
size (int | float) – CSS font size. For example, 16.
family (str) – CSS font family. For example, ‘Arial, Helvetica, sans-serif’.
weight (str) – CSS font weight. For example, ‘bold’.
style (str) – CSS font style. For example, ‘italic’
- Returns:
The instance of the class for fluent interface.
- class lightningchart.ui.axis.ValueAxis(chart)[source]¶
Bases:
BarChartAxis
lightningchart.ui.band module¶
- class lightningchart.ui.band.Band(chart, axis, on_top: bool, legend: LegendOptions | None = None)[source]¶
Bases:
UIEWithHighlight,UserInteractions- set_color(color: str | int | tuple[int, int, int] | tuple[int, int, int, int] | dict[str, int] | Color | None)[source]¶
Set a color of the band.
- Parameters:
color (Color) – Color of the band. Use ‘transparent’ or None to hide.
- Returns:
The instance of the class for fluent interface.
- set_name(name: str)[source]¶
Sets the name of the Component updating attached LegendBox entries.
- Parameters:
name (str) – Name of the component.
- Returns:
The instance of the class for fluent interface.
- set_stroke(thickness: int | float, color: str | int | tuple[int, int, int] | tuple[int, int, int, int] | dict[str, int] | Color | None = None)[source]¶
Set stroke style of Band.
- Parameters:
thickness (int | float) – Thickness of the stroke.
color (Color) – Color of the stroke. Use ‘transparent’ or None to hide.
- Returns:
The instance of the class for fluent interface.
- set_user_interactions(interactions=Ellipsis)[source]¶
Configure user interactions from a set of preset options.
- Parameters:
interactions (dict or None) –
None: disable all interactions
{} or no argument: restore default interactions
dict: configure specific interactions
Examples
# Disable all interactions: >>> band.set_user_interactions(None)
# Restore default interactions: >>> band.set_user_interactions() >>> band.set_user_interactions({})
# Scale interaction only: >>> band.set_user_interactions({‘scale’: False})
lightningchart.ui.constant_line module¶
- class lightningchart.ui.constant_line.ConstantLine(chart, axis, on_top: bool, legend: LegendOptions | None = None)[source]¶
Bases:
UIEWithHighlight,UserInteractions,SeriesWith2DLines,SeriesWithoutCursorEnabled- set_interaction_move_by_dragging(enabled: bool)[source]¶
Enable or disable default interaction of moving constant line by dragging with mouse or touch.
- Parameters:
enabled (bool) – Boolean flag.
- Returns:
The instance of the class for fluent interface.
- set_user_interactions(interactions=Ellipsis)[source]¶
Configure user interactions from a set of preset options.
- Parameters:
interactions (dict or None) –
None: disable all interactions
{} or no argument: restore default interactions
dict: configure specific interactions
Examples
# Disable all interactions: >>> constant_line.set_user_interactions(None)
# Restore default interactions: >>> constant_line.set_user_interactions() >>> constant_line.set_user_interactions({})
# Move only with Control down: >>> chart.set_user_interactions({‘move’: {‘drag’: False, ‘ctrl’: {‘drag’: True}}})
lightningchart.ui.custom_tick module¶
- class lightningchart.ui.custom_tick.CustomTick(chart, axis, tick_type: str = 'major')[source]¶
Bases:
UIElement- set_allocates_axis_space(enabled: bool)[source]¶
Set whether CustomTick should allocate space on its Axis. By default, this is true, which means that Axis will always make sure it is big enough to fit the tick. By setting to false, this particular CustomTick can be removed from this behaviour, which can be useful in applications where some custom ticks are only enabled temporarily. Disabling this functionality can prevent the size of the Axis from changing in unwanted ways.
- Parameters:
enabled (bool) – Boolean flag.
- Returns:
The instance of the class for fluent interface.
- set_decimal_precision(decimals: int)[source]¶
Format the tick label value to certain number of decimal numbers.
- Parameters:
decimals (int) – Decimal precision.
- Returns:
The instance of the class for fluent interface.
- set_grid_stroke_length(length: int | float)[source]¶
Set length of grid stroke in percents.
- Parameters:
length (int | float) – Grid line length as a % of viewport size.
- Returns:
The instance of the class for fluent interface.
- set_grid_stroke_style(thickness: int | float, color: any = None)[source]¶
Set style of grid stroke.
- Parameters:
thickness (int | float) – Thickness of the grid stroke.
color (Color) – Color of the grid stroke. Use ‘transparent’ or None to hide.
- Returns:
The instance of the class for fluent interface.
- set_marker_color(color: any)[source]¶
Set the color of the tick label.
- Parameters:
color (Color) – Color of the tick label. Use ‘transparent’ or None to hide.
- Returns:
The instance of the class for fluent interface.
- set_marker_font(size: int | float, family: str = 'Segoe UI, -apple-system, Verdana, Helvetica', style: str = 'normal', weight: str = 'normal')[source]¶
Set font of tick label.
- Parameters:
size (int | float) – CSS font size. For example, 16.
family (str) – CSS font family. For example, ‘Arial, Helvetica, sans-serif’.
weight (str) – CSS font weight. For example, ‘bold’.
style (str) – CSS font style. For example, ‘italic’
- Returns:
The instance of the class for fluent interface.
- set_marker_visible(visible: bool)[source]¶
Set marker visible or not.
- Parameters:
visible (bool) – Boolean flag.
- Returns:
The instance of the class for fluent interface.
- set_text(text: str)[source]¶
Override the tick label text
- Parameters:
text (str) – Text to display on the tick.
- Returns:
The instance of the class for fluent interface.
- set_tick_label_alignment(alignment: float, alignment2: float = None)[source]¶
Set alignment of tick label relative to tick line.
- Parameters:
alignment – Primary label alignment (-1 to 1) -1: After tick line 0: Center on tick line +1: Before tick line
alignment2 – Secondary alignment for XY axes only (-1 to 1) Controls alignment along perpendicular dimension
- Returns:
The instance of the class for fluent interface.
Examples
Align labels after tick (default for most axes): >>> custom_tick.set_tick_label_alignment(-1)
Center labels on tick line: >>> custom_tick.set_tick_label_alignment(0)
XY axis with both alignments: >>> custom_tick.set_tick_label_alignment( … alignment=-1, # Primary dimension … alignment2=0.5 # Secondary dimension … )
Fine-tune alignment: >>> custom_tick.set_tick_label_alignment(-0.8) # Slightly offset
- set_tick_label_padding(padding: int | float)[source]¶
Set pixel padding between tick line and label.
- Parameters:
padding (int | float) – Amount of padding in pixels.
- Returns:
The instance of the class for fluent interface.
- set_tick_label_rotation(value: int | float)[source]¶
Set rotation of tick label.
- Parameters:
value (int | float) – Rotation in degrees.
- Returns:
The instance of the class for fluent interface.
- class lightningchart.ui.custom_tick.CustomTick3D(chart, axis, tick_type: str = 'major')[source]¶
Bases:
UIElement- set_background_color(color: any)[source]¶
Set the background color of the tick.
- Parameters:
color – Color value. Use ‘transparent’ or None to hide.
- Returns:
The instance of the class for fluent interface.
- set_background_stroke(thickness: int | float, color: any = None)[source]¶
Set stroke style of background around ticks label.
- Parameters:
thickness – Thickness of the stroke.
color – Color of the stroke. Use ‘transparent’ or None to hide.
- Returns:
The instance of the class for fluent interface.
- set_grid_stroke(thickness: int | float, color: any = None)[source]¶
Set style of custom ticks grid line. This line highlights the tick location under the series area.
- Parameters:
thickness – Thickness of the stroke.
color – Color of the stroke. Use ‘transparent’ or None to hide.
- Returns:
The instance of the class for fluent interface.
- set_padding(*args, **kwargs: Unpack[PaddingKwargs])[source]¶
Set padding between tick label text and its background (if any).
- Parameters:
*args – A single numeric value (int or float) for uniform padding on all sides.
**kwargs – Optional named arguments to specify padding for individual sides: - left (int or float): Padding for the left side. - right (int or float): Padding for the right side. - top (int or float): Padding for the top side. - bottom (int or float): Padding for the bottom side.
Examples
set_padding(5): Sets uniform padding for all sides (integer or float).
set_padding(left=10, top=15): Sets padding for specific sides only.
set_padding(left=10, top=15, right=20, bottom=25): Fully define padding for all sides.
- Returns:
The instance of the class for fluent interface.
- set_text(text: str)[source]¶
Override the tick label text
- Parameters:
text (str) – Text to display on the tick.
- Returns:
The instance of the class for fluent interface.
- set_text_color(color: any)[source]¶
Set fill style of custom ticks text.
- Parameters:
color – Color value. Use ‘transparent’ or None to hide.
- Returns:
The instance of the class for fluent interface.
- set_text_font(size: int | float, family: str = 'Segoe UI, -apple-system, Verdana, Helvetica', style: str = 'normal', weight: str = 'normal')[source]¶
Set font of custom ticks text.
- Parameters:
size (int | float) – CSS font size. For example, 16.
family (str) – CSS font family. For example, ‘Arial, Helvetica, sans-serif’.
weight (str) – CSS font weight. For example, ‘bold’.
style (str) – CSS font style. For example, ‘italic’
- Returns:
The instance of the class for fluent interface.
- set_tick_length(length: int | float)[source]¶
Set tick line length as pixels.
- Parameters:
length – Tick line length as pixels
- Returns:
The instance of the class for fluent interface.
- set_tick_style(thickness: int | float, color: any = None)[source]¶
Set style of custom ticks tick line. This line connects the text to its Axis, generally a very short line (6 pixels, or so).
- Parameters:
thickness – Thickness of the stroke.
color – Color of the stroke. Use ‘transparent’ or None to hide.
- Returns:
The instance of the class for fluent interface.
lightningchart.ui.legend module¶
- class lightningchart.ui.legend.Legend(chart, is_user_legend=False)[source]¶
Bases:
objectLegend property accessor for chart legends.
- add(component, options: LegendEntryOptions = None)[source]¶
Add standalone legend entry.
- Parameters:
component – The series/component to configure
options (dict) – Legend entry options
Examples
Add standalone legend entry >>> legend = chart.add_legend() … series = chart.add_line_series() … legend.add( … component=series, … options={ … ‘text’: ‘Series A’, … ‘button_shape’: ‘Triangle’, … ‘button_fill_style’: ‘#00FF00’ … })
- dispose()[source]¶
Permanently destroy the legend.
- Returns:
The chart instance for fluent interface.
- get_entry_options(component)[source]¶
Get options for specific entry.
Notes
Call this in live mode, e.g.
chart.open(live=True)
- get_options()[source]¶
Get current legend options.
Notes
Call this in live mode, e.g.
chart.open(live=True)
- set_entry_options(component, **kwargs: Unpack[LegendEntryOptions])[source]¶
Set options for specific legend entry.
- Parameters:
component – The series/component to configure
show (bool) – Whether to show entry
text (str) – Entry text
button_shape (str) – ‘Arrow’, ‘Diamond’, ‘Plus’, ‘Triangle’, ‘Circle’, ‘Square’, ‘Cross’, ‘Minus’ and ‘Star’.
button_size (int | dict) – Size in pixels or {‘x’: 20, ‘y’: 15}.
button_fill_style – Button fill style
button_stroke_style – Button stroke style
button_rotation – Button rotation in degrees
text_font (dict) – Text font settings
text_fill_style – Text fill style
match_style_exactly (bool) – Whether to match component style exactly
highlight (bool) – Whether highlighting on hover is enabled.
lut – LUT element (None to disable)
lut_length – LUT length in pixels
lut_thickness – LUT thickness in pixels
lut_display_proportional_steps (bool) – LUT step display mode
- Returns:
The chart instance for fluent interface.
Examples
Configure individual entries >>> chart.legend.set_entry_options( … series, … text=”Primary Data”, … button_size=5, … show=True … )
Custom legend entries >>> chart.legend.set_entry_options( … series, … show=True, … text=”Series A — Custom”, … button_shape=’Triangle’, … button_size=25, … button_fill_style=”#CB5B15”, … button_stroke_style={‘thickness’: 3, ‘color’: ‘#003300’}, … button_rotation=45, … text_font={‘size’: 18, ‘style’: ‘italic’}, … text_fill_style=’#0000FF’, … match_style_exactly=False, … )
- set_options(**kwargs: Unpack[LegendOptions])[source]¶
Set legend options.
- Parameters:
visible (bool) – Whether legend should be visible
position – Legend position (LegendPosition enum or custom position dict)
title (str) – Legend title
title_font (dict) – Title font settings
title_fill_style – Title color/fill style
orientation – Legend orientation
render_on_top (bool) – Whether to render legend on top of chart
background_visible (bool) – Whether background should be visible
background_fill_style – Background fill style
background_stroke_style – Background stroke style
padding – Legend content padding
margin_inner – Margin from chart to legend
margin_outer – Margin from legend to chart edge. marginOuter might only be visible with certain positions or when the legend is at chart edges.
entry_margin – Margin between legend entries
auto_hide_threshold (float) – Auto-hide threshold (0.0-1.0)
add_entries_automatically (bool) – Whether to add entries automatically
entries (dict) – Default entry options
- Returns:
The chart instance for fluent interface.
Examples
Basic chart with simple legend >>> chart.legend.set_options( … visible=True, … title=’My Legend’, … position={‘x’: 200, ‘y’: 300, ‘origin’: ‘LeftTop’}, … orientation=’Horizontal’, … )
Styled legend with background and custom entries >>> chart.legend.set_options( … visible=True, … title=’My Legend’, … background_visible=True, … background_fill_style=”#E08585”, … background_stroke_style={‘thickness’: 2, ‘color’: “#F054D3”}, … entries={ … ‘button_shape’: ‘Triangle’, … ‘button_size’: 20, … ‘button_fill_style’: ‘#00FF00’, … ‘button_stroke_style’: {‘thickness’: 5, ‘color’: ‘#000000’}, … } … )
- class lightningchart.ui.legend.LegendPanelContainer(instance, container, column, row, colspan, rowspan, legend)[source]¶
Bases:
LegendPanelMethods
- class lightningchart.ui.legend.LegendPanelDashboard(instance, dashboard_id, column, row, colspan, rowspan, legend)[source]¶
Bases:
LegendPanelMethods
- class lightningchart.ui.legend.LegendPanelMethods[source]¶
Bases:
object- add_textbox(text: str = None, x: int = None, y: int = None, position_scale: str = 'axis')[source]¶
Add a text box to the legend panel.
- Parameters:
text (str) – Text of the text box.
x – X position. Interpretation depends on position_scale: - ‘axis’: axis coordinates - ‘percentage’: 0–100 - ‘pixel’: pixels
y – Y position, same scale as x.
position_scale (str) – “percentage” | “pixel” | “axis”
- Returns:
Reference to Text Box class.
- set_background_color(color: str | int | tuple[int, int, int] | tuple[int, int, int, int] | dict[str, int] | Color | None)[source]¶
Set the background color of the legend panel.
- Parameters:
color (Color) – Color of the background. Use ‘transparent’ or None to hide.
overlays. (Use 'transparent' for)
- Returns:
The instance of the class for fluent interface.
- set_background_stroke(thickness: int | float, color: str | int | tuple[int, int, int] | tuple[int, int, int, int] | dict[str, int] | Color | None = None)[source]¶
Set the background stroke style of the legend panel.
- Parameters:
thickness (int | float) – Thickness of the stroke.
color (Color) – The color of the stroke. Use ‘transparent’ or None to hide.
- Returns:
The instance of the class for fluent interface.
- set_minimum_size(width: float, height: float | None = None)[source]¶
Set minimum size (pixels) for the panel (affects dashboard splitter resize).
- Parameters:
width – Minimum width in pixels.
height – Minimum height in pixels. If None, equals width.
- Returns:
self (for chaining).
- textbox(text: str = None, x: int = None, y: int = None, position_scale: str = 'axis')¶
Add a text box to the legend panel.
- Parameters:
text (str) – Text of the text box.
x – X position. Interpretation depends on position_scale: - ‘axis’: axis coordinates - ‘percentage’: 0–100 - ‘pixel’: pixels
y – Y position, same scale as x.
position_scale (str) – “percentage” | “pixel” | “axis”
- Returns:
Reference to Text Box class.
lightningchart.ui.polar_axis module¶
- class lightningchart.ui.polar_axis.PolarAxis(chart)[source]¶
Bases:
GenericAxis- set_stroke(thickness: int | float, color: str | int | tuple[int, int, int] | tuple[int, int, int, int] | dict[str, int] | Color | None = None)[source]¶
Set Stroke style of the axis.
- Parameters:
thickness (int | float) – Thickness of the stroke.
color (Color) – Color of the stroke. Use ‘transparent’ or None to hide.
- Returns:
The instance of the class for fluent interface.
lightningchart.ui.polar_axis_amplitude module¶
- class lightningchart.ui.polar_axis_amplitude.PolarAxisAmplitude(chart)[source]¶
Bases:
PolarAxis- set_tick_format(decimals: int | None = None, suffix: str | None = None)[source]¶
Format amplitude tick labels, e.g. ‘12.3 dB’.
- Parameters:
decimals (int | None) – Number of decimals to display. If None, default formatting is used.
suffix (str | None) – Optional suffix appended to the value (e.g., ‘ dB’).
Example
>>> radial = chart.get_amplitude_axis() >>> radial.set_tick_format(decimals=1, suffix=' dB') # -> '12.3 dB'
- set_tick_strategy(strategy: str, time_origin: int | float = None, utc: bool = False)[source]¶
Set TickStrategy of Axis. The TickStrategy defines the positioning and formatting logic of Axis ticks as well as the style of created ticks.
- Parameters:
strategy (str) – “Empty” | “Numeric” | “DateTime” | “Time”
time_origin (int | float) – Use with “DateTime” or “Time” strategy. If a time origin is defined, data points will be interpreted as milliseconds since time_origin.
utc (bool) – Use with DateTime strategy. By default, False, which means that tick placement is applied according to client’s local time-zone/region and possible daylight saving cycle. When True, tick placement is applied in UTC which means no daylight saving adjustments & timestamps are displayed as milliseconds without any time-zone region offsets.
- Returns:
The instance of the class for fluent interface.
- style_tick_labels(size: int | float, family: str = 'Segoe UI, -apple-system, Verdana, Helvetica', style: str = 'normal', weight: str = 'normal', rotation: float | None = None, tick_padding: int | float | None = None, label_padding: int | float | None = None)[source]¶
Style amplitude tick labels (font + optional rotation & paddings).
- Parameters:
size – Font size in CSS pixels (e.g.,
12or14).family – CSS font-family for labels (comma-separated fallback list).
style – CSS font-style (e.g.,
'normal','italic').weight – CSS font-weight (e.g.,
'normal','600','bold').rotation – Optional label rotation in degrees. If given, rotates the tick label text.
tick_padding – Optional pixels between the tick line and the label.
label_padding – Optional pixels after the label (right/below depending on layout).
- Returns:
The axis instance for fluent chaining.
- Return type:
self
Examples
>>> radial = chart.get_amplitude_axis() >>> radial.style_tick_labels(size=11, weight='600', rotation=0, label_padding=2)
lightningchart.ui.polar_axis_radial module¶
- class lightningchart.ui.polar_axis_radial.PolarAxisRadial(chart)[source]¶
Bases:
PolarAxisClass representing the radial axis in a polar chart.
- get_division() int | None[source]¶
Get how many sections the radial axis is divided into by Ticks.
- Returns:
Number of sections, or None if not yet set.
- set_clockwise(clockwise: bool)[source]¶
Set whether PolarAxisRadial direction is clockwise or counterclockwise.
- Parameters:
clockwise – True for clockwise direction, False for counterclockwise.
- Returns:
The instance of the class for fluent interface.
- set_degrees_format(step_degrees: int | None = None, show_degree_symbol: bool = True)[source]¶
Configure how tick labels on the radial (angle) axis are displayed in degrees.
- Parameters:
step_degrees – If provided, round displayed degree values to the nearest multiple of this step size (e.g.,
30results in labels like0°, 30°, 60°, …). IfNone(default), labels are shown using rounded degrees without step snapping.show_degree_symbol – If
True(default), append the degree symbol (°) to labels. IfFalse, labels are shown as plain numbers.
- Returns:
The axis instance for fluent chaining.
- Return type:
self
Examples
>>> radial = chart.get_radial_axis() >>> radial.set_division(12).set_clockwise(True) >>> radial.set_degrees_format(step_degrees=30, show_degree_symbol=True)
- set_division(sections_count: int)[source]¶
Set how many sections the radial axis is divided into by Ticks.
- Parameters:
sections_count – Number of sections.
- Returns:
The instance of the class for fluent interface.
- set_margin_after_ticks(pixels: int | float)[source]¶
Set gap (px) after tick labels toward the plot.
- set_north(angle: int)[source]¶
Set rotation of radial axis by specifying degree angle that is depicted at North position (horizontally centered, vertically highest).
- Parameters:
angle – Angle as degrees that will be depicted at North position. Defaults to 90.
- Returns:
The instance of the class for fluent interface.
- set_tick_labels(labels: list[str])[source]¶
Replace all default tick labels within the radial axis with a list of custom labels.
- Parameters:
labels – A list of strings to display on the ticks. Must match the number of axis divisions.
- Returns:
The instance of the class for fluent interface.
- style_tick_labels(size: int | float, family: str = 'Segoe UI, -apple-system, Verdana, Helvetica', style: str = 'normal', weight: str = 'normal', rotation: float | None = None, tick_padding: int | float | None = None, label_padding: int | float | None = None)[source]¶
Style the radial axis tick labels (font, rotation, and paddings).
- Parameters:
size – Font size in CSS pixels (e.g.,
12or14).family – CSS font-family for labels (comma-separated fallback list).
style – CSS font-style (e.g.,
'normal','italic').weight – CSS font-weight (e.g.,
'normal','600','bold').rotation – Optional label rotation in degrees. If given, rotates the tick label text.
tick_padding – Optional pixels between the tick line and the label.
label_padding – Optional pixels after the label (right/below depending on layout).
- Returns:
The axis instance for fluent chaining.
- Return type:
self
Examples
>>> radial = chart.get_radial_axis() >>> radial.style_tick_labels(size=11, weight='600', rotation=0, label_padding=2)
lightningchart.ui.polar_sector module¶
- class lightningchart.ui.polar_sector.PolarSector(chart)[source]¶
Bases:
ComponentWithPaletteColoring,SeriesWithoutCursorEnabled,SeriesWithAddEventListenerClass representing a sector in a polar chart.
- set_amplitude_end(amplitude_end: int | float | None)[source]¶
Set Sectors end amplitude.
- Parameters:
amplitude_end – End amplitude. Setting to None results in tracking the PolarAxes end value. This doesn’t have to be greater than amplitude start value.
- Returns:
The instance of the class for fluent interface.
- set_amplitude_start(amplitude_start: int | float | None)[source]¶
Set Sectors start amplitude.
- Parameters:
amplitude_start – Start amplitude. Setting to None results in tracking the PolarAxes start value. This doesn’t have to be less than amplitude end value.
- Returns:
The instance of the class for fluent interface.
- set_angle_end(angle_end: int | float)[source]¶
Set Sectors end angle in degrees.
- Parameters:
angle_end – End angle in degrees, restricted to [0, 360]. This doesn’t have to be greater than angle start value.
- Returns:
The instance of the class for fluent interface.
- set_angle_start(angle_start: int)[source]¶
Set Sectors start angle in degrees.
- Parameters:
angle_start – Start angle in degrees, restricted to [0, 360]. This doesn’t have to be less than angle end value.
- Returns:
The instance of the class for fluent interface.
- set_stroke(thickness: int | float, color: str | int | tuple[int, int, int] | tuple[int, int, int, int] | dict[str, int] | Color | None = None)[source]¶
Set Stroke style of the sector.
- Parameters:
thickness (int | float) – Thickness of the stroke.
color (Color) – Color of the stroke. Use ‘transparent’ or None to hide.
- Returns:
The instance of the class for fluent interface.
lightningchart.ui.text_box module¶
- class lightningchart.ui.text_box.PointableTextBox(chart, text: str = None, x: int = None, y: int = None, position_scale: str = 'axis')[source]¶
Bases:
TextBoxInteractive TextBox variant with built-in pointer support and drag handles.
- class lightningchart.ui.text_box.TextBox(chart, text: str = None, x: int = None, y: int = None, position_scale: str = 'axis')[source]¶
Bases:
UIEWithPosition,UIElementsWithAutoDisposeUI Element for adding text annotations on top of the chart.
- add_event_listener(event: str, handler: callable | None = None, throttle_ms: int = 0, once: bool = False) str[source]¶
Attach an event listener to the TextBox.
- Parameters:
event – Event name, e.g. ‘pointerdown’, ‘pointermove’, ‘click’.
handler – Optional Python callback that receives the event payload.
throttle_ms – Minimum delay between handler invocations.
once – When True, the listener removes itself after the first trigger.
- Returns:
The callback id that identifies this listener.
- add_image(source: str, fit_mode: str = 'Stretch', size: dict = None)[source]¶
Updates the background of the current TextBox UI element to use an image (provided as a Base64-encoded data URI) as its fill.
- Parameters:
source (str) – Path to the image file or URL.
fit_mode (str) – How the image should fit (‘Stretch’, ‘Fill’, ‘Fit’, ‘Tile’, ‘Center’).
size (dict, optional) – Desired size of the image display, e.g. {“width”: 100, “height”: 100}. Defaults to 100x100.
- Returns:
The instance for fluent interfacing.
- Return type:
self
Example
>>> textbox.add_image("D:/path/to/local_image.png") >>> textbox.add_image("https://example.com/image.jpg")
- add_video(video_source: str, fit_mode: str = 'fit', size: dict = None)[source]¶
Updates the background of the current TextBox UI element to use a video (provided as a Base64-encoded data URI) as its fill.
- Parameters:
video_source (str) – Path to the video file (MP4 or WEBM) or URL.
fit_mode (str) – How the video should fit (‘Fit’, ‘Stretch’, ‘Fill’, ‘Tile’, ‘Center’).
size (dict, optional) – Desired size of the video display, e.g. {“width”: 150, “height”: 150}. This controls the UI element’s padding. Defaults to 100x100.
- Returns:
The instance for fluent interfacing.
- Return type:
self
Example
>>> textbox.add_video("D:/path/to/local_video.mp4") >>> textbox.add_video("https://example.com/video.mp4")
- get_background() dict | None[source]¶
Get the text box background styling.
- Returns:
Contains type, fill_style, and stroke_style.
- Return type:
dict | None
- get_effect() bool | None[source]¶
Get theme effect enabled state on the text box.
- Returns:
True if theme effect is enabled, False otherwise.
- Return type:
bool | None
- get_highlight() float | None[source]¶
Get state of component highlighting.
- Returns:
Number between 0 and 1, where 1 is fully highlighted.
- Return type:
float | None
- get_margin() dict | None[source]¶
Get margin around the text box in pixels.
- Returns:
Margin datastructure with margin values.
- Return type:
dict | None
- get_padding() dict | None[source]¶
Get padding around the text box in pixels.
- Returns:
Margin datastructure with padding values.
- Return type:
dict | None
- get_pointer_events() bool | None[source]¶
Get the mouse interactions state.
- Returns:
Mouse interactions state.
- Return type:
bool | None
- get_text() str | None[source]¶
Get the text content of the text box.
- Returns:
The text content of the text box.
- Return type:
str | None
- get_text_fill_style() str | None[source]¶
Get the text fill style (color).
- Returns:
Color as rgba string.
- Return type:
str | None
- get_text_font() dict | None[source]¶
Get font settings of the text box.
- Returns:
- Font settings with keys:
size (float): Font size
family (str): Font family
weight (str): Font weight
style (str): Font style
- Return type:
dict | None
- get_text_rotation() float | None[source]¶
Get the rotation of the text in degrees.
- Returns:
Rotation in degrees.
- Return type:
float | None
- is_disposed() bool | None[source]¶
Check whether the text box is disposed.
- Returns:
True if object is disposed.
- Return type:
bool | None
- set_background_color(color: str | int | tuple[int, int, int] | tuple[int, int, int, int] | dict[str, int] | Color | None)[source]¶
Set the background color of the text box.
- Parameters:
color (Color) – Color of the background. Use ‘transparent’ or None to hide.
- Returns:
The instance of the class for fluent interface.
- set_effect(enabled: bool)[source]¶
Set theme effect enabled on component or disabled.
- Parameters:
enabled – Boolean flag.
- Returns:
The instance of the class for fluent interface.
- set_padding(*args, **kwargs: Unpack[PaddingKwargs])[source]¶
Set padding around object in pixels.
- Parameters:
*args – A single numeric value (int or float) for uniform padding on all sides.
**kwargs – Optional named arguments to specify padding for individual sides: - left (int or float): Padding for the left side. - right (int or float): Padding for the right side. - top (int or float): Padding for the top side. - bottom (int or float): Padding for the bottom side.
Examples
set_padding(5): Sets uniform padding for all sides (integer or float).
set_padding(left=10, top=15): Sets padding for specific sides only.
set_padding(left=10, top=15, right=20, bottom=25): Fully define padding for all sides.
- Returns:
The instance of the class for fluent interface.
- set_stroke(thickness: int | float, color: str | int | tuple[int, int, int] | tuple[int, int, int, int] | dict[str, int] | Color | None = None)[source]¶
Set the text box stroke style.
- Parameters:
thickness (int | float) – Thickness of the stroke.
color (Color) – Color of the stroke. Use ‘transparent’ or None to hide.
- Returns:
The instance of the class for fluent interface.
- set_text(text: str)[source]¶
Set the content of the text box.
- Parameters:
text (str) – Text string.
- Returns:
The instance of the class for fluent interface.
- set_text_fill_style(color: str | int | tuple[int, int, int] | tuple[int, int, int, int] | dict[str, int] | Color | None)[source]¶
Set the color of the text.
- Parameters:
color (Color) – Color of the text. Use ‘transparent’ or None to hide.
- Returns:
The instance of the class for fluent interface.
- set_text_font(size: int | float, family: str = 'Segoe UI, -apple-system, Verdana, Helvetica', style: str = 'normal', weight: str = 'normal')[source]¶
Set the font style of the text.
- Parameters:
size (int | float) – CSS font size. For example, 16.
family (str) – CSS font family. For example, ‘Arial, Helvetica, sans-serif’.
weight (str) – CSS font weight. For example, ‘bold’.
style (str) – CSS font style. For example, ‘italic’
- Returns:
The instance of the class for fluent interface.
Module contents¶
- class lightningchart.ui.UIEWithHighlight(chart)[source]¶
Bases:
UIElement
- class lightningchart.ui.UIEWithPosition(chart)[source]¶
Bases:
UIElement- set_margin(*args, **kwargs: Unpack[PaddingKwargs])[source]¶
Set margin around the object in pixels.
- Usage:
set_margin(5): Sets uniform margin for all sides (integer or float).
set_margin(left=10, top=15): Sets margin for specific sides only.
set_margin(left=10, top=15, right=20, bottom=25): Fully define margin for all sides.
- Parameters:
*args – A single numeric value (int or float) for uniform margin on all sides.
**kwargs – Optional named arguments to specify margin for individual sides: - left (int or float): Margin for the left side. - right (int or float): Margin for the right side. - top (int or float): Margin for the top side. - bottom (int or float): Margin for the bottom side.
- Returns:
The instance of the class for fluent interface.
- set_origin(origin: str)[source]¶
Sets the position of this UiElement relative to its origin.
- Parameters:
origin (str) – “Center” | “CenterBottom” | “CenterTop” | “LeftBottom” | “LeftCenter” | “LeftTop” | “RightBottom” | “RightCenter” | “RightTop”
- Returns:
The instance of the class for fluent interface.
- class lightningchart.ui.UIEWithTitle(chart)[source]¶
Bases:
UIElement- set_title_font(size: int | float, family: str = 'Segoe UI, -apple-system, Verdana, Helvetica', style: str = 'normal', weight: str = 'normal')[source]¶
Set font of Chart title.
- Parameters:
size (int | float) – CSS font size. For example, 16.
family (str) – CSS font family. For example, ‘Arial, Helvetica, sans-serif’.
weight (str) – CSS font weight. For example, ‘bold’.
style (str) – CSS font style. For example, ‘italic’
- Returns:
The instance of the class for fluent interface.
- class lightningchart.ui.UIElement(chart)[source]¶
Bases:
object
- class lightningchart.ui.UIElementsWithAutoDispose[source]¶
Bases:
object- set_auto_dispose(mode: str, threshold: float)[source]¶
Auto-dispose this element when it exceeds a viewport threshold.
- Parameters:
mode – “max-width” or “max-height”
threshold – Fraction of viewport (0–1) at which to dispose.
- set_dragging_mode(mode: str)[source]¶
Set dragging mode for this UI element.
- Parameters:
mode – “draggable”, “notDraggable”, “onlyHorizontal”, or “onlyVertical”