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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T18:42:29+00:00 2026-05-27T18:42:29+00:00

I have setup a simple Google Chart by following the example on this page:

  • 0

I have setup a simple Google Chart by following the example on this page:
http://code.google.com/apis/chart/interactive/docs/gallery/linechart.html

 google.load("visualization", "1", {packages:["corechart"]});
      google.setOnLoadCallback(drawChart);
      function drawChart() {
        var data = new google.visualization.DataTable();
        data.addColumn('string', 'Year');
        data.addColumn('number', 'Sales');
        data.addColumn('number', 'Expenses');
        data.addRows([
        ['2004', 1000, 400],
        ['2005', 1170, 460],
        ['2006',  860, 580],
        ['2007', 1030, 540]
        ]);

        var options = {
          width: 400, height: 240,
          title: 'Company Performance'
        };

        var chart = new google.visualization.LineChart(document.getElementById('chart_div'));
        chart.draw(data, options);
      }

But now, after it’s rendered, with some javascript i want to dynamically add another series of data. Can anyone point me in the right direction on how to do this?
The data i want to add, a number column with the number of employees, should show a new line in the chart, in another color and doesn’t start at year 2004 but at 2005,

  • 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-27T18:42:29+00:00Added an answer on May 27, 2026 at 6:42 pm

    You need to add new data to ‘data’ variable and call the chart.draw() method again.
    See the DataTable docs or play a bit at http://code.google.com/apis/ajax/playground/?type=visualization#line_chart

    Example:

      // Add columns
      data.addColumn('string', 'Employee Name');
      data.addColumn('date', 'Start Date');
    
      // Add empty rows
      data.addRows(6);
      data.setCell(0, 0, 'Mike');
      data.setCell(0, 1, {v:new Date(2008,1,28), f:'February 28, 2008'});
      data.setCell(1, 0, 'Bob');
      data.setCell(1, 1, new Date(2007, 5, 1));
      data.setCell(2, 0, 'Alice');
      data.setCell(2, 1, new Date(2006, 7, 16));
      data.setCell(3, 0, 'Frank');
      data.setCell(3, 1, new Date(2007, 11, 28));
      data.setCell(4, 0, 'Floyd');
      data.setCell(4, 1, new Date(2005, 3, 13));
      data.setCell(5, 0, 'Fritz');
      data.setCell(5, 1, new Date(2007, 9, 2));
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

http://code.google.com/p/apps-for-android/ I have eclipse setup with Subversive plugin, I can download the codes down
If I have a simple class setup like this: class MyClass { private string
Currently I have this setup in our simple-hosts.conf: url.rewrite-once = ( .*.(js|ico|gif|jpg|png|css|php|htm)(?.*)?$ => $0,
This might be quite simple but I have spent hours in Google but couldn't
So I'm trying to load a simple URL (http://www.google.com) into a web view. I
I have a very simple Setup project that copies three dlls into the GAC.
I have a setup where I'm serving simple python pages using the mod_python publisher.
I want to setup a simple site and I don't have any web development
I have a simple client/server setup. The server is in C and the client
I have a really simple ASP.NET web application and a web setup project that

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.