Values on horizontal axis for line and scatter charts

129 views
Skip to first unread message

cogdevelopers

unread,
Jun 20, 2012, 10:23:00 AM6/20/12
to google-visua...@googlegroups.com
Is there any way to make the values that appear on the X axis "independent" of the data points?
 
Here is an example of what I'm doing:
 
 
The x axis represents hours on a 24 hour clock.  The points correspond to times at 15 minute intervals, this 11.25 would represent 11:25 AM and so forth.  I'm trying to make the x axis essentially show 24 points regardless of the number of points.  There can be anywhere from 1 to 96 points.  I have to use floats, so the data is continuous and shows up correctly in the rollover.  I can't figure out why the values in the x axis sometimes show floating point values that seem off and sometimes don't (look at both dates in the date of traffic count).
 
Here is my options clause:
 
    var options = {'title':'24 Hr Historical Traffic Counts' ,
  vAxis: {minValue: 0,maxValue:yMax,gridlines:{color:'#333',count:12},'title': 'Traffic Count by Interval' ,
  titleTextStyle:{fontName:'Arial, Helvetica, sans-serif',italic:false}},
  hAxis: {minValue:0,maxValue:24,gridlines:{color:'grey',count:mycount-1},'title': 'Time of Day',
  titleTextStyle:{fontName:'Arial, Helvetica, sans-serif',italic:false}},
  chartArea: {width:"80%"},
  colors: ['red','#FF0033'],
  width:'100%',
  legend:{position:'none'}
 
The variables yMax is the highest value of the y axis and mycount is the number of points in the data set.
 

cogdevelopers

unread,
Jun 20, 2012, 12:00:36 PM6/20/12
to google-visua...@googlegroups.com

Found a solution.  used viewWindow.  Code now looks like:
 
hAxis: {viewWindow:{min:0,max:24},gridlines:{count:24},'title': 'Time of Day',
Reply all
Reply to author
Forward
0 new messages