JSFiddle - React, Tailwind, and code Playground

by ccarns

HTML

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



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

JavaScript

$(function () {
    var chart;

    $(document).ready(function() {

        chart = new Highcharts.Chart({

            chart: {

                renderTo: 'container',

                zoomType: 'xy'

            },

            title: {

                text: 'Average Monthly Temperature and Rainfall in Tokyo'

            },

            subtitle: {

                text: 'Source: WorldClimate.com'

            },

            xAxis: [{

                categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',

                    'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']

            }],

            yAxis: [{ // Primary yAxis

                labels: {

                    formatter: function() {

                        return this.value +'°C';

                    },

                    style: {

                        color: '#89A54E'

                    }

                },

                title: {

                    text: 'Temperature',

                    style: {

                        color: '#89A54E'

                    }

                }

            }, { // Secondary yAxis

                title: {

                    text: 'Rainfall',

                    style: {

                        color: '#4572A7'

                    }

                },

                labels: {

                    formatter: function() {

                        return this.value +' mm';

                    },

                    style: {

                        color: '#4572A7'

                    }

                },

                opposite: true

            }],

            tooltip: {

                formatter: function() {

                    return ''+

                        this.x +': '+ this.y +

                        (this.series.name == 'Rainfall' ? ' mm' : '°C');

                }

            },

            legend: {

                layout: 'vertical',

                align: 'left',

                x: 120,

               ...