on part 3 of hw3

This commit is contained in:
2019-09-23 10:55:26 -06:00
parent b71254dc56
commit 417f1e2113
7 changed files with 296 additions and 8 deletions

View File

@@ -5,6 +5,11 @@
*/
function staircase() {
// ****** TODO: PART II ******
let bar = document.getElementById("chart1").children[0].children;
for(let i = 0; i < bar.length; i++){
bar[i].style.height = (i+1) * 10;
}
}
/**
@@ -28,9 +33,18 @@ function update(data) {
// ****** TODO: PART III (you will also edit in PART V) ******
// TODO: Select and update the 'a' bar chart bars
let aBars = document.getElementById("chart1").children[0].children;
for(let i = 0; i < aBars.length; i++){
console.log(aScale(data[i].a));
d3.select("chart1").select("barChart").selectAll('rect').attr('height', aScale(data[i].a));
aBars[i].height = aScale(data[i].a);
}
// TODO: Select and update the 'b' bar chart bars
let bBars = document.getElementById("chart2").children[0].children;
for(let i = 0; i < bBars.length; i++){
bBars[i].height = bScale(data[i].b);
}
// TODO: Select and update the 'a' line chart path using this line generator
let aLineGenerator = d3.line()