JSFiddle - React, Tailwind, and code Playground

by Michel Penke

HTML

<script src="https://code.highcharts.com/highcharts.js"></script>
<script src="https://code.highcharts.com/modules/data.js"></script>
<script src="https://code.highcharts.com/modules/exporting.js"></script>
<div id="container" style="min-width: 310px; height: 400px; margin: 0 auto"></div>
<table id="datatable">
    <thead>
        <tr>
            <th></th>
            <th>Jane</th>
            <th>John</th>
        </tr>
    </thead>
    <tbody>
        <tr>
            <th>Apples</th>
            <td>3,4</td>
            <td>4,24</td>
        </tr>
        <tr>
            <th>Pears</th>
            <td>-1,2</td>
            <td>-1,5</td>
        </tr>
        <tr>
            <th>Plums</th>
            <td>5,1</td>
            <td>11,1</td>
        </tr>
        <tr>
            <th>Bananas</th>
            <td>-1,1</td>
            <td>-1,1</td>
        </tr>
        <tr>
            <th>Oranges</th>
            <td>-3,12</td>
            <td>-2,9</td>
        </tr>
    </tbody>
</table>

JavaScript

$(function () {
    $('#container').highcharts({
        data: {
            table: 'datatable',
            parsed: function (column) {
                for (var b = 0; b < column.length; b++) {
                    if (b !== 0) {
                        for (var i = 0; i < column[b].length; i++) {
                            if (i !== 0 && typeof column[b][i] === 'string') {
                                column[b][i] = parseFloat(column[b][i].replace(',', '.'));
                            }
                        }
                    }
                }
            }
        },
    });
});