defaultTouchedIndicators function
List<TouchedSpotIndicatorData>
defaultTouchedIndicators(
- LineChartBarData barData,
- List<
int> indicators
Default presentation of touched indicators.
Implementation
List<TouchedSpotIndicatorData> defaultTouchedIndicators(
LineChartBarData barData,
List<int> indicators,
) {
return indicators.map((int index) {
/// Indicator Line
var lineColor = barData.gradient?.colors.first ?? barData.color;
if (barData.dotData.show) {
lineColor = _defaultGetDotColor(barData.spots[index], 0, barData);
}
const lineStrokeWidth = 4.0;
final flLine = FlLine(color: lineColor, strokeWidth: lineStrokeWidth);
var dotSize = 10.0;
if (barData.dotData.show) {
dotSize = 4.0 * 1.8;
}
final dotData = FlDotData(
getDotPainter: (spot, percent, bar, index) =>
_defaultGetDotPainter(spot, percent, bar, index, size: dotSize),
);
return TouchedSpotIndicatorData(flLine, dotData);
}).toList();
}