Skip to content

Default style can't handle responsive resize #1075

@emilfihlman

Description

@emilfihlman

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions