document.addEventListener("alpine:init",(()=>{Alpine.data("progressBar",(()=>({scrollProgress(){document.addEventListener("scroll",(()=>{var t=(document.body.scrollTop||document.documentElement.scrollTop)/(document.documentElement.scrollHeight-document.documentElement.clientHeight)*100;this.$el.style.width=t+"%";let e=document.getElementById("jump-to-top");e&&(t<70?(e.classList.contains("opacity-100")&&e.classList.remove("opacity-100"),e.classList.add("opacity-0")):(e.classList.contains("opacity-0")&&e.classList.remove("opacity-0"),e.classList.add("opacity-100")))}))}})))}));; function redrawTable(refreshType, tableName, chart, label) { if(refreshType === "alternative"){ interactionType = 'drill-down'; chart.data = eval("secondData_" + tableName); }else{ interactionType = 'drill-up'; chart.data = eval("firstData_" + tableName); } data_layer_object = { 'event': 'visualization_navigation', 'clickText': label, 'reportSection': chart.canvas.ariaLabel, 'visualizationText': chart.canvas.title, 'interactionType': interactionType, } window.dataLayer = window.dataLayer || []; window.dataLayer.push(data_layer_object); chart.update(); } function subLabelText(text, x, y, type = "text",color){ if(type === "image"){ var img = document.getElementById(text); // When image loaded, you can then draw it on the canvas. ctx.textAlign = "right"; //console.log(x.getPixelForValue(1)) ctx.drawImage(img, x, y-10, 25, 18); }else{ ctx.font = "bolder 12px sans-serif"; ctx.fillStyle = color; ctx.textAlign = "left"; ctx.fillText(text, x+10, y); } } function downloadDataViz(chartId){ const imageLink = document.createElement('a'); const canvas = document.getElementById(chartId); imageLink.download = ''; imageLink.href = canvas.toDataURL('image/png',1); imageLink.click(); };