Skip to main content
Version: 2.0.0-alpha.19

Introduction

CartesianCharts stack CartesianLayers. The three built-in CartesianLayers, all of which extend BaseCartesianLayer, are described on the following pages.

A CartesianChart’s x and y ranges depend on those reported by its CartesianLayers. The x range is the narrowest one that includes all CartesianLayers’ x ranges. By default, there’s an analogously determined shared y range.

verticalAxisPosition

A CartesianChart can have two separate y ranges, one for the start VerticalAxis and one for the end VerticalAxis. (Technically, the presence of two VerticalAxis instances isn’t necessary, but it’s generally needed for unambiguity.) To utilize this functionality, use the verticalAxisPosition parameters and properties to assign each CartesianLayer an AxisPosition.Vertical subclass—either AxisPosition.Vertical.Start or AxisPosition.Vertical.End. The final y range for either AxisPosition.Vertical subclass is the narrowest range that includes the y ranges of all CartesianLayers linked to that AxisPosition.Vertical subclass. Thus, you get two independently scaled groups of CartesianLayers, and the two VerticalAxis instances are disconnected.

AxisValueOverrider

What x and y ranges a CartesianLayer reports depends on its AxisValueOverrider.

A CartesianLayer passes its intrinsic x and y ranges—which depend on the CartesianLayerModel—to its AxisValueOverrider, and the AxisValueOverrider returns the final ranges for the CartesianLayer to report. There are three AxisValueOverrider factory functions:

For more specific behavior, create a custom implementation.

warning

When using CartesianChartModelProducer, set each CartesianLayer’s AxisValueOverrider only once. There are no restrictions on dynamic behavior, but it should be implemented as part of a single AxisValueOverrider, not by means of an AxisValueOverrider-switching mechanism.

When the CartesianLayer’s intrinsic x and y ranges are needed for calculations, use the values passed to the AxisValueOverrider functions (unless, of course, you’re using AxisValueOverrider.auto or AxisValueOverrider.adaptiveYValues). Beyond that, use extras if needed. These are important here not only for the usual synchronization reasons, but also because they’re updated via CartesianChartModelProducer.Transactions, and a CartesianChartModelProducer.Transaction is required for a CartesianChart’s x and y ranges to be updated. A common use case for extras is switching between predefined x and y ranges, including without series updates.

It can be concluded that in CartesianChartModelProducer-powered charts, AxisValueOverrider.fixed should be used only for predefined overrides that don’t directly depend on the data and never change.