diff --git a/hw3/.idea/hw3.iml b/hw3/.idea/hw3.iml new file mode 100644 index 0000000..24643cc --- /dev/null +++ b/hw3/.idea/hw3.iml @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/hw3/.idea/misc.xml b/hw3/.idea/misc.xml new file mode 100644 index 0000000..28a804d --- /dev/null +++ b/hw3/.idea/misc.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/hw3/.idea/modules.xml b/hw3/.idea/modules.xml new file mode 100644 index 0000000..aa50f2a --- /dev/null +++ b/hw3/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/hw3/.idea/vcs.xml b/hw3/.idea/vcs.xml new file mode 100644 index 0000000..6c0b863 --- /dev/null +++ b/hw3/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/hw3/.idea/workspace.xml b/hw3/.idea/workspace.xml new file mode 100644 index 0000000..7992f49 --- /dev/null +++ b/hw3/.idea/workspace.xml @@ -0,0 +1,242 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + chart1 + + + + + + + + + + + + + + true + DEFINITION_ORDER + + + + + + + + + + + + + + + + + + + + Random Subset + Random Subset
@@ -96,7 +96,7 @@ - + diff --git a/hw3/script.js b/hw3/script.js index 9c83e8a..99fbe03 100644 --- a/hw3/script.js +++ b/hw3/script.js @@ -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()