ChartScaleModel class
A model class that encapsulates chart scaling information.
ChartScaleModel holds essential scaling parameters that determine how chart
data is mapped to the visual space. It provides the foundation for consistent
scaling across different components of the chart visualization system.
This model is used by various chart components to ensure that visual elements (such as candles, lines, markers, and annotations) are rendered at the appropriate scale and position. It helps maintain visual consistency as the user zooms, pans, or otherwise interacts with the chart.
The primary scaling parameters are:
msPerPx: The horizontal scale (milliseconds per pixel)granularity: The time interval between consecutive data points
From these primary parameters, derived values like the zoom factor can be calculated, which are used to scale visual elements appropriately.
Constructors
- ChartScaleModel({required int granularity, required double msPerPx})
-
Creates a new chart scale model with the specified scaling parameters.
const
Properties
- granularity → int
-
The time interval (in milliseconds) between consecutive data points.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- msPerPx → double
-
The number of milliseconds represented by one pixel on the x-axis.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- zoom → double
-
Calculates the zoom factor based on the relationship between
msPerPxandgranularity.no setter
Methods
-
copyWith(
{double? msPerPx, int? granularity}) → ChartScaleModel - Creates a copy of this model with the specified fields replaced.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toPainterProps(
) → PainterProps -
Creates a
PainterPropsinstance from this model's scaling parameters. -
toString(
) → String -
A string representation of this object.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited