Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <div id="container" style="height: 600px; width: 900px"></div>
- var cats = [];
- var data = [];
- $.get("http://test.controlcash.ru/get.php", function(resp){
- for (i=0; i<resp.length; i++) {
- cats.push(resp[i].x);
- data.push(resp[i].y);
- }
- }).done(function() {
- chart.xAxis[0].setCategories(cats);
- chart.series[0].setData(data);
- })
- var chart = new Highcharts.Chart({
- chart: {
- renderTo: 'container',
- marginBottom: 80
- },
- xAxis: {
- labels: {
- rotation: 90
- }
- },
- series: [{
- data: [0]
- }]
- });
- var cats = [];
- var data = [];
- $.get("http://test.controlcash.ru/get.php", function(resp){
- for (i=0; i<resp.length; i++) {
- cats.push(resp[i].x);
- data.push(resp[i].y);
- }
- }).done(function() {
- chart.xAxis[0].setCategories(cats);
- chart.series[0].setData(data);
- })
- var chart = new Highcharts.Chart({
- chart: {
- renderTo: 'container',
- marginBottom: 80
- },
- xAxis: {
- labels: {
- rotation: 90
- }
- },
- series: [{
- data: [0]
- }]
- });
- <?php
- $db = mysqli_connect("db_host", "db_user", "db_pass", "db_name");
- if ($result = mysqli_query($db, "select name, click from chart")) {
- while($obj = $result->fetch_object()){
- $array[]=array("x"=>$obj->name, "y"=>(int)$obj->click);
- }
- /* очищаем результирующий набор */
- mysqli_free_result($result);
- }
- mysqli_close($db);
- $ar_js = json_encode($array);
- header("HTTP/1.0 200 OK");
- header('Content-type: application/json; charset=utf-8');
- header("Cache-Control: no-cache, must-revalidate");
- header("Expires: Mon, 26 Jul 2017 05:00:00 GMT");
- header("Pragma: no-cache");
- echo $ar_js;
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement