Note that there are some explanatory texts on larger screens.

plurals
  1. POColumn chart: how to show all labels on horizontal axis
    primarykey
    data
    text
    <p>I've been trying to show all labels on the horizonal axis of my chart, but I haven't been able to do that!</p> <p>I tried using <strong>hAxis.showTextEvery=1</strong> but does not work </p> <p>(see <a href="https://developers.google.com/chart/interactive/docs/gallery/columnchart" rel="nofollow noreferrer">https://developers.google.com/chart/interactive/docs/gallery/columnchart</a>).</p> <p><img src="https://i.stack.imgur.com/P5Qmb.png" alt="enter image description here"></p> <p>Basically, <strong>I would like to also show numbers "5", "7" and "9" that are currently missing in the above chart.</strong></p> <p>Here the JavaScript code, thanks a lot.</p> <pre><code>&lt;script type="text/javascript"&gt; google.setOnLoadCallback(drawChart1); function drawChart1(){ var data = new google.visualization.DataTable( { "cols":[ {"id":"","label":"ratings","type":"number"}, {"id":"","label":"# of movies","type":"number"}], "rows":[ {"c":[{"v":9},{"v":26}]}, {"c":[{"v":8},{"v":64}]}, {"c":[{"v":10},{"v":5}]}, {"c":[{"v":7},{"v":50}]}, {"c":[{"v":6},{"v":38}]}, {"c":[{"v":5},{"v":10}]}, {"c":[{"v":2},{"v":1}]}, {"c":[{"v":4},{"v":1}]} ]}); var options = { "title":"Rating distribution", "vAxis":{"title":"# of movies","minValue":0}, "hAxis":{"title":"Ratings","maxValue":10},"legend":"none","is3D":true,"width":800,"height":400,"colors":["red"] }; var chart = new google.visualization.ColumnChart(document.getElementById('chart_movies_per_rating'));chart.draw(data, options); } &lt;/script&gt; </code></pre> <p><strong>UPDATE:</strong> this is the solution I developed, following the answer below (thanks again!). <a href="http://jsfiddle.net/mdt86/x8dafm9u/104/" rel="nofollow noreferrer">http://jsfiddle.net/mdt86/x8dafm9u/104/</a></p> <pre><code>&lt;script type="text/javascript"&gt; google.setOnLoadCallback(drawChart1); function drawChart1(){ var data = new google.visualization.DataTable( {"cols": [{"id":"","label":"ratings","type":"string"}, {"id":"","label":"# of movies","type":"number"}], "rows": [{"c":[{"v":"0"},{"v":0}]}, {"c":[{"v":" 1"},{"v":0}]}, {"c":[{"v":" 2"},{"v":1}]}, {"c":[{"v":" 3"},{"v":0}]}, {"c":[{"v":" 4"},{"v":1}]}, {"c":[{"v":" 5"},{"v":10}]}, {"c":[{"v":" 6"},{"v":38}]}, {"c":[{"v":" 7"},{"v":50}]}, {"c":[{"v":" 8"},{"v":64}]}, {"c":[{"v":" 9"},{"v":26}]}, {"c":[{"v":" 10"},{"v":5}]} ] } ); var options = {"title":"Rating distribution", "vAxis":{"title":"# of movies","minValue":0}, "hAxis":{"title":"Ratings","maxValue":10}, "legend":"none", "is3D":true, "width":800, "height":400, "colors":["CC0000"]}; var chart = new google.visualization.ColumnChart(document.getElementById('chart_movies_per_rating')); chart.draw(data, options); } &lt;/script&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload