Skip to content

Conversation

@JL710
Copy link
Contributor

@JL710 JL710 commented Jun 5, 2025

  • All tests pass locally

I encountered this issue/bug:

#import "@preview/cetz:0.3.4"
#import "@preview/cetz-plot:0.1.1": chart

#cetz.canvas({
  chart.piechart(
    (
      ([], 100),
      ([], 1),
    ),
    value-key: 1,
    label-key: 0,
    radius: 4,
    slice-style: (green, red),
    inner-label: (content: (value, label) => "test", radius: 110%),
    outer-label: (content: (value, label) => "test"))
})

Screenshot_20250605_153618

As you see, the inner label for the red thing is drawn under the green area. That makes the label unreadable, which is terrible. This especially happens when having plots with very small values.

I assume it is because the green area gets drawn after the text. Changing the entire draw order could be pretty difficult. Hence, this PR changes the layer that the inner label is drawn on to 1 instead of 0, which fixes the problem.

With the fix:
Screenshot_20250605_154756

@johannes-wolf johannes-wolf merged commit e0828e5 into cetz-package:master Jun 7, 2025
1 check passed
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