Skip to content

Transparent background causes double rendering with square axis rules #5026

@diluculo

Description

@diluculo

ScottPlot Version: (What NuGet package are you using?)

  • Platform: WinUI 3
  • ScottPlot.WinUI 5.0.55

Issue:
When using transparent backgrounds in WinUI 3, applying any IAxisRule (SquareZoomOut, SquarePreserveX, SquarePreserveY, AutoSquare from #5021) causes plot frames to accumulate instead of being properly cleared.

Reproduction:

  1. Set plot.FigureBackground.Color = ScottPlot.Colors.Transparent
  2. Apply any IAxisRule → Frame accumulation occurs immediately
  3. Same rules work perfectly with solid backgrounds

Expected: Clean single plot rendering
Actual: Two overlapping plot frames visible

Evidence:

  • Solid background + IAxisRule: Works perfectly
  • Transparent background + IAxisRule: Frame accumulation
  • Transparent background + no rules: Works fine

Sample Project: [Attached WinUI3 project demonstrating the issue]
SquareOptimal.zip

After launch, selecting "SquarePreserveX" immediately produces the following double rendering:

Image

Questions:

  1. Is this a known limitation of transparent rendering with square axis rules? (Tested on WinUI3, but likely affects WPF as well)
  2. What would be the recommended workaround for transparent backgrounds with axis rules?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions