Highstock区域类型对比图需要完全显示区域

时间:2013-07-31 04:53:01

标签: highcharts highstock

我有一个“区域”类型的比较图表。我希望其中一个系列是区域,其他系列是这样的一行

![预期比较表] [1] https://docs.google.com/file/d/0B9CP3yK--vZSRDVRUFFHeVhDQzQ/edit?usp=sharing

但是使用highstock我会得到这样的图表

无论如何都要在图表上完全绘制区域。

提前致谢。

编辑: - 我使用了以下代码

$(function() {
var seriesOptions = [],
    yAxisOptions = [],
    seriesCounter = 0,
    names = ['MSFT', 'AAPL', 'GOOG'],
    colors = Highcharts.getOptions().colors;

$.each(names, function(i, name) {

    $.getJSON('http://www.highcharts.com/samples/data/jsonp.php?filename='+ name.toLowerCase() +'-c.json&callback=?',   function(data) {
        if(name == 'AAPL'){
        seriesOptions[i] = {
            name: name,
            data: data,
            type : "area"
        };
        }else{
                seriesOptions[i] = {
            name: name,
            data: data,
            type : "line"
        };
        }

        // As we're loading the data asynchronously, we don't know what order it will arrive. So
        // we keep a counter and create the chart when all the data is loaded.
        seriesCounter++;

        if (seriesCounter == names.length) {
            createChart();
        }
    });
});



// create the chart when all data is loaded
function createChart() {

    $('#container').highcharts('StockChart', {
        chart: {
        },

        rangeSelector: {
            selected: 4
        },

        yAxis: {
            labels: {
                formatter: function() {
                    return (this.value > 0 ? '+' : '') + this.value + '%';
                }
            },
            plotLines: [{
                value: 0,
                width: 2,
                color: 'silver'
            }]
        },

        plotOptions: {
            series: {
                compare: 'percent'
            }
        },

        tooltip: {
            pointFormat: '<span style="color:{series.color}">{series.name}</span>: <b>{point.y}</b> ({point.change}%)<br/>',
            valueDecimals: 2
        },

        series: seriesOptions
    });
}

});

Here是我的小提琴

1 个答案:

答案 0 :(得分:0)

您需要修改threshold参数。