Highcharts Demo

author(s): Torstein Hønsi

by Santosh Giridhara

HTML

<script src="https://code.highcharts.com/highcharts.js"></script>
  <script src="https://code.highcharts.com/modules/xrange.js"></script>
<script src="https://code.highcharts.com/modules/exporting.js"></script>

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

CSS

@import 'https://code.highcharts.com/css/highcharts.css';
#container {
  min-width: 300px;
  max-width: 800px;
  height: 300px;
  margin: 1em auto;
}

.highcharts-xrange-series .highcharts-point {
  stroke-width: 1px;
  stroke: gray;
}

.highcharts-partfill-overlay {
  fill: #010101;
  fill-opacity: 0.3;
}

.highcharts-data-label text {
  fill: white;
  text-shadow: 1px 1px black, -1px 1px black, -1px -1px black, 1px -1px black;
}

JavaScript

//var partialFill = parseFloat(75/150).toFixed(2);
//alert(partialFill);
Highcharts.chart('container', {
  chart: {
    type: 'xrange',
    styledMode: true,
    height: 80
  },
  title: {
    text: ''
  },
  credits: {
    enabled: false
  },
  exporting: {
    enabled: false
  },
  xAxis: {
    offset: -2,
    tickPositions: [0, 150]
  },
  yAxis: {
    title: {
      text: ''
    },
    type: 'category',
    reversed: true,
    visible:false
  },
  series: [{
    showInLegend: false,
    pointWidth: 25,
    borderColor: 'gray',
    color: '#CCC',
    colorIndex:[3],
    data: [{
      x: 0,
      x2: 150,
      y: 0,
      partialFill:parseFloat(25/150)
    }],
    dataLabels: {
      enabled: true,
      formatter: function() {
        return  ' Points'
      }
    }
  }]

});