Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google charts timeline change axis [duplicate]

Im using google timeline to display the hours an employee has worked on each day. I want to set the x axis to always display 24 hours, but I cannot find how to do that, or if that is possible. it automatically changes it to only display from the earliest to latest points.

Example:

enter image description here

like image 413
jternus Avatar asked Jan 14 '14 21:01

jternus


People also ask

What is continuous axis?

An imaginary line running around the ice surface that serves as a basis for a dance pattern . Usually the continuous axis consists of two lines running parallel to the long axis of the ice surface, approximately halfway between the long axis and the perimeter of the rink.


1 Answers

Google Charts version 43 (released October 2, 2015) supports minValue and maxValue for the horizontal axis:

....

var options = {
  hAxis: {
    minValue: new Date(1785, 0, 0),
    maxValue: new Date(1816, 0, 0)
  }
};

....

You have to load it via the frozen version loader though since apparently it wasn't successfully deployed by the usual process.

It looks like minValue and maxValue works only for putting spacing at the beginning and end of the timeline. So if you specify a minValue that is later than the start date of one of your data points, the timeline still starts at that data point and not at the minValue.

Here is a jsfiddle that shows minValue and maxValue providing spacing at the beginning and end of the first Google Timeline example: https://jsfiddle.net/o27ttyy3

like image 131
Mike H Avatar answered Oct 20 '22 17:10

Mike H