Make bar rounded echarts

4.3k views Asked by At

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

2

There are 2 answers

2
多一点点爱 On BEST ANSWER

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 ]
                }
            }
        }]
    };
0
Shahnad S On
options = {
        xAxis: {
            type: 'category',
            data: ['June ’22', 'July ’22',]
        },
        yAxis: {
            type: 'value'
        },
        series: [
            {
                data: [
                    
                    {
                        value: 140,
                        itemStyle: {
                            color: '#80CBC4',
                            barBorderRadius: 5,
                        },
                      
                    },  {
                        value: 250,
                        itemStyle: {
                            color: '#CE93D8',
                            barBorderRadius: 5,
                        }
                    }
],
                type: 'bar',
                barWidth: '40%'
            }
        ]
    };