高清内部日与ajax json php数据

时间:2014-07-20 03:49:07

标签: php jquery json highcharts

我一直在尝试使用ajax json php数据创建一个高图日内图表,但没有运气。请看一下我的代码。

chart.php:

//Filename: chart.php
<script type="text/javascript">
$(function() {

    $.getJSON('http://yourdomain.com/json.php', function(data) {

        // create the chart
        $('#container').highcharts('StockChart', {


            title: {
                text: 'AAPL stock price by minute'
            },

            xAxis: {
                gapGridLineWidth: 0
            },

            rangeSelector : {
                buttons : [{
                    type : 'hour',
                    count : 1,
                    text : '1h'
                }, {
                    type : 'day',
                    count : 1,
                    text : '1D'
                }

                /*, {
                    type : 'all',
                    count : 1,
                    text : 'All'
                }*/

                ],
                selected : 1,
                inputEnabled : false
            },

            series : [{
                name : 'AAPL',
                type: 'area',
                data : data,
                gapSize: 5,
                tooltip: {
                    valueDecimals: 2
                },
                fillColor : {
                    linearGradient : {
                        x1: 0, 
                        y1: 0, 
                        x2: 0, 
                        y2: 1
                    },
                    stops : [
                        [0, Highcharts.getOptions().colors[0]], 
                        [1, Highcharts.Color(Highcharts.getOptions().colors[0]).setOpacity(0).get('rgba')]
                    ]
                },
                threshold: null
            }]
        });
    });
});

</script>

json.php:

//Filename: json.php
$arr = array( array(1405578572,2.3,373.25,372.3,2.15),
          array(1405589777,3.3,373.25,372.3,3.15),
          array(1405649399,4.3,373.25,372.3,4.15),
          array(1405649843,5.3,373.25,372.3,5.15),
          array(1405649896,2.3,373.25,372.3,2.15)
);
echo json_encode($arr);

我已尽力而为但我无法使用json数据获得高图日内图表。

请使用PHP帮助我获取高图日内图表示例样本。

非常感谢任何帮助。

0 个答案:

没有答案