Here’s a simple example of a page that displays a pie chart:

The chart is interactive–try mousing over the slices or legend entries.

You can copy the snippet below to a file on your computer and open it in your browser to display the pie chart shown above:

<html>
  <head>
    <!--Load the AJAX API-->
    <script type="text/javascript" src="https://www.google.com/jsapi"></script>
    <script type="text/javascript">

      // Load the Visualization API and the piechart package.
      google.load('visualization', '1.0', {'packages':['corechart']});

      // Set a callback to run when the Google Visualization API is loaded.
      google.setOnLoadCallback(drawChart);

      // Callback that creates and populates a data table,
      // instantiates the pie chart, passes in the data and
      // draws it.
      function drawChart() {

        // Create the data table.
        var data = new google.visualization.DataTable();
        data.addColumn('string', 'Topping');
        data.addColumn('number', 'Slices');
        data.addRows([
          ['Mushrooms', 3],
          ['Onions', 1],
          ['Olives', 1],
          ['Zucchini', 1],
          ['Pepperoni', 2]
        ]);

        // Set chart options
        var options = {'title':'How Much Pizza I Ate Last Night',
                       'width':400,
                       'height':300};

        // Instantiate and draw our chart, passing in some options.
        var chart = new google.visualization.PieChart(document.getElementById('chart_div'));
        chart.draw(data, options);
      }
    </script>
  </head>

  <body>
    <!--Div that will hold the pie chart-->
    <div id="chart_div"></div>
  </body>
</html>

How About a Bar Chart?

Convert the pie chart to a bar chart by replacing google.visualization.PieChart with google.visualization.BarChart in the code and reloading your browser.

 

English: Pie chart with preliminary results fr...

Image via Wikipedia

Advertisements
Comments
  1. Damian Betti says:

    Only a smiling visitor here to share the love (:, btw outstanding pattern .

  2. Michale Grenier says:

    At which May We Discover The very same Advice With regards to this subject matter?

  3. etupakka says:

    I see something genuinely interesting about your web blog so I saved to bookmarks .

  4. certified nursing assistant exam says:

    You have noted very interesting points! ps nice internet site.

  5. gameboy says:

    I view something truly special in this site.

  6. teething biscuits says:

    I like this weblog very much so much superb information.

  7. Deonna Seifried says:

    Great write-up, I am regular visitor of one’s web site, maintain up the nice operate, and It’s going to be a regular visitor for a lengthy time.

  8. music licensing says:

    Just wanna tell that this is invaluable , Thanks for taking your time to write this. “Some things have to be believed to be seen.” by Ralph Hodgson.

  9. film izle says:

    Greetings thanks for great article i used to be seeking for this issue very last 2 times. I will look for upcoming valuable posts. Have fun admin.

  10. music licensing organizations says:

    I believe this site holds very great composed content content.

  11. Scrapebox says:

    Very interesting information!Perfect just what I was looking for!

  12. cheap vacations says:

    great put up, very informative. I ponder why the opposite experts of this sector don’t realize this. You must continue your writing. I’m confident, you’ve a huge readers’ base already!

  13. auto approved blog says:

    Wonderful post nevertheless , I was wanting to know should you could write a litte more on this subject? I’d be really thankful should you could elaborate just a little bit further. Bless you!

  14. ups basketball tacoma says:

    I don’t know whether it’s just me or if everybody else experiencing problems with your website. It appears like some of the text on your posts are running off the screen. Can somebody else please provide feedback and let me know if this is happening to them too? This may be a problem with my web browser because I’ve had this happen before. Thanks

  15. Wilford Jacocks says:

    Would love to constantly get updated outstanding web blog!

  16. seo software says:

    Some truly fantastic articles on this site, thank you for contribution. “Always aim for achievement, and forget about success.” by Helen Hayes.

  17. ashley cooper photography alabama says:

    I absolutely love your blog and find a lot of your post’s to be just what I’m looking for. Does one offer guest writers to write content for yourself? I wouldn’t mind creating a post or elaborating on most of the subjects you write about here. Again, awesome web site!

  18. website templates says:

    I genuinely enjoy looking through on this internet site , it has got great posts . “When a man’s willing and eager, the gods join in.” by Aeschylus.

  19. colleges with nursing programs says:

    I was just searching for this info for some time. After six hours of continuous Googleing, finally I got it in your site. I wonder what’s the lack of Google strategy that do not rank this type of informative web sites in top of the list. Generally the top sites are full of garbage.

  20. credit card consolidation says:

    You could certainly see your skills within the paintings you write. The arena hopes for more passionate writers such as you who are not afraid to mention how they believe. All the time go after your heart.

  21. Sharee says:

    I really appreciate this post. I’ve been looking all over for this! Thank goodness I found it on Bing. You’ve made my day! Thx again!

  22. mixing and mastering music says:

    Look, there is no doubt you are correct, but I’d urge you to be flexible with your definitions. To define is to make real, and you’re really smart!

  23. Escort girl Paris says:

    Very interesting topic, appreciate it for posting.

  24. Ping Backlinks says:

    I always was interested in this topic and stock still am, appreciate it for posting.

  25. nes roms says:

    I was looking at some of your content on this internet site and I think this website is very informative ! Keep on putting up.

  26. guaranteed facebook fans says:

    Give somebody a fish and you feed them for a day; train any particular one person to make use of the Internet they often won’t trouble you for weeks. ~Author Unknown

  27. Flo says:

    Its superb as your other articles : D, regards for posting . “It takes less time to do things right than to explain why you did it wrong.” by Henry Wadsworth Longfellow.

  28. credit card holder says:

    I’ve been surfing online greater than 3 hours today, but I never discovered any fascinating article like yours. It’s pretty value sufficient for me. In my opinion, if all website owners and bloggers made just right content material as you probably did, the net shall be much more useful than ever before.

  29. media pressure says:

    I’ve recently started a blog, the information you offer on this website has helped me greatly. Thanks for all of your time & work.

  30. Donte Akmal says:

    Hi! I know this is kinda off topic nevertheless I’d figured I’d ask. Would you be interested in exchanging links or maybe guest authoring a blog post or vice-versa? My website covers a lot of the same subjects as yours and I think we could greatly benefit from each other. If you happen to be interested feel free to shoot me an e-mail. I look forward to hearing from you! Wonderful blog by the way!

  31. Juice Recipes says:

    Juicing is an age old art; since humans have eaten fruits and vegetables, we have juiced them. Things have changed since the first orange was juiced, but the benefits of juicing have not, especially when juicing is combined with a fast from all other food and fluid.

  32. sexy girl says:

    wonderful put up, very informative. I ponder why the opposite specialists of this sector do not notice this. You must continue your writing. I am sure, you’ve a great readers’ base already!

  33. Nelda Boepple says:

    Please let me know if you’re looking for a writer for your blog. You have some really great articles and I believe I would be a good asset. If you ever want to take some of the load off, I’d love to write some articles for your blog in exchange for a link back to mine. Please send me an e-mail if interested. Cheers!

  34. Theodore Va says:

    You are my breathing in, I possess few web logs and occasionally run out from to post .

  35. Versie Giammona says:

    Hey just wanted to give you a quick heads up and let you know a few of the pictures aren’t loading properly. I’m not sure why but I think its a linking issue. I’ve tried it in two different browsers and both show the same outcome.

  36. Inspirational Quotes says:

    Wow, wonderful blog layout! How long have you been blogging for? you made blogging look easy. The overall look of your website is fantastic, as well as the content!. Thanks For Your article about Google Chart Tools Zeeshan Akhter .

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s