Black Lives Matter. Please consider donating to Black Girls Code today.
Learn how to use COVID-19 data in open source Dash apps. Register for the Sept 23rd webinar with IQT!

Resize Problem for scatter plot after Jquery document load

Hello I have a problem with the resize of my scatter plot. I have to wait for the page to load and the graph is loaded, so i wrapped it in a document.ready function, Code is below

` $(document).ready(function () {
                    var d3 = Plotly.d3;

                    var WIDTH_IN_PERCENT_OF_PARENT = 60,
                        HEIGHT_IN_PERCENT_OF_PARENT = 80;

                    var gd3 ='#timeSeriesGraph')
                            width: WIDTH_IN_PERCENT_OF_PARENT + '%',
                            'margin-left': (100 - WIDTH_IN_PERCENT_OF_PARENT) / 2 + '%'

                            height: HEIGHT_IN_PERCENT_OF_PARENT + 'vh',
                            'margin-top': (100 - HEIGHT_IN_PERCENT_OF_PARENT) / 2 + 'vh'

                    var gd = gd3.node();

                    window.addEventListener('resize', function () {

  Plotly.newPlot(targetElem, self.traces, self.layout);

TargetElem is the div i want to select, but im not able to select that div either, a lot of problems all round. I may have a special case compared to the other questions here. I appreciate any help I can get

This should be Plotly.newPlot(timeSeriesGraph, self.traces, self.layout) is you want to plot the graph in the responsive div.

Still not working, Ill show you my logic that creates the ‘targetElem’ div I want to make responsive, theres actually an enitre function that creates the dates, axis, etc, Ill attatch a JS Fiddle

JS fiddle of my entire function

Hmm. I think you pasted the wrong link

This is what I’m seeing:

oops wow that was years old

heres the correct link

Actual link, that was embarassing XD

Sorry. What is your link trying to show?

Could you try to make it a little more reproducible?

Sorry about that, I figured out the problem. I forgot to add ‘#’ to my variable -____-. Thanks for your help!