D3
OG
Old school D3 from simpler times
All examples
By author
By category
About
darrenthomas-dev
Full window
Github gist
Bubble Sorted Bar Chart
<h1>Bubble Sorted Bar Chart</h1> <canvas id="bubblesort" width="650" height="220"></canvas> <p>Bubble sorted = <span></span></p> <p>Bubble sort code: <pre> const bubbleSort = nums => { let swap = true; do { swap = false; for (let i = 0; i < nums.length; i++) { if (nums[i] < nums[i + 1]) { const tmp = nums[i]; nums[i] = nums[i + 1]; nums[i + 1] = tmp; swap = true; } } } while (swap); return nums; }; </pre> </p>