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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T19:48:15+00:00 2026-06-05T19:48:15+00:00

I need to draw a chart to show the evolution of data in real

  • 0

I need to draw a chart to show the evolution of data in real time in a day. I’ve been playing in Google Charts Playground to see how it would be visualized, but I haven’t been able to set the hAxis.viewWindow.max option, in order to make the X axis be fixed.

Here is the code I’ve been using to test:

function drawVisualization() {
  // Create and populate the data table.
  var data = new google.visualization.DataTable();

  data.addColumn('timeofday', 'x');
  data.addColumn('number', 'S0');
  data.addColumn('number', 'S1');
  data.addColumn('number', 'S2');

  data.addRows([
    [[0,0,0,0],   1,       1,           0.5],
    [[1,0,0,0],   2,       0.5,         1],
    [[2,0,0,0],   4,       1,           0.5],
  ]);

  // Create and draw the visualization.
  new google.visualization.LineChart(document.getElementById('visualization')).
      draw(data, {curveType: "function",
                  width: 500, height: 400,
                  vAxis: {maxValue: 10},
                  hAxis: {maxValue: [23,59,59,0], minValue:[0,0,0,0], viewWindow:{max: [23, 59, 59, 0]}}}
          );
    }

The documentation claims that hAxis.viewWindow.max receives numbers, but I haven’t found a way to represent the “timeofday” type as a number.
​
Using that, the X axis goes from 0am to 2am, but I needed the axis to go until midnight.

I tried using “datetime” as the column type, with the same problem.

The sample below, using numbers, works the way I intended it to, drawing the line where my points are, but extending the grid until my max value:

function drawVisualization() {
  // Create and populate the data table.
  var data = new google.visualization.DataTable();

  data.addColumn('number', 'x');
  data.addColumn('number', 'S0');
  data.addColumn('number', 'S1');
  data.addColumn('number', 'S2');

  data.addRows([
    [0,   1,       1,           0.5],
    [1,   2,       0.5,         1],
    [2,   4,       1,           0.5],
  ]);

  // Create and draw the visualization.
  new google.visualization.LineChart(document.getElementById('visualization')).
      draw(data, {curveType: "function",
                  width: 500, height: 400,
                  vAxis: {maxValue: 10},
                  hAxis: {maxValue: 23, minValue:0, viewWindow:{max: 23}}}
          );
}

​

  • 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-05T19:48:18+00:00Added an answer on June 5, 2026 at 7:48 pm

    X axis will end up to your max value for it (or close in same cases – like this one). For example

    in case of:

    data.addRows([
        [[0,0,0,0],   1,       1,           0.5],
        [[1,0,0,0],   2,       0.5,         1],
      ]);
    

    the x axis will end at 1:00

    in case of:

     data.addRows([
        [[0,0,0,0],   1,       1,           0.5],
        [[1,0,0,0],   2,       0.5,         1],
        [[23,59,59,0],   4,       1,           0.5],
      ]);
    

    it will end at 23:59:59 showing 22:00 as the last x axis label.

    This means that no matter the value your define as max in hAxis, the chart runs up to the max “timeofday” value you have in your dataRows (actually the last added row).

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

Sidebar

Related Questions

I am using excel to draw charts from c#, but i need the chart
I need to draw a Gantt-Chart within my iPad App. Are there any frameworks
I've been trying to modify a Google charts example in order to have three
I need to build a custom designed bar chart that displays some simple data.
I need to draw a chart in a JSP. I am using Charts4J to
I have updatable OHLCChart. I need to draw a line over chart. How to
I have a Google Chart (using the Google Visualization API , not Google Charts
I need a javascript (HTML4/5) based library to draw a line chart that has
I need to draw 2d line chart on a MFC view which will be
I need to draw charts using c# and WPF. I did some work using

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.