Search code examples
highchartsangular2-highcharts

Highcharts bar chart configuration to increase height and round edges


In an Angular 4 project I am using the angular2-highcharts library to create a stacked bar chart. The following object is the configuration I have so far.

{
  title: { text: '' },
  xAxis: {
    categories: [''],
    crosshair: true,
    visible: false
  },
  yAxis: {
    min: 0,
    max: 100,
    title: {
      text:  ''
    },
    labels: {
      enabled: true
    },
    visible: false
  },
  chart: {
    type: 'bar',
    backgroundColor: 'rgba(255, 255, 255, 0.1)'
  },
  legend: {
    enabled: false
  },
  plotOptions: {
    column: {
      pointPadding: 0,
      borderWidth: 0,
      stacking: 'normal',
      dataLabels: {
        enabled: true,
        formatter: function() {
          return this.point.y + '%';
        },
        inside: true
      },
      enableMouseTracking: false,
    },
    series: {
      stacking: 'normal',
      dataLabels: {
        enabled: true,
        formatter: function () {
          if (this.point.y) {
            return this.point.y + '%';
          }
          return '';
        },
        style: { fontSize: '10px' },
        padding: 10
      },
      borderWidth: 0
    }
  },
  series: [{
    name: 'Pending',
    data: ...,
    color: '#ff4233'
    }, {
    name: 'Executed',
    data: ...,
    color: '#34d788'
    }, {
    name: 'Cancelled',
    data: ...,
    color: '#8f8c87'
    }]
}

and this produces this visual result -> enter image description here

I need to transform this into -> enter image description here

As you see in the desired result the chart has more height and also its edges are round. That I don't know how to do.


Solution

  • Have you tried to use rounded-corners plugin? With it you can use following properties:

    borderRadiusTopLeft, borderRadiusTopRight, borderRadiusBottomRight and borderRadiusBottomLeft

    Plugin Reference:
    https://github.com/highcharts/rounded-corners

    Example:
    http://jsfiddle.net/3Lhzx8ao/