on part 3 of hw3
This commit is contained in:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user