Highcharts Demo

author(s): Torstein Hønsi

by AbhishekRohan

HTML

<script src="https://code.highcharts.com/highcharts.js"></script>
<script src="https://code.highcharts.com/highcharts-more.js"></script>
<script src="https://code.highcharts.com/modules/solid-gauge.js"></script>

<div id="container">
</div>

CSS

/*#container {
  width: 400px;
  height: 400px;
}*/

JavaScript

const chart = Highcharts.chart('container', { 
  chart: {
    type: 'solidgauge',
    marginTop: 50,
    events: {
    	load () {
      	const chart = this
        const el = document.querySelector('.highcharts-tracker > path.highcharts-point')
        const {x, y, width, height } = el.getBBox()

        chart.shadow = chart
        .renderer.image('http://i.imgur.com/frVkXOh.png', x+10, y+50, width, height)
        .attr({ zIndex: 10 })
        .add()
      },
    	redraw () {
      	const chart = this
        const el = document.querySelector('.highcharts-tracker > path.highcharts-point')
				const {x, y, width, height } = el.getBBox()
        
      	chart.shadow.attr({ x: x+10, y: y + 50, width, height })
      }
    }
  },

  title: {
    text: 'Activity',
    style: {
      fontSize: '24px'
    }
  },

  tooltip: {
    borderWidth: 0,
    backgroundColor: 'none',
    shadow: false,
    style: {
      fontSize: '16px'
    },
    pointFormat: '{series.name}<br><span style="font-size:2em; color: {point.color}; font-weight: bold">{point.y}%</span>',
    positioner: function(labelWidth) {
      return {
        x: 200 - labelWidth / 2,
        y: 180
      };
    }
  },

  pane: {
    startAngle: 0,
    endAngle: 360,
    background: []
  },

  plotOptions: {
    solidgauge: {
      animation: false,
      dataLabels: {
        enabled: false
      },
      linecap: 'round',
      stickyTracking: false,
      rounded: true
    }
  },

  yAxis: {
    min: 0,
    max: 100,
    lineWidth: 0,
    tickPositions: []
  },

  series: [{
    name: 'Something',
    data: [{
      color: '#e76a0b',
      radius: '112%',
      innerRadius: '88%',
      y: 100,
      borderColor: '#e76a0b'
    }, {
      color: '#007272',
      radius: '112%',
      innerRadius: '88%',
      y: 40,
      borderColor: '#007272'
    }]
  }]
})