Highcharts Tooltip

Demo, of tooltip that do not get destroyed.

by snoopliving

HTML

<script src="https://code.highcharts.com/highcharts.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>

<div class="chart-wrapper">


<figure class="highcharts-figure">
    <div id="container"></div>
</figure>
<figure class="highcharts-figure">
    <div id="container1"></div>

</figure>
<figure class="highcharts-figure">
    <div id="container2"></div>

</figure>
<figure class="highcharts-figure">
    <div id="container3"></div>
</figure>
</div>

CSS

.chart-wrapper {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;

  figure {
    height: 200px;
    width: 300px;
  }
}

JavaScript

const config = {
    title: {
        text: 'Tooltip Demo',
        align: 'left'
    },

    xAxis: {
        
    },
    yAxis: {
        title: {
            text: '-'
        }
    },
    credits: {
        enabled: false
    },
    series: [{
        name: 'Total production',
        data: Array.from({length: 1000}, () => Math.floor(Math.random() * 1001))
    }, {
        name: 'Gross consumption',
        data:Array.from({length: 1000}, () => Math.floor(Math.random() * 1001))
    }, {
        name: 'Trade surplus',
        data: Array.from({length: 1000}, () => Math.floor(Math.random() * 1001))
    }]
}

Highcharts.chart('container', config);
Highcharts.chart('container1', config);
Highcharts.chart('container2', config);
Highcharts.chart('container3', config);