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

XY Chart: enhancement: support /n, <br>, or automatic wrapping in X labels #5691

Open
JPHutchins opened this issue Aug 5, 2024 · 2 comments
Labels
Status: Triage Needs to be verified, categorized, etc Type: Bug / Error Something isn't working or is incorrect

Comments

@JPHutchins
Copy link

JPHutchins commented Aug 5, 2024

Description

Sometimes, chart labels may look better when spanning multiple lines. It would be nice to support /n, <br>, or maybe wrap automatically instead of running into the next label.

Steps to reproduce

  1. Add long labels to an XY Chart
  2. Try \n, <br>, &#10;, &#13;, etc. to break a long label to a newline

Screenshots

---
config:
    xyChart:
        xAxis:
            labelFontSize: 12
---
xychart-beta 
    title "Zephyr Benchmark"
    x-axis "Platform" ["Ubuntu 24.04 6.8", "WSL2 Ubuntu 24.04 5.15", "WSL2 Ubuntu 24.04 6.1", "macOS Sonoma*", "Windows 11", "VMWare (no AMD-V) Ubuntu Server 24.04 6.8" ]
    y-axis "Duration in seconds (lower is better)" 0 --> 1680
    bar [664.44, 754.642, 723.323, 741.547, 1393.901, 1655.560]
Loading

Code Sample

---
config:
    xyChart:
        xAxis:
            labelFontSize: 12
---
xychart-beta 
    title "Zephyr Benchmark"
    x-axis "Platform" ["Ubuntu 24.04 6.8", "WSL2 Ubuntu 24.04 5.15", "WSL2 Ubuntu 24.04 6.1", "macOS Sonoma*", "Windows 11", "VMWare (no AMD-V) Ubuntu Server 24.04 6.8" ]
    y-axis "Duration in seconds (lower is better)" 0 --> 1680
    bar [664.44, 754.642, 723.323, 741.547, 1393.901, 1655.560]

Setup

  • Mermaid version: 10.9.1

Suggested Solutions

No response

Additional Context

Mermaid rocks!

@JPHutchins JPHutchins added Status: Triage Needs to be verified, categorized, etc Type: Bug / Error Something isn't working or is incorrect labels Aug 5, 2024
@peter-yanase
Copy link

peter-yanase commented Sep 18, 2024

As a temporary solution: you can render it correctly horizontally.

---
config:
    xyChart:
        xAxis:
            labelFontSize: 12
---
xychart-beta horizontal
    title "Zephyr Benchmark"
    x-axis "Platform" ["Ubuntu 24.04 6.8", "WSL2 Ubuntu 24.04 5.15", "WSL2 Ubuntu 24.04 6.1", "macOS Sonoma*", "Windows 11", "VMWare (no AMD-V) Ubuntu Server 24.04 6.8" ]
    y-axis "Duration in seconds (lower is better)" 0 --> 1680
    bar [664.44, 754.642, 723.323, 741.547, 1393.901, 1655.560]
Loading

@PatLittle
Copy link

Wondering if a parameter to rotate the axis labels could also be considered as part of the feature? For example vega-lite has the labelAngle param.
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Triage Needs to be verified, categorized, etc Type: Bug / Error Something isn't working or is incorrect
Projects
None yet
Development

No branches or pull requests

3 participants