foreach ($last_object as $point) { if (!$first) { echo ",\n"; } $first = false; echo "[" . $point->x . "," . $point->y . "]"; } ?> ]); var options = { legend: 'none', hAxis: { minValue: 0, maxValue: 1 }, vAxis: { minValue: 0, maxValue: 1 }, curveType: 'function', pointSize: 10, }; var chart = new google.visualization.LineChart(document.getElementById('chart_div')); chart.draw(data, options); } </script> </head> <body> <div>Orientation: <?php echo round(rad2deg($tr->ret_orientation_in_radians())); ?> degrees</div> <div id="chart_div" style="width: 900px; height: 506px;"></div> </body> </html>