在负值的红色背景

时间:2013-05-26 05:58:36

标签: highcharts

我正在努力完成这里显示的内容 http://jsfiddle.net/r7UsK/
基本上我想要在0标记下方的红色背景,以使负值更好地突出 这是我目前的版本
http://jsfiddle.net/7rpMt/
我做错了什么?

JS代码

chartItems = new Array();
chartItems.push(["Civilian Afterburner","2013-05-20 07:05:03","5841223.56"]);
chartItems.push(["Civilian Afterburner","2013-05-20 22:00:59","5841321.12"]);
chartItems.push(["Civilian Afterburner","2013-05-21 22:00:31","5841289.08"]);
chartItems.push(["Civilian Afterburner","2013-05-22 22:01:08","5841566.46"]);
<Data Sniped>
sorted = {};
        $.each(chartItems, function(){
            if(sorted[this[0]] == undefined) sorted[this[0]] = new Array();
            sorted[this[0]].push([Date.parse(this[1]), parseFloat(this[2])]);
        })
        series = []
        $.each(sorted, function(i){
                series.push({
                        type: 'spline',
            name: i,
            data: this,
            marker: {
                radius: 4
            }
                })
        })
        $('#container').highcharts({
            chart: {
            },
            title: {
                text: ''
            },
            xAxis: {
                type: 'datetime',
                dateTimeLabelFormats: { // don't display the dummy year
                    month: '%b %e',
                    year: '%b'
                }
            },
            yAxis: {
                title: {
                    text: 'Profit/Min'
                },
                plotBands: [{
                   from: -1000,
                   to: 0,
                   color: 'rgba(255, 0, 0, 0.5)'
                }]
            },
            series: series
        });

1 个答案:

答案 0 :(得分:0)

你的最小值小于-1000。再添加4个零。

plotBands: [{
  from: -10000000,
  to: 0,
  color: 'rgba(255, 0, 0, 0.5)'
}]

http://jsfiddle.net/7rpMt/1/