-
From the docs:
I need to be able to do the same for my own plots outside of the Observable website. Is there a way to do that right now? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 6 replies
-
There are as many ways as there are frameworks. In vanilla JavaScript, you might want to listen to the resize event and refresh the plot: doChart();
window.addEventListener("resize", doChart);
function doChart() {
document.querySelector("#chart").innerHTML = "";
document
.querySelector("#chart")
.appendChild(
Plot.plot({ marks: [Plot.frame()], width: window.innerWidth })
);
}); |
Beta Was this translation helpful? Give feedback.
-
Thanks for posting that. Would it also be an idea to have an option that set the SVG width to 100% the size of the container rather than a specific width. That would be super useful. |
Beta Was this translation helpful? Give feedback.
Thanks for posting that.
Would it also be an idea to have an option that set the SVG width to 100% the size of the container rather than a specific width. That would be super useful.