Alex,
The problem is that the default format is not sufficient for this case.
You can override the default by specifying the axes.y.all.format.pattern,
something like this:
options = {
...
axes: { y: { all: { format: { pattern: '#.#' } } } }
}
On Fri, Feb 27, 2015 at 2:56 AM, alex scf <[email protected]> wrote:
> Hi all, im trying to plot a line graph using Google Line Chart. The graph
> is being plotted correctly. Picture below is the outcome. however the
> Y-axis displaying the number twice. Please advice how to solve this problem
> so that it only display the number once.
>
>
>
> <https://lh3.googleusercontent.com/-uNySPwUqBdo/VPAhlfx5pCI/AAAAAAAAACE/whIgIuu29do/s1600/time.png>
> My code:
> <?php
> include("Connect.php");
> $link=Connection();
> $result=mysqli_query($link, "select * from temp_log");
> mysqli_close($link);
>
> $table = array();
> $table['cols'] = array(
> array('id' => 'datetime', 'label' => 'Time', 'type' => 'string'),
> array('id' => 'temp1', 'label' => 'Temperature 1', 'type' => 'number'),
> array('id' => 'temp2', 'label' => 'Temperature 2', 'type' => 'number'),
> );
>
> $rows = array();
> foreach($result as $row){
> $temp = array();
> $temp[] = array('v' => $row['datetime']);
> $temp[] = array('v' => $row['temp1']);
> $temp[] = array('v' => $row['temp2']);
> $rows[] = array('c' => $temp);
> }
> $result->free();
> $table['rows'] = $rows;
> $jsonTable = json_encode($table, true);
> //echo $jsonTable;
>
> ?>
>
> <html>
> <head>
> <script type="text/javascript" src="https://www.google.com/jsapi
> "></script>
> <script type="text/javascript">
> google.load('visualization', '1.1', {packages: ['line']});
> google.setOnLoadCallback(drawChart);
>
> function drawChart() {
> var data = new google.visualization.DataTable(<?=$jsonTable?>);
>
> var options = {
> chart: {
> title: 'Latest 24 Hours Room Temperature',
> subtitle: 'in degree celsius (C)'
> },
> width: 1000,
> height: 500
> };
>
> var chart = new
> google.charts.Line(document.getElementById('linechart_material'));
>
> chart.draw(data, options);
> }
> </script>
> </head>
> <body>
> <div id="linechart_material" align="center"></div>
> </body>
> </html>
>
>
>
> --
> 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 [email protected].
> To post to this group, send email to
> [email protected].
> Visit this group at
> http://groups.google.com/group/google-visualization-api.
> For more options, visit https://groups.google.com/d/optout.
>
--
Daniel LaLiberte <https://plus.google.com/100631381223468223275?prsrc=2> -
978-394-1058
[email protected] <[email protected]> 5CC, Cambridge MA
[email protected] <[email protected]> 9 Juniper Ridge
Road, Acton MA
--
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/google-visualization-api.
For more options, visit https://groups.google.com/d/optout.