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: "Producer Price Index (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: "Index Value", data: [ "110.0", "111.9", "114.8", "117.0", "119.2", "121.2", "133.579", "141.306", "142.713", "147.716" ] } ], xaxis: { categories: [ "2016", "2017", "2018", "2019", "2020", "2021", "2022", "2023", "2024", "2025" ] } } var chart = new ApexCharts( document.querySelector("#chart"), options ); chart.render(); function clickDiv() { console.log("https://govstats.us/metric/ppi-10yr"); } });