-
Notifications
You must be signed in to change notification settings - Fork 0
si619 lab4 notes
Yuan Li edited this page Jul 12, 2019
·
18 revisions
For security reasons, browsers don't allow loading external files such as our data.csv. There are a few different ways to fix this, one of which is to set up a local server.
- On the mac, open terminal and navigate to the "inclass" folder. Then execute on of the above commands depending on your python version. InthePowerShellwindow,type:
python -m SimpleHTTPServer 8000
OR
python3 -m http.server
- In Google Chrome, type: localhost:8000 in your browser address bar and hit enter.
scale functions: D3 offers several useful functions that do the calculations for us. These are broadly called scale functions.
scale types: D3 offers the following types of scale types:
- Scales with continuous input and continuous outputs (e.g., scaleLinear, scaleTime)
- Scales with continuous input and discrete outputs (e.g., scaleQuantile )
- Scales with discrete input and discrete outputs (e.g., scaleOrdnial, scaleBand)
forEach(): 方法对数组的每个元素执行一次提供的函数。
var array1 = ['a', 'b', 'c'];
array1.forEach(function(element) {
console.log(element);
});
// expected output: "a"
// expected output: "b"
// expected output: "c"