tooltipInfo method
TooltipInfo?
tooltipInfo(
{ - Offset? position,
- int? pointIndex,
})
Implementation
TooltipInfo? tooltipInfo({Offset? position, int? pointIndex}) {
for (final int segmentIndex in trendSegmentIndexes) {
pointIndex ??= segmentIndex;
final CartesianChartPoint<dynamic> chartPoint = _chartPoint(pointIndex);
final ChartMarker marker =
_markers.isNotEmpty ? _markers[pointIndex] : ChartMarker();
final double markerHeight =
markerSettings.isVisible ? marker.height / 2 : 0;
final Offset preferredPos = _points[pointIndex];
return TrendlineTooltipInfo(
primaryPosition:
localToGlobal(preferredPos.translate(0, -markerHeight)),
secondaryPosition:
localToGlobal(preferredPos.translate(0, markerHeight)),
text: series!.tooltipText(chartPoint),
header: series!.parent!.tooltipBehavior!.shared
? series!.tooltipHeaderText(chartPoint)
: series!.name,
data: series!.dataSource![pointIndex],
point: chartPoint,
series: series!.widget,
renderer: series!,
seriesIndex: series!.index,
segmentIndex: segmentIndex,
pointIndex: pointIndex,
markerColors: <Color?>[color],
markerType: marker.type,
);
}
return null;
}