diff --git a/app/views/dashboard/bar_graph.html.erb b/app/views/dashboard/bar_graph.html.erb index ed8c550..8c8041c 100644 --- a/app/views/dashboard/bar_graph.html.erb +++ b/app/views/dashboard/bar_graph.html.erb @@ -1,54 +1,85 @@ -
- + + + \ No newline at end of file +function initializeBarChart() { + // Check if Google Charts visualization is already loaded + if (typeof google !== 'undefined' && google.visualization && google.visualization.ColumnChart) { + drawChart3(); + window.barChartLoaded = true; + } else if (typeof google !== 'undefined' && google.load && !window.barChartLoaded) { + // Load Google Charts + google.load("visualization", "1", { + packages: ["corechart"], + callback: function() { + drawChart3(); + window.barChartLoaded = true; + } + }); + } else { + console.error('Google JSAPI not available'); + } +} + +// Initialize immediately (page is already loaded when this partial loads via AJAX) +initializeBarChart(); +