[Feature Request] Add FlDotImagePainter to support custom image dot markers
- Dominant language
- Dart
- Stars
- 7.6k
- Forks
- 2k
- Avg merge
- 9d 1h
- Merged PRs (30d)
- 2
Description
**Is your feature request related to a problem? Please describe.**
Currently, fl_chart only supports basic geometric shapes (circle, square, cross) for dot markers on line charts through `FlDotCirclePainter`, `FlDotSquarePainter`, and `FlDotCrossPainter`.
However, many use cases require custom visual markers such as:
- User profile pictures on activity charts
- Product icons on sales trend charts
- Custom branded icons for different data series
- Weather icons on temperature charts
There's no built-in way to use custom images as dot markers, forcing developers to either:
1. Use the limited geometric shapes
2. Implement complex custom painters from scratch
3. Use workarounds that don't integrate well with the existing dot system
**Describe the solution you'd like**
I propose adding a `FlDotImagePainter` class that extends `FlDotPainter` to support rendering custom images as dot markers.
**Proposed API:**
```dart
// Load image asynchronously
final image = await FlDotImagePainter.loadImageFromAsset('assets/icon.png');
final painter = FlDotImagePainter(image: image, size: 20.0);
// Use in chart
LineChart(
LineChartData(
lineBarsData: [
LineChartBarData(
dotData: FlDotData(
show: true,
getDotPainter: (spot, percent, barData, index) => painter,
),
),
],
),
)
Contributor guide
Research direction
Start by reading the existing FlDotPainter, FlDotCirclePainter, FlDotSquarePainter, and FlDotCrossPainter entry points, then review how LineChartBarData and FlDotData provide dot painters. Define the image-loading and rendering behavior described in the proposal, and consider the feature done when custom asset images can be used as line-chart dot markers through the proposed API.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- dart, flutter
- Domain
- mobile
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100