BubbleChartWidget constructor
BubbleChartWidget({
- Key? key,
- required List<
BubbleDataSet> dataSets, - double minBubbleSize = 5.0,
- double maxBubbleSize = 30.0,
- bool showGrid = true,
- bool showAxis = true,
- bool showLabel = true,
- String? title,
- String? subtitle,
- Widget? header,
- BubbleTapCallback? onBubbleTap,
- BubbleHoverCallback? onBubbleHover,
- ChartTapCallback? onChartTap,
- bool isLoading = false,
- bool isError = false,
- double? height,
- EdgeInsets? padding,
- EdgeInsets? margin,
- 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:
dataSetsis emptyminBubbleSizeis not positivemaxBubbleSizeis not greater thanminBubbleSize
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');