-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Resolve color palette initialization and syntax errors in visual…
…ization
- Loading branch information
Showing
1 changed file
with
7 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,12 +7,12 @@ | |
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/css/bulma.min.css" /> | ||
<script src="https://d3js.org/d3.v7.min.js"></script> | ||
<script> | ||
// Palette of 6 visually distinct colors that work well together | ||
const COLOR_PALETTE = ["#FF6B6B", "#4ECDC4", "#45B7D1", "#96CEB4", "#FFEEAD", "#D4A5A5"]; | ||
const animationQueue = new Map(); // Track ongoing animations per node | ||
let lastColorIndex = 0; // Start at 0 since we're using the first color for initialization | ||
const globalColors = [COLOR_PALETTE[0]]; // Initialize with first color | ||
const MAX_COLORS = 3; // Only show 3 most recent colors per node | ||
// Palette of 6 visually distinct colors that work well together | ||
const COLOR_PALETTE = ["#FF6B6B", "#4ECDC4", "#45B7D1", "#96CEB4", "#FFEEAD", "#D4A5A5"]; | ||
</script> | ||
<style> | ||
.link { | ||
|
@@ -136,13 +136,11 @@ <h1 class="title">Freenet Eventual Convergence Simulation</h1> | |
function drawPie(nodeGroup, allColors) { | ||
let displayColors; | ||
// For propagated colors, show only the most recent MAX_COLORS from global tracking | ||
// For propagated colors, show only the most recent MAX_COLORS from global tracking | ||
const visibleColors = allColors.filter(color => globalColors.includes(color)); | ||
displayColors = visibleColors.slice(-MAX_COLORS); | ||
// If no colors would be shown, keep the node's existing colors | ||
if (displayColors.length === 0) { | ||
displayColors = allColors; | ||
} | ||
const visibleColors = allColors.filter(color => globalColors.includes(color)); | ||
displayColors = visibleColors.slice(-MAX_COLORS); | ||
// If no colors would be shown, keep the node's existing colors | ||
if (displayColors.length === 0) { | ||
displayColors = allColors; | ||
} | ||
|
||
const arcs = pieGenerator(displayColors); | ||
|