JSFiddle - React, Tailwind, and code Playground

by sridhar reddy

HTML

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

<div id="container" style="min-width: 310px; height: 400px; margin: 0 auto"></div>

JavaScript

$(function () {
        $('#container').highcharts({
            chart: {
                type: 'column',
                inverted: false
            },
            title: {
                text: 'Bar chart with negative values'
            },
            xAxis: {
                categories: ['Apples', 'Oranges', 'Pears', 'Grapes', 'Bananas']
            },
            yAxis: {
            	labels: {
              	formatter: function() {
                	var label = Math.abs(this.value);
									console.log('label: ', this);
                	return `${label}%`;
              	}
              }
            },
            credits: {
                enabled: false
            },
            plotOptions: {
                series: {
                    stacking: 'normal'
                }
            },
            series: [{
                name: 'John',
                data: [5, 3, 0, 7, 2, -4, 6, -8]
            }]
        });
    });