Page MenuHomePhabricator

Fix dimensions of rendered HTML to fit the dynamic contents
Open, Needs TriagePublic


Currently a graph tag needs to manually be provided with the correct dimensions. These dimensions can only be derived from the JS rendered graph. But there is no easy way for editors to find these dimensions unless you know how to use a web inspector.

Add a piece of JS which checks the provided dimensions with the actual dimensions after load and then throw a mw.notify when the code is being previewed, to tell the user about the correct dimensions. It's ugly, but I see no better way.

Investigation: Right this cannot work, because Vega2 doesn't support it yet. When we switch to newer versions, we should inject:

"autosize": {
  "type": "fit",
  "contains": "padding"

That should make it adhere to specified width and height. We also need to consider responsive sizing (width="contains") and how to handle that in the future.

Event Timeline

TheDJ renamed this task from Add dimensions mismatch check to JS loader of graphs to Fix dimensions of rendered HTML to fit the dynamic contents.Jan 21 2022, 12:40 PM
TheDJ updated the task description. (Show Details)