google.charts.load('current', { 'packages': ['bar'] });
        google.charts.setOnLoadCallback(drawChart);

        function drawChart() {
            var data = google.visualization.arrayToDataTable([
                ['Year', 'MSSQL', 'LDAP', 'UDP', 'Portmap', 'NetBios', 'BENIGN', 'Syn', 'UDPLag'],
                ['0', 0, 0, 0, 0, 0, 0, 0, 0], // Initial values are 0
                ['1', 0, 0, 0, 0, 0, 0, 0, 0],
                ['2', 0, 0, 0, 0, 0, 0, 0, 0]
            ]);

            var options = {
                chart: {
                    title: 'Dynamically calculating the statistical distribution of attack vectors (normal distribution, skew distribution)',
                },
                vAxis: {
                    title: '  ',
                    viewWindow: {
                        min: 0,
                        max: 100
                    }
                },
                height:350,
                hAxis: { title: ' ' },
                backgroundColor: '#0c212b',
                tooltip: { trigger: 'none' },
                colors: ['#0CB0B0', '#3F69B0', '#0C7DB1', '#0CB079', '#7276B0']
            };

            var chart = new google.charts.Bar(document.getElementById('columnInThreeChart'));

            function updateData() {
                var deviceId = localStorage.getItem('deviceId');
                // Check deviceId
                if (deviceId === 'xAq9W1PO5rmAuuQ' || deviceId === 'wzI0R1JqWqV0Lyi') {
                    // Generate random data if deviceId matches
                    for (var i = 0; i < 3; i++) {
                        for (var j = 1; j < 9; j++) {
                            data.setValue(i, j, Math.floor(Math.random() * 10)); // Random value between 0 and 80
                        }
                    }
                } else {
                    // Set data to 0 if deviceId does not match
                    for (var i = 0; i < 3; i++) {
                        for (var j = 1; j < 9; j++) {
                            data.setValue(i, j, 0);
                        }
                    }
                }

                // Draw chart
                chart.draw(data, google.charts.Bar.convertOptions(options));
            }

            // Initial draw
            updateData();

            // Update data every 2 seconds
            setInterval(updateData, 2000);
        }
