Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7787471
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T20:40:59+00:00 2026-06-01T20:40:59+00:00

Situation: I’m trying to refresh the graph ( Force Directed ) on window.resize .

  • 0

Situation:

I’m trying to refresh the graph (Force Directed) on window.resize.

jQuery( window ).on( 
        'resize', 
        function( e ) { 
                // The definition happens in the function in the next line
                // The init during $( document ).ready();
                var canvas = DefineGraphForceDirected().canvas;

                // gives me the object (sizes): 
                console.log( canvas.getSize() );

                // gives me the error: 
                canvas.resize( 500, 500 ); 
                // gives me the (also) error: 
                canvas.resize( window.innerWidth, window.innerHeight ); 
                // gives me the (also) error: 
                canvas.resize( window.innerWidth+'', window.innerHeight+'' ); 

                // Using the native html canvas, gives me wired aspect ration
                // and a repeating graph on the not resized areas 
                // when dragging the graph outside:
                var c   = document.getElementsByTagName( 'canvas' )[0],
                    ctx = c.getContext( '2d' );

                c.width  = window.innerWidth;
                c.height = window.innerHeight;
                ctx.clearRect( 0, 0, ctx.canvas.width, ctx.canvas.height );
        } 
); 

The canvas itself actually is a canvas mark up object and I already tried resizing. Anyway: I’m doing something wrong with the aspect ration.

The Error:

» Uncaught TypeError: Cannot set property ‘_depth’ of undefined «

>> Backtrace: (line nr. in brackets) 

-------------------------------------------- 
e.Util.computeLevels - (jit.js:1695) 
c.each.e.(anonymous function) - (jit.js:1813) 
g.ForceDirected.q.compute - (jit.js:5934) 
$jit.ForceDirected.q.refresh - (jit.js:6047) 
$jit.Canvas.q.initialize.canvases.push.l.Base.(anonymous 
function).resize - (jit.js:1089) 
l.Base.2D.q.resize - (jit.js:1226) 
$jit.Canvas.q.resize 

Question:

What am I doing wrong?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T20:41:00+00:00Added an answer on June 1, 2026 at 8:41 pm

    I found the problem.

    With the infoViz/TheJit graph, you’ll have to use the width and height attributes. Else you won’t be able to resize the canvas… it isn’t in use in the examples…

    function loadGraph() {
        var GraphForceDirected = new $jit.ForceDirected( {
            // Size
            height : 500,
            width  : 200,
        }
    
        return GraphForceDirected;
    }
    

    Then trigger it during (jquery mobile) pageshow:

    jQuery( '#graph-container' ).on(
        'pageshow', 
        function( $ ) {
            var GraphForceDirected = DefineGraphForceDirected();
    
            // Load JSON data for the ForceDirected Graph
            GraphForceDirected.loadJSON( json );
            // compute positions incrementally and animate.
            GraphForceDirected.computeIncremental( {
                iter       : 40,
                property   : 'end',
                onStep     : function( percent ) {
                    // Example status update fn
                    Status.write( percent );
                },
                onComplete : function() {
                    // Example status update fn
                    Status.write( 100 );
    
                    GraphForceDirected.animate( {
                        modes      : ['linear'],
                        transition : $jit.Trans.Elastic.easeOut,
                        duration   : 2500
                    } );
    
                    // Here it works:
                    GraphForceDirected.canvas.resize(
                        window.innerWidth,
                        window.innerHeight,
                        true
                    );
                }
            } );
        } 
    );
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Situation: I am trying to write a efficient query using "LIKE" statement to look
Situation: I have a simple XML document that contains image information. I need to
Situation: A PHP application with multiple installable modules creates a new table in database
Situation: text: a string R: a regex that matches part of the string. This
Situation: you've got a .swf embedded in an html page, and when you click
Situation: Site with content protected by username/password (not all controlled since they can be
Situation: Table TBL has ~10k entries for deletion, Table TBL has 14 child tables
Situation: I have some persons with certain skills and they can/might belong to more
Situation is you have to develop an application against an Active Directory Tree. Want
Situation: I want to provide a website service where users can enter some data

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.