highcharts分散有4个象限

use*_*468 7 javascript jquery highcharts

免责声明:我对使用这些图表框架非常陌生,而且我对javascript也不是很棒.

我在这里使用高图创建了一个散点图.

它必须改变,有4个颜色象限像这样一个在这里.

问题是这个没有负y轴和正y轴,我不能为我的生活弄清楚如何在数据中间的某处发生这种情况.任何帮助是极大的赞赏.

Mar*_*ark 6

只是嘲笑了这个例子,基于以前的工作@jlbriggs.

在此输入图像描述

为了添加象限着色,我使用了绘制它chart.renderer(我找不到使用轴plotBands的更好方法):

function(chart) { // on complete

    var width = chart.plotBox.width / 2.0;
    var height = chart.plotBox.height / 2.0 + 1;

    chart.renderer.rect(chart.plotBox.x,                      
                            chart.plotBox.y, width, height, 1)
            .attr({
                fill: 'lightblue',
                zIndex: 0
            })
            .add();

     chart.renderer.rect(chart.plotBox.x + width,                      
                         chart.plotBox.y, width, height, 1)
            .attr({
                fill: 'yellow',
                zIndex: 0
            })
            .add();

    chart.renderer.rect(chart.plotBox.x,                      
                        chart.plotBox.y + height, width, height, 1)
            .attr({
                fill: 'yellow',
                zIndex: 0
            })
            .add();

    chart.renderer.rect(chart.plotBox.x + width,                      
                        chart.plotBox.y + height, width, height, 1)
            .attr({
                fill: 'lightblue',
                zIndex: 0
            })
            .add();        
});
Run Code Online (Sandbox Code Playgroud)