Skip to content

Conversation

@mabolen
Copy link
Contributor

@mabolen mabolen commented Jul 12, 2023

New Pull Request

FIxes #3914

If accepted, this PR will:

  • Add dataLabels field to treemap plotOptions: dataLabels?: { format?: 'scale' | 'truncate' }
  • Add new method that will truncate label text after formatter has been applied, based on config
  • Utilize existing methods/utils such as getTextBasedOnMaxWidth and rotateToFitLabel
  • Update rotateToFitLabel to improve vertical alignment and appearance of larger truncated labels

Motivation and Context

Treemaps with dynamic label lengths can easily become unreadable when they are long with the current fontSize scaling method. Users should have access to a config option where a label uses a consistent font size and will automatically trim/truncate itself to fit within its rect.

Type of change

  • New feature (non-breaking change which adds functionality)
  • This change requires a documentation update

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

Examples:

Current behavior (scaling font-size with long labels):

long_labels

New behavior with truncated labels:

truncated

@mabolen mabolen changed the title Feature/trimmed treemap labels Feat: trimmed treemap labels Jul 12, 2023
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.

Treemap charts with long labels should have the option to be trimmed

2 participants