CandlestickChart
How to use
CandlestickChart(
CandlestickChartData(
// read about it in the CandlestickChartData section
),
duration: Duration(milliseconds: 150), // Optional
curve: Curves.linear, // Optional
);
Implicit Animations
When you change the chart's state, it animates to the new state internally (using implicit animations). You can control the animation duration and curve using optional duration and curve properties, respectively.
CandlestickChartData
Contains the data for the candlestick chart.
Each CandlestickSpot represents a candlestick in the chart
that contains CandlestickSpot.open, CandlestickSpot.high,
CandlestickSpot.low and CandlestickSpot.close values.
The painter used to draw the candlestick.
You can use the DefaultCandlestickPainter or implement your own.
Holds data to draw the titles around the chart, see FlTitlesData.
Handles touch behaviors and responses.
you can show some tooltipIndicators (a popup with an information)
on top of each CandlestickSpot using showingTooltipIndicators,
just put indices you want to show it on top of them.
An important point is that you have to disable the default touch behaviour
to show the tooltip manually, see CandlestickTouchData.handleBuiltInTouches.
Holds data to draw the grid lines behind the chart, see FlGridData.
Holds data to draw the border around the chart, see FlBorderData.
Minimum x value of the chart. If you don't provide it, it is calculated from the chart's data (providing it is more performant).
Maximum x value of the chart. If you don't provide it, it is calculated from the chart's data (providing it is more performant).
The x value that the vertical grid lines and the titles are aligned to,
they are drawn at every baselineX + n * interval.
Minimum y value of the chart. If you don't provide it, it is calculated from the chart's data (providing it is more performant).
Maximum y value of the chart. If you don't provide it, it is calculated from the chart's data (providing it is more performant).
The y value that the horizontal grid lines and the titles are aligned to,
they are drawn at every baselineY + n * interval.
Highlights some horizontal or vertical ranges behind the chart,
see RangeAnnotations.
Clips the chart to its border (prevents drawing outside of the border),
see FlClipData.
A background color which is drawn behind the chart.
Rotates the chart 90 degrees (clockwise) in every quarter turn.
It works like the RotatedBox widget.
Shows an indicator on the touched / hovered point
We manage to set it by default
when CandlestickTouchData.handleBuiltInTouches is true,
so nothing happens if you change this property as long as
the handleBuiltInTouches property is true.
But you can set CandlestickTouchData.handleBuiltInTouches to false
if you want to have customized touchedPointIndicator
CandlestickSpot
The x value of the spot, on the horizontal axis (from left to right).
The open value of the candlestick, see the OHLC standard.
The highest value of the candlestick (the top of its wick).
The lowest value of the candlestick (the bottom of its wick).
The close value of the candlestick, see the OHLC standard.
Determines show or hide the spot.
CandlestickTouchData (read about touch handling)
Determines whether to enable or disable touch behaviors.
touchCallback notifies you about the happened touch/pointer events.
It gives you a FlTouchEvent which is the happened event such as FlPointerHoverEvent, FlTapUpEvent, ...
It also gives you a BaseTouchResponse which is the chart specific type and contains information
about the elements that has touched.
Using mouseCursorResolver you can change the mouse cursor
based on the provided FlTouchEvent and BaseTouchResponse
This property that allows to customize the duration of the longPress gesture. If null, it uses kLongPressTimeout (500 milliseconds).
Determines how the tooltip looks on top of the touched candlestick,
see CandlestickTouchTooltipData.
If true, the chart handles touches by itself: it shows a tooltip bubble and an indicator on the touched (or hovered) candlestick.
Extends the touchable area of each candlestick by this distance (in pixels).
CandlestickTouchTooltipData
Sets a border radius for the tooltip.
Applies a padding for showing contents inside the tooltip.
Controls showing tooltip on left side, right side or center aligned with spot.
Applies horizontal offset for showing tooltip.
Maximum width of the tooltip's content, a text row which is wider than this breaks into a new line.
getTooltipItemsCandlestickTooltipItem? Function(FlCandlestickPainter, CandlestickSpot, int)?#defaultdefaultCandlestickTooltipItemRetrieves data for showing content inside the tooltip.
Forces the tooltip to shift horizontally inside the chart, if overflow happens.
Forces the tooltip to shift vertically inside the chart, if overflow happens.
Forces the tooltip container to top of the line, default 'false'
Controls the rotation of the tooltip.
Border of the tooltip bubble.
Retrieves the background color of the tooltip for each touched candlestick.
CandlestickTooltipItem
Showing text.
Style of showing text.
Defines bottom space from spot.
TextAlign of the showing content.
Direction of showing text.
Add further style and format to the text of the tooltip
CandlestickTouchResponse
you can listen to touch behaviors callback and retrieve this object when any touch action happened.
The location of the touch in pixels on the screen.
The axis coordinate of the touch in chart's coordinate system.
The touched spot, null if no candle is touched.
CandlestickTouchedSpot
some samples
Sample 1 (Source Code)
