question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

TreeMap Datalabels

See original GitHub issue

Hello, I’m wondering the best solution to working with datalabels in the treemap. Ideally, I’d like for the labels to be shown in the box if the box is large enough compared to the text length and if not, cut off the text and show ellipsis using text-overflow: ellipsis.

I’m using ResponsiveTreeMapHtml. Would appreciate some help here. An example of text that I’d like “ellipsed”

image

I’ve tried label={(val1)=> {return <div className="treemap-datalabels">{val1.name}</div>}}

.treemap-datalabels {
  text-overflow: ellipsis !important;
  text-align: left;
  padding-left: 4px;
}

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
ccoelh0commented, Sep 27, 2022

I found this solution: you can use the prop label and trim the text that is rendered.

const modifyLabel = (data) => { 
   const labelSize = data.id.length 
   const positionToSlice = 10
   return data.id.slice(0, positionToSlice)
   
}

return (
<TreeMap
          data={dataGraph}
          identity="name"
          value="value"
          margin={{top: 10, right: 10, bottom: 10, left: 10}}
          label={modifyLabel}
  ... />)
1reaction
cnaresh7commented, Nov 19, 2021

bump

Read more comments on GitHub >

github_iconTop Results From Across the Web

plotOptions.treemap.dataLabels | highcharts API Reference
plotOptions.treemap.dataLabels. Options for the series data labels, appearing next to each data point. Since v6.2.0, multiple data labels can be applied to ...
Read more >
How can I get treemap datalabels to wrap consistently?
I'm making a Highcharts treemap with some rather long datalabels. Sometimes they wrap, sometimes highcharts truncates them with ellipses ...
Read more >
Data Label in JavaScript TreeMap control - Syncfusion
Data Labels are used to identify the name of items or groups in the TreeMap component. Data Labels will be shown by specifying...
Read more >
Treemap data labels won't edit - Microsoft Community
I am trying to edit a data label on an Excel treemap. Usually on a chart I can double click on a data...
Read more >
Treemap: data label exceeds point's boundaries #8160 - GitHub
Expected behaviour Data label shouldn't exceed the boundaries of its point. The overflow should be handled somehow (e.g. by ellipsis crop).
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found