Search code examples
javascriptchartsgoogle-visualizationlinegraph

display every other item on axis


Google line chart displaying temperature hour for hour. Is it possible to just display every other hour on the x-axis. I could just set every second string to empty, but then one wouldn't be able to display it when hovering over the graph.

Maybe you could do something here?:

var options = {
 hAxis: {
 format: ''
 }
}

Solution

  • try the following option...

    showTextEvery - How many horizontal axis labels to show, where 1 means show every label, 2 means show every other label, and so on. Default is to try to show as many labels as possible without overlapping.

    var options = {
      hAxis: {
        showTextEvery: 2
      }
    }