Highcharts: Ugly Candlesticks

2019-08-04 12:46发布

My Candlestick chart imports data from a json file. Everything is great when I don't mess with the file

Original Timeframe Candlestick

But when I use php to exclude some json rows to filter the data, I will end up with this even when every value on chart is correct.

Ugly Candlestick

How can I fix it?

My settings

(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条回答
登录 后发表回答