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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T12:26:12+00:00 2026-05-30T12:26:12+00:00

I am trying to draw a Google Line Chart, where each line may have

  • 0

I am trying to draw a Google Line Chart, where each line may have a different number of data points. That is, if the x-Axis has 10 values, then some lines may only have data on 4 or 5 or whatever points. I found an answer to this question here:

How to create Google Chart with lines (series) of different lengths?

This did not work for me. I tried both underscore and double underscore. Also I tried to add ” and ‘ around the underscore(s). But when I open the html, the site remains plain. Here is my Code:

<html>
  <head>
    <script type="text/javascript" src="https://www.google.com/jsapi"></script>
    <script type="text/javascript">
      google.load("visualization", "1", {packages:["corechart"]});
      google.setOnLoadCallback(drawChart);
      function drawChart() {
        var data = new google.visualization.DataTable();
        data.addColumn('string', 'point');
        data.addColumn('number', 'line1');
        data.addColumn('number', 'line2');
        data.addColumn('number', 'line3');
        data.addColumn('number', 'line4');
        data.addColumn('number', 'line5');
        data.addRows([
          ['0', 5, 6, 10, 8,_],
          ['1', 5, 6, 10, 8, 10]]);
        var options = {
          title: 'Test'
        };

        var chart = new google.visualization.LineChart(document.getElementById('chart_div'));
        chart.draw(data, options);
      }
    </script>
  </head>
  <body>
    <div id="chart_div" style="width: 900px; height: 500px;"></div>
  </body>
</html>

Anyone know a solution?

  • 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-30T12:26:13+00:00Added an answer on May 30, 2026 at 12:26 pm

    I think the answer is on this page Data Formats.
    The thing is that you can’t use _ as is in the array of data because JS will think it’s a variable. _ is the encoded value for a missing value. So you have to convert all your data to an encoded string to use _ for missing values.
    At the end of the linked page, it seems you have functions which realize this encoding for you.

    Maybe you can set your data like this instead of your “inline” method, so you don’t need to use encoded values.

    <html>
     <head>
    <script type="text/javascript" src="https://www.google.com/jsapi"></script>
    <script type="text/javascript">
      google.load("visualization", "1", {packages:["corechart"]});
      google.setOnLoadCallback(drawChart);
      function drawChart() {
        var data = new google.visualization.DataTable();
        data.addColumn('string', 'point');
        data.addColumn('number', 'line1');
        data.addColumn('number', 'line2');
        data.addColumn('number', 'line3');
        data.addColumn('number', 'line4');
        data.addColumn('number', 'line5');
    
        data.addRows(3);
        data.setValue(0, 0, '2004');
        data.setValue(0, 1, 1000);
        data.setValue(0, 2, 400);
        data.setValue(0, 3, 500);
        data.setValue(1, 0, '2005');
        data.setValue(1, 1, 1000);
        data.setValue(1, 2, 400);
        data.setValue(1, 3, 500);
        data.setValue(2, 0, '2006');
        data.setValue(2, 1, 1000);
        data.setValue(2, 2, 400);
    
    
        var options = {
          title: 'Test'
        };
    
        var chart = new google.visualization.LineChart(document.getElementById('chart_div'));
        chart.draw(data, options);
      }
    </script>
    </head>
     <body>
    <div id="chart_div" style="width: 900px; height: 500px;"></div>
     </body>
    </html>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to draw a google maps that has multiple Circle overlays, however I
I have some data in mysql that I load up in php and draw
I am trying to use the Google Charts API to create a chart that
I'm trying to use Google chart tools to visualize data on my site. The
I have been trying to plot these on a scatter chart using google api.
I am trying to draw path between two points on google map using url
I'm trying to use the Google maps JavaScript API to draw a line between
Im trying to using Google Area Chart and PHP to display some data. problem
I have a web app that will draw a polyline for each user (tracks
I am trying to draw editable polyline that connects all points I click on

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.