document.addEventListener("DOMContentLoaded", function() { var options = { chart: { height: 350, type: "treemap", zoom: { enabled: false }, toolbar: { show: false }, events: { mounted: function(chartContext, config) { setTimeout(() => { document.getElementsByClassName("apexcharts-subtitle-text")[0].addEventListener('click', clickDiv); }, 1000); } } }, title: { text: "Budget Function (Fiscal Year 2025)", 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: [ { data: [ { x: 'Medicare', y: 638627381121 }, { x: 'National Defense', y: 583011493571 }, { x: 'Social Security', y: 543860571213 }, { x: 'Health', y: 534866250841 }, { x: 'Net Interest', y: 398516135005 }, { x: 'Income Security', y: 252446326715 }, { x: 'Veterans Benefits and Services', y: 137837583083 }, { x: 'General Government', y: 89159717246 }, { x: 'Commerce and Housing Credit', y: 59080031898 }, { x: 'Education, Training, Employment, and Social Services', y: 57115495726 }, { x: 'Transportation', y: 51883674095 }, { x: 'Unreported Data', y: 50735475316 }, { x: 'Energy', y: 45722211569 }, { x: 'Natural Resources and Environment', y: 42538743448 }, { x: 'Administration of Justice', y: 33365121144 }, { x: 'Agriculture', y: 23419208517 }, { x: 'International Affairs', y: 16591828364 }, { x: 'General Science, Space, and Technology', y: 12220413953 } ] } ] } var chart = new ApexCharts( document.querySelector("#chart"), options ); chart.render(); function clickDiv() { console.log("https://govstats.us/metric/bf-fy25"); } });