home / github / issue_comments

Menu
  • Search all tables
  • GraphQL API

issue_comments: 357312127

This data as json

html_url issue_url id node_id user created_at updated_at author_association body reactions performed_via_github_app issue
https://github.com/pydata/xarray/pull/1820#issuecomment-357312127 https://api.github.com/repos/pydata/xarray/issues/1820 357312127 MDEyOklzc3VlQ29tbWVudDM1NzMxMjEyNw== 4160723 2018-01-12T18:07:25Z 2018-01-12T18:07:25Z MEMBER

The sizing of variable name and dimensions columns according to their content is tricky because (1) we want these columns be aligned between different sections (Coordinates and Data variables) and also aligned with the list of dimension labels in the Dimension section, (2) there are subsections for variable attributes and data repr, which both take 100 % width and (3) we want the sections and subsections to be collapsible/expandable but we are limited by a pure html/css solution.

While using <table> is usually appropriate for rendering that kind of content, for the reasons above I don't think it is possible here, unfortunately. Unless someone has a better idea, I don't see any other option than calculating a fixed size for the columns before rendering.

But I don't see neither any robust way to calculate these sizes. One option could be to use tkinter, e.g.,

```python

import tkinter as tk from tkinter import font tk.Tk() root = tk.Tk() front_end_font = font.Font(family='Helvetica', size=11, weight='bold') front_end_font.measure("variable_name") 76 root.destroy() ```

That's not very elegant to say the least, but it has the advantage of being part of the Python standard library. The problem is that we don't know the font-family and font-size. We could define it explicitly in the CSS code but it's better to inherit it from the notebook front-ends (in some cases it is dynamically defined, e.g., the jupyterlab presentation mode). So a workaround might be to use a common font which has wide characters to calculate the width + add a good safety margin.

If anyone has a better idea, e.g., a layout using some kind of smart CSS grid system... that would be great!

@rgbkrk? @ellisonbg?

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  287844110
Powered by Datasette · Queries took 0.813ms · About: xarray-datasette