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

  • Home
  • SEARCH
  • 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 962285
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T01:28:57+00:00 2026-05-16T01:28:57+00:00

i load graphs via the following javascript function: function loadMCorCBGraph(self,surveyID,questionID,varID) { var img =

  • 0

i load graphs via the following javascript function:

function loadMCorCBGraph(self,surveyID,questionID,varID) {
    var img = new Image();

    img.onload = function() {
        $(self).parents().parents().siblings(".graph_container")
        .empty().append(img);
    };

    img.src = 'drawGraph.php?type=surveys_report_MC_or_CB&surveyID=' + surveyID + '&questionID=' + questionID +
        (varID != null ? '&varID=' + varID : '') + '&companyID=<?php echo $_SESSION['companyID'] ?>';   
}

however, the graph height is unknown until it is drawn. i was wondering if there was a way to get this height after it has loaded and set the container height to cet height.

i thought about putting:

.css("height", THE_IMAGE_HEIGHT)

in the onload function, but i am having trouble finding this image’s height. debugging shows that (inside the onload):

$(this).height() = 0
img.height = ReferenceError: img is not defined
this.height = 425

now the last one, this.height, is clearly referring to the container, which is set with a height of 425px.

any ideas as to how to get the height?

thanks!

  • 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-05-16T01:28:58+00:00Added an answer on May 16, 2026 at 1:28 am
    img.onload = function() {
        $Container = $(self).parents().parents().siblings(".graph_container");
    
        $Container.empty().append(img);
    
        this.find('img').each(function(){
            //Dynamically check each image
            if(this.height > 400)
            {
                $(this).height(400);
            }
            console.log(this); //Should see object with attribs.
        })
    };
    

    Give that a go and tell me what happens, also check your console log to see if the Object is the image element.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 509k
  • Answers 509k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Create a named_scope for your Lead model, like so: class… May 16, 2026 at 4:44 pm
  • Editorial Team
    Editorial Team added an answer Just remember whatever you do with Django, it is still… May 16, 2026 at 4:44 pm
  • Editorial Team
    Editorial Team added an answer Like this: private static readonly Dictionary<BookCode, Func<Book>> ctorsByCode = new… May 16, 2026 at 4:44 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

I use, google.load('visualization', '1', {'packages': ['columnchart']}); //google.setOnLoadCallback(drawChart); function drawChart(response) { alert(response.customerlist); var data =
I load some HTML code into a div with the .load function af jQuery
I have designed an ASP.NET page which create graphs. I have written a class
I am trying to show a graph image which is horizontally long. The problem
As you can see from the attached image the CPU graph on my dual
Per the new profile/fan page tab rule that eliminates the iFrame option, is there
How to pass a php json encoded variable to a jquery function using codeigniter?
load X_Q2.data load T_Q2.data x = X_Q2(:,1); y = X_Q2(:,2); learningrate = 0.2; max_iteration
The background: I'm building a trie to represent a dictionary, using a minimal construction
I'm using Instruments with the Allocations instrument. I'm testing only a fixed interaction with

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.