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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T16:27:35+00:00 2026-06-01T16:27:35+00:00

I am working with Google Pie Charts API in Javascript. I am using Javascript

  • 0

I am working with Google Pie Charts API in Javascript. I am using Javascript within PHP. I am passing array elements to API url. But, somehow, I am not getting the required Pie Chart. I think I am messing with the syntax of passing variables to the API url.

This is the code I am using:

function pie(){
?>
<SCRIPT LANGUAGE='Javascript'><!--

piechart();
function piechart() {
var chtdata = new Array(50,50,100,25);       // Array containing values to be mapped

var doc1 =  "<img src='http://chart.apis.google.com/chart?cht=p3&chs=450x200&chd=t:'+chtdata[0]+',50,100,20&chl='r'|'s'|'g'|'h'&chtt='Visitor Details'&chco=ff0000' name='piechart' />";
document.write(doc1);
document.write('Done.');

}
</SCRIPT>
<?php

It would be great if you could point out my mistake. Any help will be appreciated.

  • 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-01T16:27:37+00:00Added an answer on June 1, 2026 at 4:27 pm

    Because the outer quotes on your JavaScript string are double-quotes, the reference to the variable isn’t actually a reference to the variable at all. The color-coding of the text right there in your question should show that clearly.

    Try:

    var doc1 =  "<img src='http://chart.apis.google.com/chart?cht=p3&chs=450x200&chd=t:"+val1+",50,100,20&chl='r'|'s'|'g'|'h'&chtt='Visitor Details'&chco=ff0000' name='piechart' />";
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am working on Google map application using Google Maps JavaScript API V2 .
I just started working using Google Maps API yesterday, and trying to set up
When working with the pie chart in Google Charts it seems to ignore items
I am working with google app engine and using the low leval java api
i need to make charts (pie and bar) and working with php data. the
I am working on Google Maps Javascript API V 3. Everything is working fine
I'm using the Google Charts API to include various graphs on a webapp I'm
I am currently working on google map api V3 using cakephp with prototype.js. I
I am Working on Google Data api. I am taking credentials from user and
I am working with Google Calender Api.When i try to fetch all attendees for

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.