From 1b0a02b39eb1ee1af3cec24ba48f0567e0080395 Mon Sep 17 00:00:00 2001 From: desafinadude Date: Tue, 3 Dec 2024 20:26:23 +0200 Subject: [PATCH] wip --- d3_script.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/d3_script.js b/d3_script.js index ea6a93b..5d50e42 100644 --- a/d3_script.js +++ b/d3_script.js @@ -642,12 +642,17 @@ document.addEventListener('DOMContentLoaded', function () { function drawChart(id, data, title, colors = [chart_colors.donut1, chart_colors.donut2, chart_colors.donut3]) { + + const container = d3.select(`#${id}`); const rect = container.node().getBoundingClientRect(); const width = rect.width; const height = rect.height; const margin = { top: 0, right: 0, bottom: 0, left: 0 }; const radius = Math.min(width, height) / 2 - Math.max(margin.top, margin.right); + + console.log('drawing', rect, width, height, radius); + // Set color scale let color = d3.scaleOrdinal() @@ -960,7 +965,7 @@ document.addEventListener('DOMContentLoaded', function () { } - + drawChart('fs', inside_outside_blank, 'FS'); drawChart('lp', inside_outside_blank, 'LP'); @@ -1396,8 +1401,6 @@ document.addEventListener('DOMContentLoaded', function () { if (section_label == 'outdoor-facilities') { console.log(section_label); - - drawChart('fs', inside_outside_blank, 'FS'); fadeChart('.province-chart', 1); activeData.fs = fs_inside_outside;