javascriptechartsbaidungecharts

Make bar rounded echarts


Is there a way to make bar rounded on top in echarts? For ex in this example

I was able to found option roundCap for polar but unable to find anything for simple bar chart


Solution

  • Do you want to set 'border-radius'?

    var option = {
            xAxis: {
                type: 'category',
                data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
            },
            yAxis: {
                type: 'value'
            },
            series: [{
                data: [120, 200, 150, 80, 70, 110, 130],
                type: 'bar',
                itemStyle: {
                    emphasis: {
                        barBorderRadius: [50, 50]
                    },
                    normal: {
                        barBorderRadius: [50, 50, 0 ,0 ]
                    }
                }
            }]
        };