48. 48
換行符
● 用來辨認換新一行的特殊符號
● Windows: rn
● UNIX: n
The greater my wisdom, then
greater my grief.n
To increase knowledge onlyn
increases sorrow.n
n
Ecclesiastes 1:18
The greater my wisdom, the
greater my grief.
To increase knowledge only
increases sorrow.
Ecclesiastes 1:18
The greater my wisdom, the
greater my grief. To increase
knowledge only increases
sorrow.Ecclesiastes 1:18
UNIX系統上的樣子
Windows系統上的樣子
原始檔
Why?
87. 87
var data = { children: rawData };
var pack = d3.layout.pack();
pack = pack.padding(2)
.size([1024, 768])
.sort(function (a, b) {
return b.value - a.value;
}); // set the layout
var nodes = pack.nodes(data);
nodes = nodes.filter(function(it) { return it.parent; });
var color = d3.scale.category20(); // helper function to
pick color
89. 89
d3.select('svg')
.selectAll('circle') // select existing circles, or create a placeholder
.data(nodes) // parse the data
.enter() // bind the data
.append('circle') // create circle if placeholder exists
.attr({
cx: function (d) { return d.x; },
cy: function (d) { return d.y; },
r: function (d) { return d.r; }
fill: function (d) { return color(d.schoolName); },
stroke: '#444'
}).append('svg:title').text(function (d) {
return d.schoolName + 'n$' +
Number(d.value.toFixed(1)).toLocaleString(); // format the number
to currency
}); // using title attribute to simulate tooltip
注意x, y, r在資料轉變前還
不存在
(如果有人欠揍,資料有key叫x, y or z怎辦?)