Good afternoon! I use Google Chart to get the chart out, but I can not. I get the error in the console: *Using //@ to indicate sourceMappingURL pragmas is deprecated. Use //# instead* And on the browser I see "Table has no columns".
SQL-query are successful, CSN-saved, but you can not get the schedule. I ask to help to solve this problem. Thank you in advance. I enclose the code HTML: <!DOCTYPE html> <html> <head> <meta charset="utf8"> <title>Google Charts</title> <script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script> <script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script> <script type="text/javascript" src="js/script.js"></script> </head> <body> <div id="chart_div"></div> </body> </html> JS: google.charts.load('current', {'packages':['corechart']}); google.charts.setOnLoadCallback(drawChart); function drawChart() { var jsonData = $.ajax({ url: "data.php", dataType: "json", async: false }).responseText; var data = new google.visualization.DataTable(jsonData); var options = {'title':'How Much Pizza I Ate Last Night', 'width':400, 'height':300}; // Instantiate and draw our chart, passing in some options. var chart = new google.visualization.ColumnChart(document.getElementById('chart_div')); chart.draw(data, options); } PHP: <?php error_reporting(E_ALL); ini_set('display_errors', 1); $db = mysqli_connect('localhost','***','***', '***'); mysqli_set_charset($db, 'utf8'); function getDataString() { global $db; $query = "SELECT `interval_date`, `equivalent_balance` FROM `net_asset_value`"; $res = mysqli_query($db, $query); $data = '{"cols": ['; $data .= '{"label":"Interval","pattern":"","type":"date"},'; $data .= '{"label":"Balance","pattern":"","type":"number"}'; $data .= '],"rows": ['; while($row = mysqli_fetch_assoc($res)){ $data .= '{"c":[{"v":"' . $row['interval_date'] . '"},{"v":' . $row['equivalent_balance'] . '}]},'; } $data = rtrim($data, ','); $data .= ']}'; return $data; } echo getDataString(); ?> JSON: {"cols": [{"label":"Интервал","pattern":"","type":"date"},{"label":"Баланс","pattern":"","type":"number"}],"rows": [{"c":[{"v":"13.06.2017"},{"v":0}]},{"c":[{"v":"14.06.2017"},{"v":1500000}]},{"c":[{"v":"15.06.2017"},{"v":1499993}]},{"c":[{"v":"16.06.2017"},{"v":1500356}]},{"c":[{"v":"17.06.2017"},{"v":1500742}]},{"c":[{"v":"18.06.2017"},{"v":1501129}]},{"c":[{"v":"19.06.2017"},{"v":1501507}]},{"c":[{"v":"20.06.2017"},{"v":1501881}]},{"c":[{"v":"21.06.2017"},{"v":1502253}]},{"c":[{"v":"22.06.2017"},{"v":1502626}]},{"c":[{"v":"23.06.2017"},{"v":1502984}]},{"c":[{"v":"24.06.2017"},{"v":1503358}]},{"c":[{"v":"25.06.2017"},{"v":1503731}]},{"c":[{"v":"26.06.2017"},{"v":1504097}]},{"c":[{"v":"27.06.2017"},{"v":1504464}]},{"c":[{"v":"28.06.2017"},{"v":1504831}]},{"c":[{"v":"29.06.2017"},{"v":1505204}]},{"c":[{"v":"30.06.2017"},{"v":1505567}]},{"c":[{"v":"01.07.2017"},{"v":1505958}]},{"c":[{"v":"02.07.2017"},{"v":1506350}]},{"c":[{"v":"03.07.2017"},{"v":1506734}]},{"c":[{"v":"04.07.2017"},{"v":1507108}]},{"c":[{"v":"05.07.2017"},{"v":1507482}]},{"c":[{"v":"06.07.2017"},{"v":1507850}]},{"c":[{"v":"07.07.2017"},{"v":1508210}]},{"c":[{"v":"08.07.2017"},{"v":1508591}]},{"c":[{"v":"09.07.2017"},{"v":1508973}]},{"c":[{"v":"10.07.2017"},{"v":1509348}]},{"c":[{"v":"11.07.2017"},{"v":1509720}]},{"c":[{"v":"12.07.2017"},{"v":1510087}]},{"c":[{"v":"13.07.2017"},{"v":1510450}]},{"c":[{"v":"14.07.2017"},{"v":1509714}]},{"c":[{"v":"15.07.2017"},{"v":1510092}]},{"c":[{"v":"16.07.2017"},{"v":1510470}]},{"c":[{"v":"17.07.2017"},{"v":1510840}]},{"c":[{"v":"18.07.2017"},{"v":1511212}]},{"c":[{"v":"19.07.2017"},{"v":1511585}]},{"c":[{"v":"20.07.2017"},{"v":1511957}]},{"c":[{"v":"21.07.2017"},{"v":1512312}]},{"c":[{"v":"22.07.2017"},{"v":1512691}]},{"c":[{"v":"23.07.2017"},{"v":1513070}]},{"c":[{"v":"24.07.2017"},{"v":1513441}]},{"c":[{"v":"25.07.2017"},{"v":1513814}]},{"c":[{"v":"26.07.2017"},{"v":1514186}]},{"c":[{"v":"27.07.2017"},{"v":1514560}]},{"c":[{"v":"28.07.2017"},{"v":1514924}]},{"c":[{"v":"29.07.2017"},{"v":1515314}]},{"c":[{"v":"30.07.2017"},{"v":1515704}]},{"c":[{"v":"31.07.2017"},{"v":1516086}]}]} -- 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 https://groups.google.com/group/google-visualization-api. To view this discussion on the web visit https://groups.google.com/d/msgid/google-visualization-api/fde1c31c-c339-4aea-9623-9ecd3a8eff8f%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
