Default style can't handle responsive resize
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 10.5k
- Forks
- 463
- PR merge metrics
- No merged PRs in 30d
Description
See minimal repro at https://emil.fi/p/uplotissue/
Something like:
*
{
box-sizing: border-box;
margin: 0;
padding: 0;
}
body
{
display: grid;
grid-template-rows: auto 1fr auto;
grid-template-columns: 1fr;
grid-template-areas: "title" "plot" "footer";
}
and then handling resize
let resize=()=>{let box=plot.getBoundingClientRect(); uplot.setSize({width: box.width, height: box.height});};
and then resizing the page grows the uplot element unboundedly because the setSize is applied to an inner element, while there's still the legend etc which take space.
Please update styling or setSize so that the size given is for the element, or advise if this should be handled differently, thanks!
This is possibly fixable by either guaranteeing that the u-wrap class is singular, or giving that an id to check the size against, etc, but it's all pretty kludge to do like that.
setSize should be the size I want to give to the element, and uPlot should handle separating that for the plot area and the legends etc itself.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the minimal reproduction and the resize handler shown in the issue, then trace how setSize applies dimensions to the uPlot element and its u-wrap container. Check how the legend and plot area contribute to sizing. Done means responsive resizing no longer grows the element unboundedly and setSize dimensions describe the element as requested.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- data-visualization, frontend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100