core_chart library

Lite public entry point for consumers that manage their own indicatorsRepo and drawingToolsRepo.

Exports the same surface as acme_chart.dart but uses acme_chart_lite.dart under the hood, which omits the built-in indicator/ drawing-tool dialog imports and shared_preferences. This keeps the Flutter web bundle smaller by allowing dart2js to tree-shake those dependencies.

Use package:acme_chart/acme_chart.dart instead if you need the built-in dialog UI.

Classes

AccumulatorIndicator
Accumulator Barriers.
AccumulatorMarkerIconPainter
AccumulatorMarkerIconPainter is a specialized painter for rendering accumulator contract markers on charts.
AccumulatorsActiveContract
Used to hold the active active accumulators contract information.
AccumulatorsClosedIndicator
Accumulator Closed Contract Barriers.
AccumulatorsEntrySpotBarrier
AccumulatorsEntrySpotBarrier creates a dot and a dashed horizontal barrier to the previous x epoch where accumulators marker was painted. Example is below. By checking that list of accumulator markers is not empty and when the current tick is the next after painted marker, barrier will be automatically added to a chart. In order to add accumulators entry spot barrier pass AccumulatorsEntrySpotBarrier to annotations
AccumulatorsMarkerIconPainter
Icon painter for Accumulators trade type
AccumulatorsRecentlyClosedIndicator
Accumulator Closed Contract Barriers.
AcmeChart
A lite version of AcmeChart that does not import dialog or shared_preferences dependencies, keeping the web bundle smaller for consumers that manage their own indicatorsRepo and drawingToolsRepo.
ActiveMarker
Focused marker on the chart.
ActiveMarkerGroup
Active marker data bound to a marker group.
AddingStateInfo
Represents the information about progress of the tool being added to the interactive layer.
AddOnConfig
Config for add-ons such as indicators and drawing tools
AddOnsRepository<T extends AddOnConfig>
Holds indicators/drawing tools that were added to the Chart during runtime.
ADXIndicatorConfig
adx Indicator Config
ADXSeries
ADX series
AlligatorIndicatorConfig
Bollinger Bands Indicator Config
AlligatorSeries
A series which shows Alligator Series data calculated from 'entries'.
AnimationInfo
A class that hold animation progress values.
AppLocalizationDelegate
AroonIndicatorConfig
Aroon Indicator configurations.
AroonSeries
A series which shows Aroon Indicator Series data calculated from 'entries'.
Asset
Representing an active symbol retrieved from the API.
AwesomeOscillatorIndicatorConfig
Awesome Oscillator Indicator Config
AwesomeOscillatorSeries
A series which shows Awesome Oscillator Series data calculated from entries.
Barrier
Base class of barrier
BarrierObject
A ChartObject for defining position of a horizontal barrier.
BarrierStyle
Barrier style.
BollingerBandSeries
Bollinger bands series
BollingerBandsIndicatorConfig
Bollinger Bands Indicator Config
BrandColors
Acme Chart colors. It can be called as BrandColors.coral.
Candle
Candle class.
CandleBearishThemeColors
Candle Bearish colors for light, dark
CandleBullishThemeColors
Candle Bullish colors for light, dark
CandleIndicator
Indicator for showing the candle current value and remaining time (optional)
CandleSeries
CandleStick series
CandleStyle
Defines the style of painting candle data.
CCIIndicatorConfig
Commodity Channel Index Indicator configurations.
CCISeries
Commodity Channel Index series.
ChannelDrawingToolConfig
Channel drawing tool config
Chart
Interactive chart widget.
ChartAnnotation<T extends ChartObject>
Base class of chart annotations.
ChartAxisConfig
Configuration for the chart axis.
ChartConfig
Chart's general configuration.
ChartController
Chart widget's controller.
ChartData
Any data that the chart takes and makes it paint its self on the chart's canvas including Line, CandleStick data, Markers, barriers etc..
ChartDefaultDarkTheme
An implementation of ChartDefaultTheme which provides access to dark theme-related colors and styles for the chart package.
ChartDefaultLightTheme
An implementation of ChartDefaultTheme which provides access to light theme-related colors and styles for the chart package.
ChartDefaultTheme
Provides access to common theme-related colors and styles between default light and dark themes.
ChartLocalization
ChartMarker
A specialized marker class for displaying various types of markers on a financial chart.
ChartObject
Any component other than chart data (line or candle) which can take a rectangle on the chart's canvas.
ChartScaleModel
A model class that encapsulates chart scaling information.
ChartTheme
An interface for the Chart's theme.
CombinedBarrier
A barrier with both horizontal and vertical barriers.
ContinuousDrawingToolConfig
Continuous drawing tool config
CrosshairCandleHighlightPainter
A custom painter to paint a highlighted candle at the crosshair position.
CrosshairDotPainter
A custom painter to paint the crossshair dot.
DarkThemeColors
Default colors for dark theme.
DataLinePathInfo
A class for holding the information of a DataSeries line path.
DataPainter<S extends DataSeries<Tick>>
A class to paint common option of DataSeries data.
DataSeries<T extends Tick>
Series with only a single list of data to paint.
DigitMarkerIconPainter
A specialized painter for rendering digit contract markers on financial charts.
DonchianChannelIndicatorConfig
Donchian Channel Indicator Config
DonchianChannelsSeries
Donchian Channels series
DPOIndicatorConfig
Detrended Price Oscillator Indicator Config
DPOSeries
Detrended Price Oscillator series
DrawingAddingPreview<T extends InteractableDrawing<DrawingToolConfig>>
A preview of a drawing that is being added to the InteractiveLayer.
DrawingData
A class that hold drawing data.
DrawingToolChart
A widget for encapsulating drawing tools related business logic
DrawingToolConfig
Drawing tools config
DrawingToolDistance
DrawingTools
This calss is used to keep all the methods and data related to drawing tools Which need to be shared between the AcmeChart and the DrawingToolsDialog
DrawingToolsDialog
Drawing tools dialog with available drawing tools.
DrawingToolWidget
The class acts as a bridge between the selected drawing tool and the drawing creation process, delegating the specific creation logic to the corresponding drawing tool configurations.
DrawingV2
Base interface for any drawing painted on the InteractiveLayer and can be interacted with by the user.
EntryExitMarkerStyle
Defines the style of an entry or exit marker.
EntryTickAnnotation
Entry tick dot annotation.
FibfanDrawingToolConfig
Fibfan drawing tool config
FractalChaosBandIndicatorConfig
Fractal Chaos Band Indicator Config
FractalChaosBandSeries
A series which shows Fractal Chaos Band Series data calculated from 'entries'.
GatorIndicatorConfig
Gator Indicator Config
GatorSeries
A series which shows Gator Series data calculated from 'entries'.
GridStyle
For defining the style of the chart's grid. (X and Y axes).
HollowCandleSeries
Hollow CandleStick series
HorizontalBarrier
Horizontal barrier class.
HorizontalBarrierPainter<T extends HorizontalBarrier>
A class for painting horizontal barriers.
HorizontalBarrierStyle
Horizontal barrier style.
HorizontalDrawingToolConfig
Horizontal drawing tool configurations.
HorizontalLineAddingPreviewDesktop
A class to show a preview and handle adding HorizontalLineInteractableDrawing to the chart. It's for when we're on InteractiveLayerDesktopBehaviour
HorizontalLineAddingPreviewMobile
A class to show a preview and handle adding a HorizontalLineInteractableDrawing to the chart. It's for when we're on InteractiveLayerMobileBehaviour.
HorizontalLineInteractableDrawing
Interactable drawing for horizontal line drawing tool.
IchimokuCloudIndicatorConfig
Ichimoku Cloud Indicator Config
IchimokuCloudSeries
Ichimoku Cloud series
IconBarrierPainter
The painter for the IconTickIndicator which paints the icon on the barrier's tick position.
IconTickIndicator
A tick indicator which also paints an icon on top of the barrier's tick.
IndicatorConfig
Indicator config
IndicatorInput
Indicator's input
InteractableDrawing<T extends DrawingToolConfig>
The class that will be generated by the drawing tool config instance when they are created or the saved ones that are loaded from storage. The information from this class (its subclasses) will be used to draw the tool on the chart. It will keep the latest state of the drawing tool as the user interacts with the tools in the runtime. During the time that user interacts with a tool. by some debounce mechanism This class will update the config which is supposed to be saved in the storage.
InteractiveAddingToolState
The state of the interactive layer when a tool is being added.
InteractiveAddingToolStateMobile
The mobile-specific implementation of the interactive adding tool state.
InteractiveLayerBehaviour
The base class for managing InteractiveLayerBase's behaviour according to a platform or a condition. InteractiveLayerBase uses this to manage gestures and the layer state in every scenarios. The way we're handling the gestures and currentState transitions can be customized by extending this class.
InteractiveLayerController
A controller similar to ListView.scrollController to control interactive layer from outside in addition to get some information from internal states of layer to outside.
InteractiveLayerDesktopBehaviour
The Desktop-specific implementation of the interactive layer behaviour.
InteractiveLayerMobileBehaviour
The mobile-specific implementation of the interactive layer behaviour.
InteractiveNormalState
The normal state of the interactive layer.
InteractiveSelectedToolState
The state of the interactive layer when a tool is selected.
InteractiveState
The state of the interactive layer.
LegacyDarkThemeColors
These colors suits the dark theme. They are used in the legacy chart and should be replaced with the new colours from DarkThemeColors
LegacyLightThemeColors
These colors suits the light theme.
LightThemeColors
Default colors for light theme.
LineDrawingToolConfig
Line drawing tool config
LineDrawingToolConfigMobile
Line drawing tool config
LinePainter
A DataPainter for painting line data.
LineSeries
Line series.
LineStyle
Defines the style of painting line data.
MACDIndicatorConfig
MACD Indicator Config
MACDSeries
MACD series
MAEnvIndicatorConfig
Moving Average Envelope Indicator Config
MAEnvSeries
A series which shows Moving Average Envelope data calculated from 'entries'.
MAIndicatorConfig
Moving Average indicator config
Marker
Chart open position marker.
MarkerGroup
Chart open position marker. MarkerGroup is a container class that organizes related chart markers into a logical unit.
MarkerGroupIconPainter
Foundation class for painting marker group on canvas An abstract base class for rendering groups of related markers on financial charts.
MarkerGroupPainter
A specialized painter class responsible for rendering marker groups on a financial chart.
MarkerGroupSeries
Marker Group series
MarkerIconPainter
Foundation class for painting markers on canvas
MarkerProps
A configuration class that holds properties for chart markers.
MarkerSeries
Marker series
MarkerStyle
Defines the style of markers.
Market
A class to keep a market's information.
MarketSelector
A widget which is used to select the market of the chart.
MarketSelectorButton
A Button to open the market selector. The selected Asset should be passed as asset.
MASeries
A series which shows Moving Average data calculated from entries.
MinMaxIndices
A model class to hold min/max indices of a list
MultipliersMarkerIconPainter
Icon painter for Multipliers trade type
OhlcCandleSeries
Ohlc CandleStick series
OhlcPainter
A DataPainter for painting CandleStick data which handles the logic for calculation of candle elements for all OHLC type charts
OhlcPainting
The required painting properties of a ohlc.
OHLCTypeSeries
Super-class of series with OHLC data (CandleStick, OHLC, Hollow).
OptionsMarkerIconPainter
Icon painter for Options trade type
OscillatorLinesConfig
Oscillator Limits.
OverlayStyle
Style of the overlay.
PainterProps
A data class that encapsulates properties used for rendering chart elements.
ParabolicSARConfig
Parabolic SAR indicator config.
ParabolicSARSeries
Parabolic SAR series class.
RainbowIndicatorConfig
Rainbow Indicator Config
RainbowSeries
Rainbow series
RayDrawingToolConfig
Ray drawing tool config
RectangleDrawingToolConfig
Rectangle drawing tool configurations.
Repository<T>
Holds indicators/drawing tools that were added to the Chart during runtime.
ROCIndicatorConfig
ROC Indicator configurations.
ROCSeries
ROC series.
RSIIndicatorConfig
RSI Indicator configurations.
RSISeries
RSI series.
ScatterStyle
Defines the style of painting Scatter data.
Series
Base class of all chart series.
SeriesPainter<S extends Series>
A class responsible to paint its series data.
SMIIndicatorConfig
SMI Indicator configurations.
SMISeries
Stochastic Momentum Index series class.
StochasticOscillatorIndicatorConfig
Stochastic Oscillator Indicator configurations.
StochasticOscillatorSeries
A series which shows Stochastic Oscillator Series data calculated from 'entries'.
SubMarket
A class to keep a sub-market's information.
SymbolIcon
A wrapper widget around AssetImage which provides image icon for the given symbolCode.
Tick
Basic data entry.
TickIndicator
Tick indicator.
TickMarkerIconPainter
A specialized painter for rendering tick-based contract markers on financial charts.
TrendDrawingToolConfig
Trend drawing tool configurations.
TrendLineAddingPreviewDesktop
Desktop-specific implementation of trend line adding preview with advanced animations.
TrendLineAddingPreviewMobile
Mobile-specific implementation for trend line adding preview.
TrendLineInteractableDrawing
Interactable drawing implementation for trend line drawing tool.
VerticalBarrier
Vertical barrier class.
VerticalBarrierObject
Vertical barrier object.
VerticalBarrierStyle
Vertical barrier style.
VerticalDrawingToolConfig
Vertical drawing tool configurations.
WilliamsRIndicatorConfig
WilliamsR Indicator configurations.
WilliamsRSeries
WilliamsRSeries
WormChart
A lightweight worm chart widget.
YAxisConfig
Singleton class to manage configuration and operations related to the Y-axis in custom painting
ZigZagIndicatorConfig
ZigZag indicator config
ZigZagSeries
A series which shows ZigZag data calculated from entries.

