Skip to content

Conversation

@LordBaryhobal
Copy link
Contributor

Pyramid Charts

This pull request adds a new chart type: pyramid charts
This allows the user to show their data in a qualitative diagram

I have tried to make it as flexible as possible to include most use cases

I haven't written any tests for the moment, as I am not familiar with unit tests in Typst. Any help would be appreciated

Features

  • Side labels: in addition to inner labels, the user can add labels on the side of the pyramid (west or east)
  • Automatic label placement: by default, if an inner label doesn't fit in its level, it is moved outside the pyramid and linked with a small line to improve readability. This behavior can be disabled with the inner-label.force-inside parameter
  • Gaps: the user can add gaps in between levels. (If the mode is AREA-HEIGHT, the value is a ratio, and gaps are hence proportional to the topmost level's height)
  • Modes:
    • REGULAR (default): Regular pyramid, all levels are the same height, the pyramid is a perfect equilateral triangle
    • WIDTH: All levels are the same height. The topmost level is an equilateral triangle. Each following level's base width is then proportional to its value (higher value => larger base)
    • HEIGHT: The pyramid is a perfect equilateral triangle, but each level's height is proportional to its value
    • AREA-HEIGHT: The pyramid is a perfect equilateral triangle, but each level's area is proportional to its value (only the height is adapted)

Examples

Mode: REGULAR

example1

Mode: WIDTH

example2

Mode: HEIGHT

example3

Mode: AREA-HEIGHT

example4

@johannes-wolf johannes-wolf self-requested a review November 9, 2024 23:24
@johannes-wolf johannes-wolf added the 🎁 feature New feature or request label Nov 9, 2024
@johannes-wolf
Copy link
Member

Thank you, looks great! We can add tests in a follow-up PR.

@johannes-wolf johannes-wolf merged commit 414eae7 into cetz-package:master Nov 21, 2024
1 check passed
@johannes-wolf
Copy link
Member

johannes-wolf commented Nov 21, 2024

I've opened a PR with some simple tests here: #90

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🎁 feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants