Source code for lightningchart.series.heatmap_scrolling_grid_series
from __future__ import annotations
from typing import Optional
from lightningchart.charts import Chart
from lightningchart.ui.axis import Axis
from lightningchart.series import (
ComponentWithPaletteColoring,
SeriesWithAddEventListener,
SeriesWithCursor,
SeriesWithWireframe,
SeriesWithPixelInterpolation,
SeriesWithDataCleaning,
SeriesWithAddIntensityValues,
SeriesWithClear,
SeriesWithDrawOrder,
SeriesWithXYAxes,
)
from lightningchart.utils.utils import LegendOptions, build_series_legend_options
[docs]
class HeatmapScrollingGridSeries(
ComponentWithPaletteColoring,
SeriesWithWireframe,
SeriesWithPixelInterpolation,
SeriesWithDataCleaning,
SeriesWithAddIntensityValues,
SeriesWithClear,
SeriesWithDrawOrder,
SeriesWithAddEventListener,
SeriesWithXYAxes,
SeriesWithCursor,
):
"""Series for visualizing 2D heatmap data in a grid with automatic scrolling features."""
def __init__(
self,
chart: Chart,
resolution: int,
scroll_dimension: str = 'columns',
automatic_color_index: int = None,
heatmap_data_type: str = 'intensity',
axis_x: Axis = None,
axis_y: Axis = None,
legend: Optional[LegendOptions] = None,
):
super().__init__(chart, axis_x, axis_y)
legend_options = build_series_legend_options(legend)
self.instance.send(
self.id,
'heatmapScrollingGridSeries',
{
'chart': self.chart.id,
'scrollDimension': scroll_dimension,
'automaticColorIndex': automatic_color_index,
'heatmapDataType': heatmap_data_type,
'resolution': resolution,
'axisX': axis_x,
'axisY': axis_y,
'legend': legend_options if legend_options else None,
},
)
[docs]
def set_start(self, x: int | float, y: int | float):
"""Set start coordinate of Heatmap on its X and Y axis where the first heatmap sample will be positioned
Args:
x: x-coordinate.
y: y-coordinate.
Returns:
The instance of the class for fluent interface.
"""
self.instance.send(self.id, 'setStartXY', {'x': x, 'y': y})
return self
[docs]
def set_step(self, x: int | float, y: int | float):
"""Set Step between each consecutive heatmap value on the X and Y Axes.
Args:
x: x-coordinate.
y: y-coordinate.
Returns:
The instance of the class for fluent interface.
"""
self.instance.send(self.id, 'setStepXY', {'x': x, 'y': y})
return self
[docs]
def set_aggregation(self, mode: str | None):
"""
Set heatmap intensity aggregation mode.
Notes:
- Works when intensity interpolation is disabled.
(e.g., `set_intensity_interpolation(False)`)
Args:
mode: Aggregation mode - 'max', 'min', or None to disable.
Returns:
The instance of the class for fluent interface.
"""
self.instance.send(self.id, 'setAggregation', {'mode': mode})
return self