Skip to content

Conversation

@ShashankSMayya
Copy link

This PR aims to add this feature #2008

Summary

Adds native, customizable hatch pattern (diagonal lines) support to ‎BarChartRodStackItem in FL Chart, allowing for visually distinctive stacked bar segments.

Main Changes

• New Properties:

▫ ‎isHatched and ‎hatchPattern on ‎BarChartRodStackItem for enabling and configuring hatching.
▫ ‎HatchPattern class supports color, background, angle, spacing, and stroke width.

• Rendering:

▫ Bar chart painter now draws hatch patterns with proper rounded clipping.

Examples & Tests:

▫ New ‎BarChartSample9 demonstrates hatching.
▫ Comprehensive tests for hatch pattern and stack item logic.

Usage

BarChartRodStackItem(
  fromY, toY, null,
  isHatched: true,
  hatchPattern: HatchPattern(
    hatchColor: Color(0xff38f3f3),
    backgroundColor: Color(0xff0293ee),
    spacing: 6.0,
    angle: -45.0,
    strokeWidth: 2.5,
  ),
)

Backwards compatible: Solid/gradient fills remain unchanged; hatching is opt-in.

Result

image

  Add diagonal line pattern rendering for bar chart stack items with height-independent visual density.
@imaNNeo
Copy link
Owner

imaNNeo commented Oct 26, 2025

Hi, thanks a lot for your contribution,
But someone is implementing it using shaders, so as it is more performant and expandable, I prefer to have that one #1958
I hope you understand the decision.

@imaNNeo imaNNeo closed this Oct 26, 2025
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.

2 participants