From 2be4e9b2094bffc1f7eea665922b2403c7252738 Mon Sep 17 00:00:00 2001 From: Gustavo Garcia Date: Sun, 2 Apr 2023 16:14:12 +0200 Subject: [PATCH] chore: better support different number of rings --- docs/radar.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/radar.js b/docs/radar.js index c19184fc..e7e7b2b5 100644 --- a/docs/radar.js +++ b/docs/radar.js @@ -117,8 +117,8 @@ function radar_visualization(config) { y: 15 * quadrants[quadrant].factor_y }; var cartesian_max = { - x: rings[3].radius * quadrants[quadrant].factor_x, - y: rings[3].radius * quadrants[quadrant].factor_y + x: rings[rings.length - 1].radius * quadrants[quadrant].factor_x, + y: rings[rings.length - 1].radius * quadrants[quadrant].factor_y }; return { clipx: function(d) { @@ -157,7 +157,7 @@ function radar_visualization(config) { var segmented = new Array(4); for (var quadrant = 0; quadrant < 4; quadrant++) { segmented[quadrant] = new Array(4); - for (var ring = 0; ring < 4; ring++) { + for (var ring = 0; ring < rings.length; ring++) { segmented[quadrant][ring] = []; } } @@ -169,7 +169,7 @@ function radar_visualization(config) { // assign unique sequential id to each entry var id = 1; for (var quadrant of [2,3,1,0]) { - for (var ring = 0; ring < 4; ring++) { + for (var ring = 0; ring < rings.length; ring++) { var entries = segmented[quadrant][ring]; entries.sort(function(a,b) { return a.label.localeCompare(b.label); }) for (var i=0; i