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 9173849
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T16:39:18+00:00 2026-06-17T16:39:18+00:00

I am dynamically creating a chart within a map popup (triggered when user clicks

  • 0

I am dynamically creating a chart within a map popup (triggered when user clicks the map) using dojo 1.7 (built into the Esri API that I am using).

 var c = dojo.create("div", {
          id: "demoChart"
        }, dojo.create('div'));

After setting the chart properties (data, theme, etc), if I call chart.render, the chart renders correctly but at the wrong size (too big for the infoWindow container div).

However, if I call chart.resize(175, 145), the chart does get created at the correct size, but does not get created on first click, but the second click.

To replicate please see this JSFiddle, and refer to lines 49-53 in the Javascript.

  map.infoWindow.setContent(c);
  // Chart Resize will resize the DIV as needed.
  // However, the initial click will not show the chart
  chart.resize(175, 145);
  // Chart Render shows the chart on first click, but does not resize the div
  //chart.render();

I was under the impression that the resize method included calling render within it. Therefore I am not too sure why I am getting this behaviour.

I need to know what needs changing in order to create the chart div at the same size as the parent div that it sits within.

  • 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-17T16:39:19+00:00Added an answer on June 17, 2026 at 4:39 pm

    The reason that the chart is rendering with the default size (400 x 300px) is because the chart node (div#demoChart) does not have any dimensions.

    Furthermore, until the chart node div is visible, it will not have any actual dimensions (only style dimensions) for the chart to use. It then falls back to the default size of 300 x 400px.

    To make your code work:

    1. Add a css style for the div

      #demoChart {
        width: 175px;
        height: 145px;
      }
      
    2. Create the chart after you have shown the info window and the chart node is actually visible. The chart gets it dimensions upon instantiation (in the constructor() method, rather than in the render() method as you might expect).

    I have edited your JSfiddle to make it work (view JSfiddle).

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

Sidebar

Related Questions

I am currently using the Chart Control from System.Windows.Forms.DataVisualization to dynamically creating 10 chart
i am dynamically creating radio using jquery as shown belown. but they value only
I'm using Matplotlib to dynamically generate .png charts from a database. The user may
I am dynamically creating a canvas, and I need a background image within the
I am dynamically creating textboxes using document.createElement('input') and adding a break between them using
I am dynamically creating the columns for a data grid in a User control
I am dynamically creating an asp.net RadioButton and inserting it into my web page:
I am dynamically creating a div using jQuery and then adding a class to
I am dynamically creating a msword document in PHP using PHPDocx (free version). I
I am working on dynamically creating some JavaScript that will be inserted into a

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.