Enums

BarrierArrowType
The type of arrow on top/bottom of barrier label (Horizontal barrier).
ChartStyle
Differnet types of chart.
CrosshairVariant
Defines the visual and behavioral variants of the crosshair component in charts.
DesktopAnimationState
Animation states for desktop trend line preview
HorizontalBarrierVisibility
Horizontal barrier visibility behavior and whether it contributes in defining the overall Y-Axis range of the chart.
LabelShape
Label shape.
MarkerDirection
Directions in which marker can face.
MarkerTextType
Determines how the ChartMarker.text is styled.
MarkerType
Defines the various types of markers that can be displayed on a financial chart.
MovingAverageType
Supported types of moving average.
VerticalBarrierLabelPosition
Vertical barrier label position.

Mixins

InteractiveHoverState
The state of the interactive layer when a tool is hovered.

Extensions

AddOnsRepositoryConfigExtension on Repository<AddOnConfig>
Extension on Repository.
ChartDataListExtension on Iterable<ChartData?>
An extension on Iterable with ChartData elements.
InteractiveStateExtension on InteractiveState
Extension that provides utility methods for interactive states.
MATypesExtension on MovingAverageType
Moving Average types extension.

Constants

defaultBottomBoundQuote → const double
Default bottom bound quote.
defaultMaxCurrentTickOffset → const double
Default Max distance between rightBoundEpoch and _nowEpoch in pixels. Limits panning to the right.
defaultTopBoundQuote → const double
Default top bound quote.
hitTestMargin → const double
The margin for hit testing.
kDefaultPlaceholderPath → const String
Default path to the placeholder icon.
scrollToSelectedDuration → const Duration
The duration of animating the scroll to the selected item in the MarketSelector widget.

