Highcharts:丑陋的烛台

时间:2015-12-14 08:49:44

标签: javascript php json highcharts

我的烛台图表从json文件导入数据。当我不弄乱文件时,一切都很棒

Original Timeframe Candlestick

但是当我使用php排除一些json行来过滤数据时,即使图表上的每个值都正确,我也会这样做。

Ugly Candlestick

我该如何解决?

我的设置

(function () {
//    $.getJSON('https://www.highcharts.com/samples/data/jsonp.php?a=e&filename=aapl-ohlc.json&callback=?', function (data) {
            $.getJSON(<?php echo "'getJSON.php?symbol=" . $_GET["symbol"] . "&timeframe=" . $_GET["timeframe"] . "'"; ?>, function (data) {

        // create the chart
        $('#container').highcharts('StockChart', {
            rangeSelector : {
                selected : 1,
                                buttons: [{
                                    type: 'minute',
                                    count: 1,
                                    text: '1m'
                                }, {
                                    type: 'minute',
                                    count: 5,
                                    text: '5m'
                                }, {
                                    type: 'minute',
                                    count: 30,
                                    text: '30m'
                                }, {
                                    type: 'hour',
                                    count: 1,
                                    text: '1h'
                                }, {
                                    type: 'hour',
                                    count: 5,
                                    text: '5h'
                                }, {
                                    type: 'all',
                                    text: 'All'
                                }]
            },

            title : {
                text : <?php echo "'" . $_GET["symbol"] . " Price | " . $_GET["timeframe"] . "M'" ?>
            },

            series : [{
                type : 'candlestick',
                name : <?php echo "'" . $_GET["symbol"] . " Price'"; ?>,
                data : data,
                dataGrouping : {
                                    enable: false
                }
            }]
        });
    });
});

0 个答案:

没有答案