LineTouchTooltipData constructor

const LineTouchTooltipData({
  1. double tooltipRoundedRadius = 4,
  2. EdgeInsets tooltipPadding = const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
  3. double tooltipMargin = 16,
  4. FLHorizontalAlignment tooltipHorizontalAlignment = FLHorizontalAlignment.center,
  5. double tooltipHorizontalOffset = 0,
  6. double maxContentWidth = 120,
  7. GetLineTooltipItems getTooltipItems = defaultLineTooltipItem,
  8. GetLineTooltipColor getTooltipColor = defaultLineTooltipColor,
  9. bool fitInsideHorizontally = false,
  10. bool fitInsideVertically = false,
  11. bool showOnTopOfTheChartBoxArea = false,
  12. double rotateAngle = 0.0,
  13. BorderSide tooltipBorder = BorderSide.none,
})

if LineTouchData.handleBuiltInTouches is true, LineChart shows a tooltip popup on top of spots automatically when touch happens, otherwise you can show it manually using LineChartData.showingTooltipIndicators. Tooltip shows on top of spots, with getTooltipColor as a background color, and you can set corner radius using tooltipRoundedRadius. If you want to have a padding inside the tooltip, fill tooltipPadding, or If you want to have a bottom margin, set tooltipMargin. Content of the tooltip will provide using getTooltipItems callback, you can override it and pass your custom data to show in the tooltip. You can restrict the tooltip's width using maxContentWidth. Sometimes, LineChart shows the tooltip outside of the chart, you can set fitInsideHorizontally true to force it to shift inside the chart horizontally, also you can set fitInsideVertically true to force it to shift inside the chart vertically.

Implementation

const LineTouchTooltipData({
  this.tooltipRoundedRadius = 4,
  this.tooltipPadding =
      const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
  this.tooltipMargin = 16,
  this.tooltipHorizontalAlignment = FLHorizontalAlignment.center,
  this.tooltipHorizontalOffset = 0,
  this.maxContentWidth = 120,
  this.getTooltipItems = defaultLineTooltipItem,
  this.getTooltipColor = defaultLineTooltipColor,
  this.fitInsideHorizontally = false,
  this.fitInsideVertically = false,
  this.showOnTopOfTheChartBoxArea = false,
  this.rotateAngle = 0.0,
  this.tooltipBorder = BorderSide.none,
});