question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Displaying graphs inside `html.Details`

See original GitHub issue

If a graph is embedded in html.Details, it can’t determine it’s size: https://community.plot.ly/t/plotly-resize-bug-using-html-details-and-width-100/11201/3?u=chriddyp

Issue Analytics

  • State:open
  • Created 5 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
chriskncommented, Sep 12, 2019

I had the same issue. This javascript snipped fixed it for me. It fires a resize event everytime the user clicks on the document:

document.addEventListener("click", function(){
    window.dispatchEvent(new Event('resize'));
  }); 

Put it into a js file in the assets folder. You can attach the event to an element suitable for your usecase.

0reactions
m-gankocommented, Dec 9, 2019

Thanks @chriskn, your solution works with graphs size. But I have an issue with legend. When it is placed at the bottom of graph, when I open Details element, legend is overlapping x axis:

image

When I double click on one of the legend names it goes to the right place.

image

My legend params are: legend_orientation="h", legend=dict(x=0.5, y=-.1, xanchor='center'). When I load them outside of Details element everything is fine.

Read more comments on GitHub >

github_iconTop Results From Across the Web

HTML Graphics - W3Schools
Plotly.js is a charting library that comes with over 40 chart types, 3D charts, statistical graphs, and SVG maps. Chart.js Scatter.
Read more >
How to insert a Python graph into an HTML Web Site
A short tutorial to integrate graphs built in Altair or Plot.ly with an HTML Web site ... As many people know, Python is...
Read more >
How to Add Charts in HTML Websites (Pie Charts ... - YouTube
Chart.js | How to Add Charts in HTML Websites (Pie Charts, Line Charts, Bar Charts & More).
Read more >
Draw Charts in HTML Using Chart js - C# Corner
Here I will show how to create draw canvas based charts using the Chart.js Javascript Library.
Read more >
How To Create An Animated HTML Graph With CSS And jQuery
There are actually quite a few ways to display graphs on the Web. There are pros and cons to the wide range of...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found