minor gridlines on datetime axis

28 views
Skip to first unread message

Christo

unread,
May 9, 2017, 10:02:35 PM5/9/17
to Google Visualization API
Hi helpers!

I'm trying to add minor gridlines every hour. on my hAxis , but I can't find any way to do that.
I tried thicks, gridlines count, etc... but I can't find the right parameters...
Could you help me?

thank you

there is my code:



</script> <script type="text/javascript">
      google.load('visualization', '1', {packages:['corechart']});
      google.charts.setOnLoadCallback(drawChart);
    
      function drawChart() {
      var data = google.visualization.arrayToDataTable([
          ['TIME', 'Room', 'Frogs', 'Orchids'],
['2017-05-09 20:10:02',  55.6,  67.0,  81.9],
['2017-05-09 20:00:11',  55.5,  66.8,  81.6],
['2017-05-09 19:50:02',  55.3,  66.8,  81.1],
['2017-05-09 19:40:02',  54.6,  66.5,  80.3],
['2017-05-09 19:30:02',  54.8,  66.7,  80.3],
['2017-05-09 19:20:02',  54.7,  66.8,  80.3],
['2017-05-09 19:10:02',  54.6,  66.7,  80.2],
['2017-05-09 19:00:02',  54.5,  66.5,  80.1],
['2017-05-09 18:50:02',  54.5,  66.2,  80.0],
['2017-05-09 18:40:02',  54.6,  66.2,  80.0],
['2017-05-09 18:30:02',  54.6,  66.4,  79.8],
['2017-05-09 18:20:02',  54.5,  66.6,  79.6],
['2017-05-09 18:10:02',  54.5,  66.4,  79.6],
['2017-05-09 18:00:02',  54.5,  66.5,  79.6],
['2017-05-09 17:50:02',  54.6,  66.6,  79.5],
['2017-05-09 17:40:02',  54.6,  66.5,  79.4],
['2017-05-09 17:30:02',  54.5,  66.4,  79.2],
['2017-05-09 17:20:02',  54.6,  66.5,  79.3],
['2017-05-09 17:10:02',  54.5,  66.3,  79.1],
['2017-05-09 17:00:01',  54.4,  66.3,  79.1],
['2017-05-09 16:50:02',  54.5,  66.2,  80.0],
['2017-05-09 16:40:02',  54.6,  66.2,  80.0],
['2017-05-09 16:30:02',  54.6,  66.4,  79.8],
['2017-05-09 16:20:02',  54.5,  66.6,  79.6],
['2017-05-09 16:10:02',  54.5,  66.4,  79.6],
['2017-05-09 16:00:02',  54.5,  66.5,  79.6],
['2017-05-09 15:50:02',  54.5,  66.2,  80.0],
['2017-05-09 15:40:02',  54.6,  66.2,  80.0],
['2017-05-09 15:30:02',  54.6,  66.4,  79.8],
['2017-05-09 15:20:02',  54.5,  66.6,  79.6],
['2017-05-09 15:10:02',  54.5,  66.4,  79.6],
['2017-05-09 15:00:02',  54.5,  66.5,  79.6],
['2017-05-09 14:50:02',  54.5,  66.2,  80.0],
['2017-05-09 14:40:02',  54.6,  66.2,  80.0],
['2017-05-09 14:30:02',  54.6,  66.4,  79.8],
['2017-05-09 14:20:02',  54.5,  66.6,  79.6],
['2017-05-09 14:10:02',  54.5,  66.4,  79.6],
['2017-05-09 14:00:02',  54.5,  66.5,  79.6],
['2017-05-09 13:50:02',  54.5,  66.2,  80.0],
['2017-05-09 13:40:02',  54.6,  66.2,  80.0],
['2017-05-09 13:30:02',  54.6,  66.4,  79.8],
['2017-05-09 13:20:02',  54.5,  66.6,  79.6],
['2017-05-09 13:10:02',  54.5,  66.4,  79.6],
['2017-05-09 13:00:02',  54.5,  66.5,  79.6],

var options = {
title: 'Humidity: ALL, LAST HOUR',
curveType: 'function',
        legend: { position: 'bottom' },
series: {
            0: { color: '#808080' },
            1: { color: '#FFA500' },
            2: { color: '#008000' },
},
  backgroundColor:'#e6f2ff',
hAxis: { textPosition: 'none', direction: '-1' },
  vAxis: {gridlines: { count: 11} , minorGridlines: { count: 1},
           viewWindow:{
                                  max:100, min:0
                                 }
              }
};
var chart = new google.visualization.LineChart(document.getElementById('humidity_chart'));
    chart.draw(data, options); }
    </script>

Daniel LaLiberte

unread,
May 10, 2017, 5:42:57 AM5/10/17
to Google Visualization API
Hi Christo,

Check the 'units' option, mentioned on this page: https://developers.google.com/chart/interactive/docs/datesandtimes

--
You received this message because you are subscribed to the Google Groups "Google Visualization API" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-visualization-api+unsub...@googlegroups.com.
To post to this group, send email to google-visualization-api@googlegroups.com.
Visit this group at https://groups.google.com/group/google-visualization-api.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-visualization-api/342ac7e9-e9f3-40e4-9a54-f2412a761c4a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Reply all
Reply to author
Forward
0 new messages