javascript - Highcharts : Change opacity of a column chart

标签 javascript css highcharts

使用 highchart 时,我需要更改堆栈图中列的不透明度。因为我需要透明

<script type="text/javascript">
    $(function () {
        $('#trend').highcharts({
            chart: {
                type: 'column'
            },
            title: {
                text: 'Weight Oscillation Projection'
            },
            xAxis: {
                categories: ['1st Week', '2nd Week', '3rd Week', '4th Week', '5th Week', '6th Week']
            },
            yAxis: {
                title: {
                    text: 'Weight (Kg)'
                },
                stackLabels: {
                    enabled: false,                    
                }
            },
            legend: {
                enabled: false,  
            },
            tooltip: {
                enabled: false,
            },
            plotOptions: {
                column: {
                    stacking: 'normal',
                    dataLabels: {
                        enabled: false,                        
                    }
                },                    
            },
            series: [{
                name: 'Jane',
                data: [2, 2, 3, 2, 1],                   
            }, {
                name: 'Joe',
                data: [3, 4, 4, 2, 5],
                color: '#fff',
                style: {opacity: 0.0}  
            }]
        });
    });    
</script>

我知道系列 -> 数据对象没有更改样式的属性。我们怎么能做这样的事情呢?

最佳答案

使用 rgba format更改不透明度。

例子:

color: 'rgba(255, 255, 255, 0.50)'

引用

Semi-transparent colors in Highcharts are given in the rgba format rgba(255,255,255,1). The last parameter is the alpha or opacity that ranges from 0, fully transparent, to 1, fully opaque. Because of this, there are no separate opacity options in the Highcharts API.

关于javascript - Highcharts : Change opacity of a column chart,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24035938/

相关文章:

javascript - 我需要一个单选按钮的事件触发器,因为它未被选中,因为另一个按钮被选中

javascript - 如何突然停止线性动画 jQuery UI slider 句柄(跨浏览器)

javascript - Highcharts:多系列柱形图中的位置散点图

html - 如何创建像 Treehouse 这样的左侧导航栏?

javascript - 更改元素高度在第二次按下时不起作用

javascript - 扩展 Highmaps 副作用

jquery - Highcharts 中的堆叠区域使我的系列淡入和淡出

javascript - 获取 415 Unsupported Media Type REST 客户端的响应状态

javascript - 如何运行 setInterval 在中断之前循环并尝试最多 10 次?

javascript - 在 jQuery 中解析类的返回值或包含选择器