JSFiddle - React, Tailwind, and code Playground

by zauberware

HTML

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

<div id="activities_chart" style="width: 100%; height: 340px;"></div>

JavaScript

$(function () {
     
    var title_activities = "Activities",
        source_activities = "My source",
        link_activities = "http://www.highcharts.com",
        credits_databasis_str_activities = "215",
        activities_category_names = ["eat", "read", "surf in internet"],
        activities_category_data = [{y:66.15, drilldown:{name:"eat - How often?", data:[["1 time per day", 21], ["3 times per day", 45], ["2 times per day", 27], ["2 times a week", 3], ["≥ 3 times a week", 5], ["less", 4], ["every other week", 3], ["1 times a week", 7], ["not specified", 6], ["once a month", 6]]}}, {y:67.71, drilldown:{name:"read - How much time?", data:[["2h per day", 11], ["1h per day", 41], ["less often", 6], ["2h per week", 8], ["1/2h per day", 38], ["1h per week", 10], ["3h per week", 4], ["≥ 3h per day", 5], ["not specified", 7]]}}, {y:59.38, drilldown:{name:"surf in internet - How much time?", data:[["2h per day", 31], ["1h per week", 1], ["2h per week", 2], ["1h per day", 37], ["1/2h per day", 20], ["≥ 3h per day", 13], ["less often", 3], ["not specified", 5], ["3h per week", 2]]}}],
        room_filter_name = "Living Room"

    var colors = Highcharts.getOptions().colors,
            categories = activities_category_names,
            name = 'Activities',
            data = activities_category_data
    
    function setChart(chart, options) {

            var max = chart.series.length;
            for (var i = 0; i < max; i++) {
              chart.series[0].remove(false);
            }

            chart.xAxis[0].setCategories(options.categories, false);
            
            chart.addSeries({
                type: options.type,
                name: options.name,
                data: options.data,
                color: colors[0]
            }, false);

            
            //chart.options.spacingRight = 35; //not working
            //chart.yAxis.title = "Test"; //not working
            chart.redraw();
        }
    
        var chart = new...