JSFiddle - React, Tailwind, and code Playground

by J. Albert Bowden

HTML

<script src="http://code.highcharts.com/highcharts.js"></script>
<script src="http://code.highcharts.com/highcharts-more.js"></script>
<script src="http://code.highcharts.com/modules/exporting.js"></script>
<div id="container" style="min-width: 310px; max-width: 600px; height: 400px; margin: 0 auto"></div>

JavaScript

$(function () {

    var chart = new Highcharts.Chart({
        chart: {
            type: 'waterfall',
            renderTo: 'container'
        },

        title: {
            text: 'Highcharts Waterfall'
        },

        xAxis: {
            type: 'category'
        },

        yAxis: {
            title: {
                text: 'USD'
            }
        },

        legend: {
            enabled: false
        },

        tooltip: {
            pointFormat: '<b>${point.y:,.2f}</b> USD'
        },

        plotOptions: {
            series: {
                dataLabels: {
                    enabled: true,
                    formatter: function () {
                        return Highcharts.numberFormat(this.y, 0, ',') + 'k';
                    },
                    style: {
                        fontSize: 11,
                        color: 'white'
                    }
                },
                pointPadding: 0
            }
        },

        series: [{
            color: Highcharts.getOptions().colors[0],
            data: [{
                name: 'Start',
                y: 5
            }, {
                name: 'Product Revenue',
                y: 10
            }, {
                name: 'Service Revenue',
                y: 0.5
            }, {
                name: 'Fixed Costs',
                y: 3
            }, {
                name: 'Variable Costs',
                y: 5
            }]
        }]
    },

    function (chart) {
        var points = chart.series[0].points;

        for (var i = 0; i < points.length; i++) {

            if (points[i].shapeArgs.height <= 11) {
                // place dataLabel of this point outside and change color
                var y = points[i].dataLabel.y;
                
                y-=10;
                
                points[i].dataLabel
                .css({
                    color: 'red'
                })
                .attr({
                    y: y
               ...