Functions

addAreaPath(Canvas canvas, Size size, Path linePath, double lineStartX, double lineEndX) → void
Returns the area paint of the given Path.
calculateCurrentTickWidth(List<Tick> ticks, TextStyle textStyle, int pipSize) double
Calculates the width needed to display the current tick's price label.
calculateOpacity(double from, double? exitTo) double
Calculates the opacity for markers based on their horizontal positions.
calculateTextColor(Color background) Color
A method used for getting color for the given background brightness. If the background color is considered bright it will return Colors.black, otherwise it will return Colors.white.
calculateYAxisWidth(List<Tick> ticks, ChartTheme theme, int pipSize) double
Calculates the appropriate width for the y-axis based on the price values.
convertRange(double value, double oldMin, double oldMax, double newMin, double newMax) double
Maps a value from one range to another and inverts the result.
durationToString(Duration duration) String
Returns the given duration in H:MM:SS format.
formatEpochToGMTDateTime(int epochMillis) String
Converts an epoch timestamp in milliseconds to a formatted GMT date-time string.
getMarkerColor(MarkerProps props, MarkerStyle style) Color
Returns the appropriate color of the marker based on its running state and profit/loss status.
getMinMaxIndex(List<Tick> ticks, int startIndex, [int? endIndex]) MinMaxIndices
Gets the min and max index from a list of Tick.
getSymbolAssetPath(String assetCode) String
Provides the path to the PNG file located in the consumer app's assets.
labelWidth(double text, TextStyle style, int pipSize) double
Returns the width of the label with the given text,
makeDelimitedTextPainter(String text, {required String delimiter, required TextStyle primaryStyle, required TextStyle secondaryStyle}) TextPainter
Constructs a TextPainter by splitting text on the first occurrence of delimiter and applying primaryStyle to the part before it and secondaryStyle to the delimiter and the part after it.
makeFittedTextPainter(String text, TextStyle style, {required double maxWidth, required double maxHeight}) TextPainter
Constructs a text painter that fits within the given bounds by scaling the font size down if necessary (never scales up).
makeTextPainter(String text, TextStyle style) TextPainter
Constructs a text painter and performs layout.
minCandleDurationForDataFit(Duration entriesDuration, double chartWidth, double chartDefaultIntervalWidth) Duration
Minimum candle duration with which entriesDuration can fit into available width in data fit mode.
paintCheckpointLine(Canvas canvas, Size size, ChartMarker marker, Offset anchor, MarkerStyle style, ChartTheme theme, double zoom, double opacity, MarkerProps props) → void
Renders a vertical dashed line with optional text to indicate a checkpoint.
paintEndMarker(Canvas canvas, ChartTheme theme, Offset center, Color color, double zoom) → void
Renders a flag-shaped marker to indicate the end or expiry point of a contract.
paintHorizontalDashedLine(Canvas canvas, double lineStartX, double lineEndX, double lineY, Color lineColor, double lineThickness, {double dashWidth = 3, double dashSpace = 3}) → void
Paints a horizontal dashed-line for the given parameters.
paintStartLine(Canvas canvas, Size size, ChartMarker marker, Offset anchor, MarkerStyle style, ChartTheme theme, double zoom, double opacity, MarkerProps props) → void
Renders a vertical dashed line with a stopwatch icon to indicate the start time of a contract.
paintStartMarker(Canvas canvas, Offset offset, Color color, double iconSize) → void
Renders a location pin icon to indicate the start point of a contract.
paintText(Canvas canvas, {required String text, required Offset anchor, required TextStyle style, Alignment anchorAlignment = Alignment.center}) → void
Paints text on the canvas.
paintVerticalDashedLine(Canvas canvas, double lineX, double lineTopY, double lineBottomY, Color lineColor, double lineThickness, {double dashWidth = 3, double dashSpace = 3}) → void
Paints a vertical dashed-line for the given parameters.
paintVerticalLine(Canvas canvas, Offset point1, Offset point2, Color color, double lineThickness, {double dashWidth = 3, double dashSpace = 3}) → void
Renders a vertical dashed line between two points on the chart.
paintWithTextPainter(Canvas canvas, {required TextPainter painter, required Offset anchor, Alignment anchorAlignment = Alignment.center}) → void
Paints on the canvas with the given text painter.
safeMax(double a, double b) double
Returns a safe maximum with considering each value other than double.nan.
safeMin(double a, double b) double
Returns a safe minimum with considering each value other than double.nan.

