Note that there are some explanatory texts on larger screens.

plurals
  1. POGoogle Line Chart with Javascript literal Datatablse now showing X-Axis
    primarykey
    data
    text
    <p>I am implementing a Google (line) Chart based on a DataTable so I can change the type of graph 'on the fly'. I have successfully generated the data table (generated by script) based on <a href="https://developers.google.com/chart/interactive/docs/reference#dataparam" rel="nofollow">https://developers.google.com/chart/interactive/docs/reference#dataparam</a></p> <p>And implemented in an HTML Page (for testing purpose the page is empty so there is no interference with any other script/content)</p> <p>The Y-axis, Legenda and lines are correctly generated, yet the x-axis appears to be missing. </p> <p><strong>I am using the following content for the data table:</strong> </p> <pre><code>{"cols":[{"id":"timestamp","label":"timestamp","pattern":"","type":"string"},{"id":"sy","label":"sy","pattern":"","type":"number"},{"id":"us","label":"us","pattern":"","type":"number"},{"id":"average_cpu","label":"average_cpu","pattern":"","type":"number"}],"rows":[{"c":[{"v":"1372249356","f":""},{"v":0,"f":""},{"v":4,"f":""},{"v":43,"f":""}]},{"c":[{"v":"1372249650","f":""},{"v":13,"f":""},{"v":46,"f":""},{"v":49,"f":""}]},{"c":[{"v":"1372249950","f":""},{"v":4,"f":""},{"v":45,"f":""},{"v":47,"f":""}]},{"c":[{"v":"1372250250","f":""},{"v":2,"f":""},{"v":19,"f":""},{"v":46,"f":""}]},{"c":[{"v":"1372250550","f":""},{"v":3,"f":""},{"v":46,"f":""},{"v":51,"f":""}]}]} </code></pre> <p><strong>This all comes together in the following Javascript</strong></p> <pre><code>&lt;html&gt; &lt;head&gt; &lt;!--Load the AJAX API--&gt; &lt;script type="text/javascript" src="https://www.google.com/jsapi"&gt;&lt;/script&gt; &lt;script type="text/javascript"&gt; // Load the Visualization API and the piechart package. google.load('visualization', '1', {'packages':['corechart']}); &lt;/script&gt; &lt;script type="text/javascript"&gt; google.setOnLoadCallback(draw_15a6f1d2a7556b357de0d315596aa96c); function draw_15a6f1d2a7556b357de0d315596aa96c() { var data = new google.visualization.DataTable({"cols":[{"id":"timestamp","label":"timestamp","pattern":"","type":"string"},{"id":"sy","label":"sy","pattern":"","type":"number"},{"id":"us","label":"us","pattern":"","type":"number"},{"id":"average_cpu","label":"average_cpu","pattern":"","type":"number"}],"rows":[{"c":[{"v":"1372249356","f":""},{"v":0,"f":""},{"v":4,"f":""},{"v":43,"f":""}]},{"c":[{"v":"1372249650","f":""},{"v":13,"f":""},{"v":46,"f":""},{"v":49,"f":""}]},{"c":[{"v":"1372249950","f":""},{"v":4,"f":""},{"v":45,"f":""},{"v":47,"f":""}]},{"c":[{"v":"1372250250","f":""},{"v":2,"f":""},{"v":19,"f":""},{"v":46,"f":""}]},{"c":[{"v":"1372250550","f":""},{"v":3,"f":""},{"v":46,"f":""},{"v":51,"f":""}]}]}); var chart = new google.visualization.LineChart(document.getElementById('draw_15a6f1d2a7556b357de0d315596aa96c')); chart.draw(data, {width: 800, height: 600}); } &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;div id="draw_15a6f1d2a7556b357de0d315596aa96c"&gt;&lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>Yet I have no idea why the X-axis is not showing up. I have looked into the DataTable Roles but could not find a reference to show the X-axis <a href="https://developers.google.com/chart/interactive/docs/roles?hl=ja#jsonliteral" rel="nofollow">https://developers.google.com/chart/interactive/docs/roles?hl=ja#jsonliteral</a> Nor does the LineChart documentation say which additional arguments have to be supplied. </p> <p>jsfiddle.net/WuLWF/ (When breaking it up in pieces according to Fiddle standard it did not work)</p> <p>Or perhaps my DataTable is wrong generated.</p> <p>Please guide me in the correct direction, Many thanks</p>
    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.
    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