Layout Width as % of Container
sdmcallister opened this issue · comments
Steve commented
I have a karax widget where I want to embed a plot but I want the plot width to be responsive to the container.
I think this might be achieved by adding a config param:
https://plotly.com/javascript/responsive-fluid-layout/
Karax Widget.
proc renderPlotlyCard(title, subtitle, body: string): VNode =
result = buildHtml(tdiv(class="card")):
h2: text title
h5: text subtitle
tdiv(id="plot0", style="height:400px;width:100%;".toCss)
verbatim(doPlot())
p: text body
The doPlot proc just returns:
"""<script>
Plotly.newPlot('plot0', $1, $2)
</script>""" % [parseTraces(p.traces), $(%p.layout)]
Steve commented
I just saw the autosize option. Thank you. Great library btw.