Skip to content

Conversation

@InsoooooooooJANG
Copy link

@InsoooooooooJANG InsoooooooooJANG commented Jan 25, 2026

🚧 Draft: Add FlDotImagePainter for custom image dot markers

Status: Work in Progress - Seeking early feedback

Description

This PR adds FlDotImagePainter, a new implementation of FlDotPainter that allows users to display custom images as dot markers on line charts, instead of the default circle, square, or cross shapes.

Motivation

Currently, fl_chart only supports basic geometric shapes for dot markers. Many users want to display custom icons or images (e.g., profile pictures, product icons) as data point markers.

Screenshots

image

Implementation Details

Core Changes

  • FlDotImagePainter class (lib/src/chart/base/axis_chart/axis_chart_data.dart)
    • Extends FlDotPainter to support image rendering
    • Includes loadImageFromAsset() helper for loading images
    • Images must be pre-loaded due to synchronous draw() method

Example

  • LineChartSample14 demonstrates the usage
  • Shows how to load images asynchronously before chart creation
  • Includes comprehensive comments for contributors

Usage Example

// Pre-load the image
final image = await FlDotImagePainter.loadImageFromAsset('assets/dot.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,
        ),
      ),
    ],
  ),
)

Related Issue

[Feature Request] Add FlDotImagePainter to support custom image dot markers

- Add FlDotImagePainter class that extends FlDotPainter
- Support rendering custom images as dot markers on charts
- Include static loadImageFromAsset() helper method
- Add LineChartSample14 to demonstrate usage
- Images must be pre-loaded asynchronously before use

This allows users to display custom images (PNG, JPG, etc.)
as dot markers instead of the default circle, square, or cross shapes.
@InsoooooooooJANG InsoooooooooJANG changed the title feat: add FlDotImagePainter for custom image dot markers Draft: add FlDotImagePainter for custom image dot markers Jan 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant