JSFiddle - React, Tailwind, and code Playground

by Henrik Skar

HTML

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

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

JavaScript

$(function() {
  $('#container').highcharts({
    chart: {
      type: 'bar'
    },
    
    title: {
      text: 'Fruits eaten'
    },

    series: [{
     	   name: 'John',
     	   id: 's1',
    	   data: [5, 3],
      },{
     		//Links to id s1
      	 linkedTo: 's1',
       	 name: 'John',
       	 data: [
         	   //Puts 0.4 percent to the third category which is in the second array position
             //of the categories
       		   [2, 0.4]
       	 ],
         //Assigns the percent to the second yAxis
       	 yAxis: 1,
       	 color: Highcharts.getOptions().colors[0]
      },{
       	 data: [3, 4],
       	 id: 's2',
       	 name: 'Joe'
      },{
       	 linkedTo: 's2',
         name: 'Joe',
         data: [
         	 	[2, 0.6]
         ],
         yAxis: 1,
       	 color: Highcharts.getOptions().colors[1]
      },{
         data: [2, 5],
         id: 's3',
         name: 'Jane'
      },{
         linkedTo: 's3',
         name: 'Jane',
         data: [
         		 [2, 0.7]
         ],
         yAxis: 1,
         color: Highcharts.getOptions().colors[2]
      },{
         data: [3, 0],
         id: 's4',
         name: 'Janet'
      },{
        linkedTo: 's4',
        name: 'Janet',
        data: [
         	 [2, 0.8]
        ],
        yAxis: 1,
        color: Highcharts.getOptions().colors[3]
      }
    ],

    plotOptions: {
      column: {
        dataLabels: {
          enabled: true
        }
      }
    },

    xAxis: {
      type: 'category',
      categories: ['Count A', 'Count B', 'Percent']
    },
    
    yAxis: [{
    	opposite: true
    }, {
      gridLineWidth: 0,
      opposite: false,
      title: {
        text: 'Percent'
      }
    }]
  });
});