LinearScale class

NumericScale that lays out the domain linearly across the range.

A Scale which converts numeric domain units to a given numeric range units linearly (as opposed to other methods like log scales). This is used to map the domain's values to the available pixel range of the chart using the apply method.

The domain extent of the scale are determined by adding all domain values to the scale. It can, however, be overwritten by calling [domainOverride] to define the extent of the data.

The scale can be zoomed & panned by calling either [setViewportSettings] with a zoom and translate, or by setting [viewportExtent] with the domain extent to show in the output range.

[rangeBandConfig]: By default, this scale will map the domain extent exactly to the output range in a simple ratio mapping. If a [RangeBandConfig] other than NONE is used to define the width of bar groups, then the scale calculation may be altered to that there is a half a stepSize at the start and end of the range to ensure that a bar group can be shown and centered on the scale's result.

[stepSizeConfig]: By default, this scale will calculate the stepSize as being auto detected using the minimal distance between two consecutive datum. If you don't assign a [RangeBandConfig], then changing the [stepSizeConfig] is a no-op.

Implemented types

Constructors

LinearScale()

Properties

dataExtent NumericExtents
Returns the extent of the actual data (not the viewport max).
no setteroverride
domainOverride NumericExtents?
Overrides the domain extent if set, null otherwise.
getter/setter pairoverride
domainStepSize double
Returns the stepSize domain value.
no setter
hashCode int
The hash code for this object.
no setterinherited
keepViewportWithinData bool
Keeps the scale and translate sane if true (default).
getter/setter pairoverride
minimumDomainStep num
Returns the minimum step size of the actual data.
no setteroverride
range ↔ ScaleOutputExtent?
Returns the previously set output range for the scale function.
getter/setter pair
rangeBand double
Returns the rangeBand width in pixels.
no setter
rangeBandConfig ↔ RangeBandConfig
Returns the configuration used to determine the rangeBand.
getter/setter pair
rangeWidth int
Returns the absolute width between the max and min range values.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
stepSize double
Returns the stepSize width in pixels.
no setter
stepSizeConfig ↔ StepSizeConfig
Sets the method for determining the step size.
getter/setter pair
viewportDomain NumericExtents
Returns the domain extent visible in the viewport of the drawArea.
getter/setter pairoverride
viewportScalingFactor double
Returns the current viewport scale.
no setter
viewportTranslatePx double
Returns the current pixel viewport offset
no setter

Methods

addDomain(num domainValue) → void
Add domainValue to this Scale's domain.
canTranslate(num _) bool
Tests a domainValue to see if the scale can translate it.
compareDomainValueToViewport(num domainValue) int
Tests whether the given domainValue is within the axis' range.
computeViewportScaleFactor(double domainWindow) double
Returns the viewportScaleFactor needed to present the given domainWindow.
override
copy() LinearScale
Returns a mutable copy of the scale.
isRangeValueWithinViewport(double rangeValue) bool
Returns true if the given rangeValue point is within the output range.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
resetDomain() → void
Reset the domain for this Scale.
resetViewportSettings() → void
Reset the viewport settings for this Scale.
reverse(double viewPixels) num
Reverse application of the scale.
setViewportSettings(double viewportScale, double viewportTranslatePx) → void
Configures the zoom and translate.
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited
operator [](num domainValue) num
Applies the scale function to the domainValue.