0

ハイチャートは初めてで、ハイチャートグラフを使用していますが、ボリュームが表示されません.MACDを削除してからボリュームを表示すると、なぜこの問題が発生するのかわかりません!. 私のコードは

$.getJSON('http://www.highcharts.com/samples/data/jsonp.php?filename=aapl-c.json&callback=?', function(data) {
    var ohlc = [],
        volume = [],
        dataLength = data.length;

    for (i = 0; i < dataLength; i++) {
        ohlc.push([
            data[i][0], // the date
            data[i][1], // open
            data[i][2], // high
            data[i][3], // low
            data[i][4] // close
        ]);

        volume.push([
            data[i][0], // the date
            data[i][5] // the volume
        ])
    }

    // set the allowed units for data grouping
    var groupingUnits = [[
        'week',                         // unit name
        [1]                             // allowed multiples
    ], [
        'month',
        [1, 2, 3, 4, 6]
    ]];
$(function() {
    $('#container').highcharts('StockChart', {

        title : {
            text : 'MACD of AAPL stock price'
        },

        subtitle: {
            text: 'From may 15, 2006 to May 10, 2013'
        },

        yAxis: [{
            title: {
                text: 'Price'
            },
            height: 200,
            plotLines: [{
                value: 0,
                width: 1,
                color: '#808080'
            }]
        }, {
            title: {
                text: 'MACD'
            },
            top: 320,
            height: 100,
            offset: 0,
            lineWidth: 2
        }, {
            title: {
                text: 'Volume'
            },
            top: 500,
            height: 60,
            offset: 0,
            lineWidth: 2
        }],

        tooltip: {
            crosshairs: true,
            shared: true
        },

        rangeSelector : {
            selected : 1
        },

        legend: {
            enabled: true,
            layout: 'vertical',
            align: 'right',
            verticalAlign: 'middle',
            borderWidth: 0
        },

        plotOptions: {
            series: {
                marker: {
                    enabled: false,
                }
            }
        },

        series : [{
           name: 'AAPL Stock Price',
            type : 'line',
            id: 'primary',
            data : data
        }, {
            name : 'MACD',
            linkedTo: 'primary',
            yAxis: 1,
            showInLegend: true,
            type: 'trendline',
            algorithm: 'MACD'

        }, {
            type: 'candlestick',
            name: 'AAPL',

            data: ohlc,
            dataGrouping: {
                units: groupingUnits
            }
        }, {
            type: 'column',
            name: 'Volume',
            linkedTo: 'primary',
            data: volume,
            yAxis: 1,
            dataGrouping: {
                units: groupingUnits
            }
        }, {
            name: 'Histogram',
            linkedTo: 'primary',
            yAxis: 1,
            showInLegend: true,
            type: 'histogram'

        }]
    });
});

});

出力グラフ

ボリュームが表示されないのはなぜですか? 前もって感謝します!

4

1 に答える 1

0

3 つの yAxis がありますが、各シリーズ (最初を除く) で を使用しますyAxis:1。これは、シリーズがその軸に表示されることを意味します。したがって、「最後の」yAxis に表示するように軸インデックスを変更する必要があります。

于 2014-04-08T09:48:35.370 に答える