在HighChart中为框图的每个部分设置单个颜色



我想以不同的颜色的盒子和底部的顶部和盒子的底部以及每个盒子(区域(的晶须的顶部和晶须的顶部。但是盒子中的所有线条均以相同的颜色(红色(和晶须的顶部和底部为颜色相同(绿色(

实时演示,并带有复制步骤

 Highcharts.chart('container', {
        chart: {
            type: 'boxplot'
        },
        title: {
            text: 'All Patients'
        },
        legend: {
            enabled: true
        },
        xAxis: {
            categories: ['Asia Pacific', 'Europe', 'Latin America', 'North America', 'SWAC'],
            title: {
                text: '      '
            }
        },
        yAxis: {
            title: {
                text: 'Annual Center Volume 2016'
            },
            tickInterval: 5,
            min: 0,
            max: 75
            //plotLines: [{
            //    value: 932,
            //    color: 'red',
            //    width: 1,
            //    label: {
            //        text: 'Theoretical mean: 932',
            //        align: 'center',
            //        style: {
            //            color: 'gray'
            //        }
            //    }
            //}]
        },
        plotOptions: {
            boxplot: {
                fillColor: '#F0F0E0',
                lineWidth: 2,
                upperQuartileColor: 'green',
                lowerQuartileColor: 'green',
                medianColor: '#0C5DA5',
                medianWidth: 3,
                stemColor: '#A63400',
                stemDashStyle: 'solid',
                stemWidth: 1,
                whiskerColor: '#3D9200',
                whiskerLength: '20%',
                whiskerWidth: 3                 
            }
        },
        series: [{
            name: 'Region Runs',
            showInLegend: false,
            color: 'red',
            data: [
                [2, 4, 18, 43, 53],
                [5, 9, 16.5, 32, 52],
                [1, 3, 6, 11.5, 21],
                [3, 9, 20, 38, 73],
                [1, 2, 8, 16, 20]
            ],
            tooltip: {
                headerFormat: '<em>Experiment No {point.key}</em><br/>'
            }
        },
        {
            name: '75th Percentile',
            type: 'line', 
            color: 'red',
            marker: {
                symbol: 'square'
            },
            
        },
        {
            name: 'Median',
            type: 'line',
            color:'#0C5DA5',
            marker: {
                symbol: 'square'
            },
            
        },
        {
            name: '25th Percentile',
            type: 'line', 
            color: 'red',
            marker: {
                symbol: 'square'
            },
            
        },
        {
            name: '90th percentile',
            type: 'line',
            color: '#3D9200',
            marker: {
                symbol: 'square'
            },
            
        },{
            name: '10th percentile',
            type: 'line',
            color: '#3D9200',
            marker: {
                symbol: 'square'
            },
            
        }
        ]
    });
 <script src="https://code.highcharts.com/highcharts.js"></script>
        <script src="https://code.highcharts.com/highcharts-3d.js"></script>
        <script src="https://code.highcharts.com/modules/exporting.js"></script>
        <script src="https://code.highcharts.com/highcharts-more.js"></script>
        <script src="https://code.highcharts.com/modules/exporting.js"></script>
Box Plot Charts -->
  <div id="pdfContentHolder" style="margin:auto; width: 720px; height: 800px;">
       <div id="container" style="min-width: 310px; height: 400px; max-width: 800px; margin: 0 auto" >
       </div>
  </div>

https://jsfiddle.net/hew8nq5u/

预先感谢!

当前不可能在HighCharts中具有盒底部和顶部的不同颜色。与顶部和底部晶须相同。这是 github essue 的解释和增强命题(https://github.com/highcharts/highcharts/highcharts/issues/6796(:

当前每个盒子都是单个SVG形状,并且边框由 较小边缘不能"分开"的中风参数。作为一个 结果,您只能应用单颜色。

您的目标需要重建框架的核心,因此我们不能威胁 作为错误,但功能请求。

最新更新