Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pie chart "bleeding" issue #61

Open
RubyflameWarrior opened this issue Oct 21, 2024 · 1 comment · May be fixed by #70
Open

Pie chart "bleeding" issue #61

RubyflameWarrior opened this issue Oct 21, 2024 · 1 comment · May be fixed by #70
Assignees
Labels
👿 bug Something isn't working

Comments

@RubyflameWarrior
Copy link

When you try to create a pie chart where all the labels except one have a value of 0, the chart bugs out (as shown in the image). Below is a code sample to replicate the issue.

  cetz.canvas({
    import cetz.draw: *
    import cetz.chart

    chart.piechart(
      (
       ("Over-\nperformed", 0),
       ("Satisfactory", 0),
       ("Disabled", 0),
       ("Under-\nperformed", 10),
      ),
      start: 90deg,
      stop: 450deg,
      gap: 1deg,
      value-key: 1,
      label-key: 0,
      radius: 3.5,
      slice-style: (
       (fill: rgb("#abebb3"), stroke: none),
       (fill: rgb("#fff199"), stroke: none),
       (fill: luma(86.67%), stroke: none),
       (fill: rgb("#ff4136"), stroke: none),
      ),
      inner-radius: 0,
      inner-label: (
        content: "%",
        radius: 120%
      ),
      outer-label: (
        content: (value, label) => {
          let string = label + " (" + str(value)
          string = string.replace(" ", "\n")
          string = string + " " + "mts" + ")"
          align(center)[#string]
        },
        radius: 125%
      )
    )
  })

image

@johannes-wolf johannes-wolf transferred this issue from cetz-package/cetz Oct 21, 2024
@johannes-wolf johannes-wolf added the 👿 bug Something isn't working label Oct 21, 2024
@johannes-wolf johannes-wolf self-assigned this Oct 21, 2024
@johannes-wolf
Copy link
Member

Note: The 0% slices are to blame.

@johannes-wolf johannes-wolf linked a pull request Oct 25, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
👿 bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants