JSFiddle - React, Tailwind, and code Playground

by koh_edwin

HTML

<script src="https://code.highcharts.com/11.4.6"></script>
<!--script src="https://code.highcharts.com/highcharts-more.js"></script-->
<script src="https://code.highcharts.com/modules/exporting.js"></script>
<script src="https://code.highcharts.com/modules/export-data.js"></script>
<script src="https://code.highcharts.com/modules/accessibility.js"></script>

<figure class="highcharts-figure">
    <div id="container"></div>
    <p class="highcharts-description">
        Chart showing stacked horizontal bars. This type of visualization is
        great for comparing data that accumulates up to a sum.
    </p>
</figure>

CSS

.highcharts-figure,
.highcharts-data-table table {
    min-width: 310px;
    max-width: 800px;
    margin: 1em auto;
}

#container {
    height: 400px;
}

.confidenceClass {
	fill: black;
	stroke: white;
	stroke-width: 1px;
}

.highcharts-data-table table {
    font-family: Verdana, sans-serif;
    border-collapse: collapse;
    border: 1px solid #ebebeb;
    margin: 10px auto;
    text-align: center;
    width: 100%;
    max-width: 500px;
}

.highcharts-data-table caption {
    padding: 1em 0;
    font-size: 1.2em;
    color: #555;
}

.highcharts-data-table th {
    font-weight: 600;
    padding: 0.5em;
}

.highcharts-data-table td,
.highcharts-data-table th,
.highcharts-data-table caption {
    padding: 0.5em;
}

.highcharts-data-table thead tr,
.highcharts-data-table tr:nth-child(even) {
    background: #f8f8f8;
}

.highcharts-data-table tr:hover {
    background: #f1f7ff;
}

.highcharts-description {
    margin: 0.3rem 10px;
}

JavaScript

// Data retrieved from: https://ferjedatabanken.no/statistikk
console.log('HER')
Highcharts.chart('container', {
    chart: {
        type: 'bar'
    },
    //title: {
    //    text: 'Ferry passengers by vehicle type 2024',
    //    align: 'left'
    //},
    //xAxis: {
    //    categories: [
    //        'January', 'February', 'March', 'April', 'May'
    //    ]
    //},
    //yAxis: {
    //    min: 0,
    //    title: {
    //        text: ''
    //    }
    //},
    //legend: {
    //    reversed: true
    //},
    //plotOptions: {
    //    series: {
    //        stacking: 'normal',
    //        dataLabels: {
    //            enabled: false
    //        }
    //    }
    //},
    series: [{
        name: 'Motorcycles',
        data: [74, 27, 52, 93, 12]
    }],

},
    			function (chart) {
          console.log( chart.series[0].data)
//					const strokeWidth=3, strokeColor='white', strokeFill='black';
//				
//						  
//							let  i = 0,
//            					yAxis = chart.yAxis[0],
//            					r = chart.renderer,
//            					tickWidth =  chart.plotHeight/ chart.series[0].data.length,
//            					len = chart.series[0].data.length;
//            				
//							for (i = 0; i < len; i++) {
//									let confidenceIntervalLine= {
//										x1:chart.plotLeft + yAxis.translate(chart.series[0].data[i].total-5),
//										y1:chart.plotTop + (i+0.5)*tickWidth,
//										x2:chart.plotLeft + yAxis.translate(chart.series[0].data[i].total+5),
//										y2:chart.plotTop + (i+0.5)*tickWidth
//									} 
//                  let  
//									x1=confidenceIntervalLine.x1, y1=confidenceIntervalLine.y1, x2=confidenceIntervalLine.x2, y2=confidenceIntervalLine.y2, w=0.125*tickWidth;
//									
//									//horizontal bar:
//									chart.renderer.path(['M',  x1-1, y1-w-1, 'L', x1+1, y1-w-1, 
//										'L', x1+1, y1-1, 'L', x2-1, y2-1, 
//										'L', x2-1, y2-w-1, 'L', x2+1, y2-w-1,
//										'L', x2+1, y2+w+1, 'L', x2-1,...