Typedefs

CreateAddOn<T extends AddOnConfig> = T Function(Map<String, dynamic> map)
Called to create an AddOnConfig object from a map.
EpochFromX = int Function(double)
Conversion function to convert canvas X to epoch value.
EpochToX = double Function(int)
Conversion function to convert epoch value to canvas X.
GetConfigsList = List<AddOnConfig>? Function()
To get overlay/bottom configs
GetEpochFromX = int? Function(double)
To get epoch
GetMsPerPx = double Function()
To get msPerPx
GetQuoteFromY = double? Function(double)
To get quote
GetSeriesList = List<Series>? Function()
To get overlay/bottom series
GetXFromEpoch = double? Function(int)
To get X position
GetYFromQuote = double? Function(double)
To get Y position
OnAssetClicked = void Function({required Asset asset, required bool favouriteClicked})
Handles the tap on Asset in market selector.
OnCompleteTickAnimation = void Function()
Callback to complete the current tick animation immediately.
OnCrosshairHover = void Function(Offset globalPosition, Offset localPosition, EpochToX epochToX, QuoteToY quoteToY, EpochFromX epochFromX, QuoteFromY quoteFromY)
Called when the crosshair is moved
OnCrosshairHoverCallback = void Function(Offset globalPosition, Offset localPosition, EpochToX epochToX, QuoteToY quoteToY, EpochFromX epochFromX, QuoteFromY quoteFromY, AddOnConfig? config)
Called when the crosshair is moved
OnDeleteAddOn<T extends AddOnConfig> = dynamic Function(T item, int index)
Called when an add-on is deleted from the repository.
OnEditAddOn = dynamic Function(int index)
Called when the edit icon is clicked on an add-on.
OnMouseEnterCallback = void Function(int index)
Callback to notify mouse enter over the addon.
OnMouseExitCallback = void Function(int index)
Callback to notify mouse exit over the addon.
OnScale = double? Function(double)
Scale callback;
OnScroll = dynamic Function(double)
Scroll callback;
OnScrollToLastTick = dynamic Function({required bool animate})
ScrollToLastTick callback.
OnSwapCallback = void Function(int index1, int index2)
Swaps two elements of a list.
QuoteFromY = double Function(double)
Conversion function to convert canvas Y to value(quote).
QuoteToY = double Function(double)
Conversion function to convert value(quote) value to canvas Y.
ToggleDataFitMode = dynamic Function({required bool enableDataFit})
Toggles data fit mode
ToggleXScrollBlock = dynamic Function({required bool isXScrollBlocked})
Toggles a horizontal scroll block
VisibleAreaChangedCallback = dynamic Function(int leftEpoch, int rightEpoch)
Called when chart is scrolled or zoomed.
VisibleQuoteAreaChangedCallback = dynamic Function(double topQuote, double bottomQuote)
Called when the quotes in y-axis is changed