customizeSegment method

  1. @override
void customizeSegment(
  1. ChartSegment _segment
)
override

Changes the series color, border color, and border width.

Implementation

@override
void customizeSegment(ChartSegment _segment) {
  _candleSeries = _series as CandleSeries<dynamic, dynamic>;
  _candelSereisRenderer = _segment._seriesRenderer as CandleSeriesRenderer;
  _candleSegment = _candelSereisRenderer._candleSegment;

  if (_candleSeries.enableSolidCandles!) {
    _candleSegment._isSolid = true;
    _candleSegment._color = _candleSegment._isBull
        ? _candleSeries.bullColor
        : _candleSeries.bearColor;
  } else {
    _candleSegment._isSolid = !_candleSegment._isBull;
    _candleSegment.currentSegmentIndex! - 1 >= 0 &&
            (_candleSegment
                        ._seriesRenderer
                        ._dataPoints[_candleSegment.currentSegmentIndex! - 1]
                        .close >
                    _candleSegment
                        ._seriesRenderer
                        ._dataPoints[_candleSegment.currentSegmentIndex!]
                        .close) ==
                true
        ? _candleSegment._color = _candleSeries.bearColor
        : _candleSegment._color = _candleSeries.bullColor;
  }
  _segment._strokeWidth = _segment._series.borderWidth;
}