Skip to content

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

@InsoooooooooJANG

Description

@InsoooooooooJANG

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:

// 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,
        ),
      ),
    ],
  ),
)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions