-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgift-bar1.js
48 lines (34 loc) · 1001 Bytes
/
gift-bar1.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
d3.json("bar1.json", function (data){
//d3.xml("").mimeType("image/svg+xml").get(function(error, xml) {
// if (error) throw error;
//
// d3.selectAll("svg.bar1").insert(xml.documentElement);
//
//});
var y = d3.scaleLinear()
.domain([0,100])
.range([0, 300]);
var bar1 = d3.select("#bar1")
.selectAll("rect")
.data(data)
.enter().append("rect")
.attr("class", "bar")
.attr("width", 0)
.attr("height", 150)
.transition()
.delay(500)
.attr("width", function (d) { return y(d.x); });
d3.select("#mask1").append("img")
.attr("src","bar1-mask.svg")
.attr("width", 300)
.attr("height", 150);
//d3.xml("bar1-mask.svg", function(xml) {
// document.body.appendChild(xml.documentElement);
//
//
// d3.select("#mask1")
// .attr("width",300);
//
//
//});
});