JSFiddle - React, Tailwind, and code Playground

by stitot

HTML

<script src="https://code.highcharts.com/highcharts.js"></script>
<script src="https://code.highcharts.com/dashboards/2/datagrid.js"></script>
<script src="https://code.highcharts.com/dashboards/2/dashboards.js"></script>
<script src="https://code.highcharts.com/dashboards/2/modules/layout.js"></script>
<script src="https://code.highcharts.com/modules/accessibility.js"></script>

<h1 class="dg-background" id="title">MicroElement amount in Foods</h1>
<div class="dg-background">
  <button id="load-0">
  Load 1st Chart
  </button>
  <button id="load-1">
  Load 2nd Chart
  </button>
  <button id="load-2">
  Load Datagrid
  </button>
</div>
<div id="container"></div>

CSS

@import url("https://code.highcharts.com/css/highcharts.css");
@import url("https://code.highcharts.com/dashboards/css/datagrid.css");
@import url("https://code.highcharts.com/dashboards/css/dashboards.css");

h1#title {
    padding-top: 10px;
    margin: 0;
    text-align: center;
    color: #fff;
}

.dg-background {
  background-color: #3d3d3d;
}

.dg-background button {
  margin-left: 10px;
  margin-top: 10px;
}

#kpi-vitamin-a .highcharts-dashboards-component-title::before,
#kpi-iron .highcharts-dashboards-component-title::before {
    width: 14px;
    height: 14px;
    border-radius: 28px;
    display: inline-block;
    padding: 0;
    margin-right: 4px;
    background-color: var(--highcharts-color-0);
    content: " ";
}

#kpi-iron .highcharts-dashboards-component-title::before {
    background-color: var(--highcharts-color-2);
}

#kpi-vitamin-a .highcharts-dashboards-component-kpi-subtitle,
#kpi-iron .highcharts-dashboards-component-kpi-subtitle {
    margin-top: 10px;
    font-size: 1.2em;
    color: var(--highcharts-neutral-color-60);
}

#kpi-vitamin-a .highcharts-dashboards-component-kpi-value,
#kpi-iron .highcharts-dashboards-component-kpi-value {
    font-size: 4em;
    line-height: 2.4rem;
    margin-top: 10px;
    color: var(--highcharts-color-0);
}

#kpi-iron .highcharts-dashboards-component-kpi-value {
    color: var(--highcharts-color-2);
}

#dashboard-col-1 .highcharts-color-0 {
    fill: var(--highcharts-color-2);
    stroke: var(--highcharts-color-2);
}

#kpi-vitamin-a .highcharts-dashboards-component-kpi-value::after,
#kpi-iron .highcharts-dashboards-component-kpi-value::after {
    content: "micrograms";
    display: block;
    font-size: 1rem;
}

.highcharts-plot-line {
    stroke-dasharray: 2px;
    stroke: var(--highcharts-color-3);
}

.highcharts-plot-line-label {
    fill: var(--highcharts-color-3);
}

.highcharts-description {
    padding: 0 20px;
}

#dashboard-col-2 {
    height: 323px;
}

#kpi-vitamin-a,
#kpi-iron {
    flex: 1 1...

JavaScript

const board = Dashboards.board('container', {
    dataPool: {
        connectors: [{
            id: 'micro-element',
            type: 'JSON',
            options: {
                firstRowAsNames: false,
                columnNames: ['Food', 'Vitamin A',  'Iron'],
                data: [
                    ['Beef Liver', 6421, 6.5],
                    ['Lamb Liver', 2122, 6.5],
                    ['Cod Liver Oil', 1350, 0.9],
                    ['Mackerel', 388, 1],
                    ['Tuna', 214, 0.6]
                ]
            }
        }]
    },
    editMode: {
        enabled: true,
        contextMenu: {
            enabled: true
        }
    },
    gui: {
        layouts: [{
            rows: [{
                cells: [{
                    id: 'dashboard-col-0'
                }, {
                    id: 'dashboard-col-1'
                }]
            }, {
                cells: [{
                    id: 'dashboard-col-2'
                }]
            }]
        }]
    },
    components: [{
    		id: 'chart1',
        sync: {
            visibility: true,
            highlight: true,
            extremes: true
        },
        connector: {
            columnAssignment: [{
                seriesId: 'Vitamin A',
                data: ['Food', 'Vitamin A']
            }]
        },
        renderTo: 'dashboard-col-0',
        type: 'Highcharts',
        chartOptions: {
            xAxis: {
                type: 'category',
                accessibility: {
                    description: 'Groceries'
                }
            },
            yAxis: {
                title: {
                    text: 'mcg'
                },
                plotLines: [{
                    value: 900,
                    zIndex: 7,
                    dashStyle: 'shortDash',
                    label: {
                        text: 'RDA',
                        align: 'right',
                        style: {
                            color:...