Skip to content

Table: Adding a bold cell value changes the line height #3694

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

Closed
AbdealiLoKo opened this issue Mar 29, 2019 · 6 comments
Closed

Table: Adding a bold cell value changes the line height #3694

AbdealiLoKo opened this issue Mar 29, 2019 · 6 comments

Comments

@AbdealiLoKo
Copy link

I was trying to make a table where any value that goes above 100 I was setting to bold so it is immediately visible.
I found that while I was implementing this, when I set the value of a cell to bold, the row width is changing. Which make the table look very very weird ...

Screen Shot 2019-03-29 at 2 47 52 PM

Screen Shot 2019-03-29 at 2 47 58 PM

@AbdealiLoKo
Copy link
Author

nums = [...new Array(5).keys()]
cells = nums.map((x) => ['1', '2', '3'])
cells[0][0] = '<b>1</b>'
Plotly.newPlot(
  'graph',
  [{'cells': {'values': cells},
   'header': {'values': nums.map((x) => `col${x}`)},
   'type': 'table'}],
  {});

https://codepen.io/AbdealiJK/pen/KYPVoX

@etpinard
Copy link
Contributor

etpinard commented Apr 1, 2019

Thanks for the report.

What's the desired behavior here in your mind? I don't think it would be wise to ignore the fact that bold text leads to bigger bounding rectangles. So, should we add a mode where all rows get the height of the largest row?

@AbdealiLoKo
Copy link
Author

That's a good point. I think there are two options that seem to be intuitive:

  • increase the row height for all the rows by the number of pixels that bold increases the font
  • decrease the box padding on the bold cell

I think HTML, excel, etc. do the latter - which seems to be the one prefer.

I.e. If the font size is 15 and the table cell height is 15 - doing a bold would make it overlap a bit - which makes sense in my opinion.

@etpinard
Copy link
Contributor

etpinard commented Jul 4, 2019

related: #2056

@Lucianod28
Copy link

Has anybody found a workaround to fix the cell height regardless of the contents?

@gvwilson
Copy link
Contributor

Hi - we are currently trying to tidy up Plotly's public repositories to help us focus our efforts on things that will help users most. Since this issue has been sitting for several years, I'm going to close it. If it's still a concern, we'd be grateful if you could open a new issue (with a short reproducible example if appropriate) so that we can add it to our backlog. Thanks for your help - @gvwilson

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

No branches or pull requests

4 participants