Skip to content

Pie Chart Title gets cut off if too long #6232

Open
@youngcitrus

Description

Description

When the title of the pie chart is too long, the title is cropped.
Our use case involves some Generative AI to create the title and data that feeds to the charts and in some cases the titles can be lengthy.

It appears that SVG elements don't support text-wrapping or line breaks, but it would be awesome if Mermaid could handle splitting longer titles into multiple elements and adding them to the svg. For now one workaround is using CSS to make the font-size smaller, but that doesn't guarantee no title crop in the case of even lengthier titles.

Could you please provide a fix or alternative solution for this?

Steps to reproduce

Create a pie chart
Give it a long title.

Sample mermaid code in live editor:
pie title Types of industry trends in the last 12 months

Result:
Pie chart title is cropped

Expected:
Title is not cropped

Screenshots

Image

Code Sample

pie title Types of industry trends in the last 12 months

Setup

  • Mermaid version: 11
  • Browser and Version: [Chrome, Edge, Firefox] Chrome: 131.0.6778.265 (Official Build) (arm64)

Suggested Solutions

No response

Additional Context

No response

Metadata

Assignees

No one assigned

    Labels

    Status: TriageNeeds to be verified, categorized, etcType: Bug / ErrorSomething isn't working or is incorrect

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions