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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T20:20:07+00:00 2026-06-05T20:20:07+00:00

I am trying to use the google chart tools (from the visualization api; not

  • 0

I am trying to use the google chart tools (from the visualization api; not the image charts) using an infoBubble. The infobubble is awesome; does exactly what I need it to. My project calls for using a chart in one of the tabs on the infobubble. So I am trying to use this code (see below) to build a contentString that will create a chart in the div’s content. It isn’t making any charts happen, though. Does anything look wrong, in particular, with the content string?

//returns the status string
function GetPublicProjectStatusString(data){

     var contentString = '<div id="content" style="margin:0;">'+
            '<h3>' + 'Project Phase' + '</h3>'+
            '<p>' + data.ProjectPhase + '</p>'+
            '<div id="parentDiv">' + 
                '<div id="chartDiv" style="top:0px;left:0px;width:200px;height:200px;">' +
                '</div>' +
                '<div id="secondDiv">' +
                    '<h3>' + 'Start Date' + '</h3>' +
                '</div>' +
            '</div>' +
        '</div>' + 
        '<script type="text/javascript">' +
            'var chartdata = new google.visualization.DataTable();' +
            'chartdata.addColumn("string", "Source");' +
            'chartdata.addColumn("number", "Amount");' +
            'chartdata.addRows([' +
                '["Federal",4],' +
                '["State",8],' +
                '["County",9],' +
                '["Local",14],' +
            ']);' + 
            'var options = {"title":"Project Budget"' +
                '"width":200,' + 
                '"height":200};' +
            'var chart = new google.visualization.PieChart(document.getElementById("chartDiv"));' +
            'chart.draw(data,options);' +   
        '</script>';

    return contentString;

}  
  • 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-05T20:20:08+00:00Added an answer on June 5, 2026 at 8:20 pm

    I think the following approach might be helpful to you as I dont think you can use the script tags in the content string.

    Use a div in the content string where you want to place your graph

    var contentString = "<div id='chart_div'></div>";
    

    Have a look at this google chart example that can be adapted to add the chart to the div in the content string:

    Google Charts Tools Example

    However the div in your content string will probably be created by user input like clicking a marker so you cannot directly add the chart to it (which is done in the chart example) as it is not part of the dom yet. Therefor your have to listen to the event that creates the infoBubble. For a infowindow connected to a marker in the google maps api this will be something like this:

    google.maps.event.addListener(infoWindow, 'domready', function() { drawChart(); });
    

    Where infoWindow is the info window you created and drawChart a function you wrap the adapted chart code example in.

    Hope this helps.

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

Sidebar

Related Questions

I am trying to use the Google Charts API to create a chart that
HI all, i'm trying to use google chart API to make some charts in
I was trying to use piechart provided by google chart tools. Their documentation specifies
I am trying to use Google graph API (image) to show some data in
I'm trying to use Google chart tools to visualize data on my site. The
We are trying a prototype using Google chart api. http://chart.apis.google.com/chart?chf=bg,s,000000&chxs=0,FFFFFF00,9.5&chxt=x&chs=500x300&cht=p3&chco=3072F3|FF9900|80C65A|990066&chd=t:50,5,5,40&chdl=50%C2%B0%20Apples|5%C2%B0%20Oranges|5%C2%B0%20Dates|40%C2%B0%20Strawberries&chdlp=b&chp=0.1 the problem is when
I am trying to use Google Charts API following this example Google Charts Quick
I've been trying to figure out how to use google chart-wrapper with my django
I'm trying to use a google visualisation, the column chart, inside an asp.net AJAX
I am trying to use Google Places in Google Maps API v3, but I

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.