Skip to content

Commit b450eed

Browse files
committed
added number and randomize data
1 parent 67bdb3d commit b450eed

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

function.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ function createChart() {
5353
})
5454
.attr("y", function (d) {
5555
var val = h - heightScale(d);
56-
console.log(val);
5756
if (val > 20) {
5857
return val;
5958
} else {
@@ -72,7 +71,6 @@ document.getElementById("random-data").addEventListener("click", function () {
7271
for (var i = 0; i < 15; i++) {
7372
data.push(Math.floor(Math.random() * 100) + 1);
7473
}
75-
console.log(data);
7674
svg.remove();
7775
createChart();
7876
});
@@ -93,7 +91,13 @@ function selectionSort() {
9391
temp = data[i];
9492
data[i] = smallest;
9593
data[pos] = temp;
96-
94+
var smi = bandScale(smallest);
95+
svg.selectAll("rect").each(function (d, i) {
96+
console.log(d3.select(this).attr("height"));
97+
if (smi == d3.select(this).attr("height")) {
98+
console.log(smi);
99+
}
100+
});
97101
var swooshAudio = new Audio(
98102
"/algorithm-visualizer/sound-effects/swoosh.mp3"
99103
);

0 commit comments

Comments
 (0)