BubbleChartWidget constructor

BubbleChartWidget({
  1. Key? key,
  2. required List<BubbleDataSet> dataSets,
  3. double minBubbleSize = 5.0,
  4. double maxBubbleSize = 30.0,
  5. bool showGrid = true,
  6. bool showAxis = true,
  7. bool showLabel = true,
  8. String? title,
  9. String? subtitle,
  10. Widget? header,
  11. Widget? footer,
  12. BubbleTapCallback? onBubbleTap,
  13. BubbleHoverCallback? onBubbleHover,
  14. ChartTapCallback? onChartTap,
  15. bool isLoading = false,
  16. bool isError = false,
  17. double? height,
  18. EdgeInsets? padding,
  19. EdgeInsets? margin,
  20. ChartsConfig? config,
})

Creates a bubble chart widget.

dataSets must not be empty. Each dataset must contain at least one bubble data point. Theme is optional and will be inferred from the Material theme if not provided.

minBubbleSize and maxBubbleSize control the visual size range of bubbles. The actual bubble sizes will be scaled proportionally within this range based on the data values.

Throws an AssertionError if:

  • dataSets is empty
  • minBubbleSize is not positive
  • maxBubbleSize is not greater than minBubbleSize

Example

BubbleChartWidget(
  dataSets: myBubbleDataSets,
  minBubbleSize: 5.0,
  maxBubbleSize: 30.0,
  onBubbleTap: handleBubbleTap,
  onChartTap: (position) {
    // Handle background tap
  },
)

Implementation

BubbleChartWidget({
  super.key,
  required this.dataSets,
  this.minBubbleSize = 5.0,
  this.maxBubbleSize = 30.0,
  this.showGrid = true,
  this.showAxis = true,
  this.showLabel = true,
  this.title,
  this.subtitle,
  this.header,
  this.footer,
  this.onBubbleTap,
  this.onBubbleHover,
  this.onChartTap,
  this.isLoading = false,
  this.isError = false,
  this.height,
  this.padding,
  this.margin,
  this.config,
}) : assert(minBubbleSize > 0, 'Min bubble size must be positive'),
     assert(minBubbleSize.isFinite, 'Min bubble size must be finite'),
     assert(maxBubbleSize > minBubbleSize, 'Max must be greater than min'),
     assert(maxBubbleSize.isFinite, 'Max bubble size must be finite');