document.addEventListener("DOMContentLoaded", function() { var options = { chart: { height: 350, type: "line", zoom: { enabled: false }, toolbar: { show: false }, events: { mounted: function(chartContext, config) { setTimeout(() => { document.getElementsByClassName("apexcharts-subtitle-text")[0].addEventListener('click', clickDiv); }, 1000); } } }, title: { text: "Customs and Border Patrol Encounters (10-year)", align: 'left', margin: 0, offsetX: 0, offsetY: 0, floating: false, style: { fontSize: '14px', fontWeight: 'bold', fontFamily: undefined, color: '#263238' } }, subtitle: { text: '© govstats.us', align: 'right', margin: 0, offsetX: 0, offsetY: 45, // 295 floating: true, style: { fontSize: '11px', fontWeight: 'normal', fontFamily: undefined, color: '#AAA', background: '#FFF' }, }, series: [ { name: "Nationwide Total", data: [591830, 690430, 526790, 686070, 1147480, 646800, 1956520, 2766580, 3201140, 2901140] }, { name: "Southwest Land Border", data: [444860, 558990, 415200, 519940, 977230, 458080, 1734680, 2378940, 2475670, 2135000] }, { name: "USBP Nationwide", data: [337120, 415820, 310530, 404140, 859500, 405040, 1662170, 2214650, 2063690, 1557320] }, { name: "OFO Nationwide", data: [254710, 274620, 216260, 281930, 287980, 241760, 294350, 551930, 1137450, 1343820] } ], xaxis: { categories: [2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022, 2023, 2024] } } var chart = new ApexCharts( document.querySelector("#chart"), options ); chart.render(); function clickDiv() { console.log("https://govstats.us/metric/cbp-10yr"); } });