@plotdb/chart 0.0.3 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +11 -1
- package/build +11 -5
- package/dist/index.css +8 -0
- package/dist/index.js +607 -0
- package/dist/index.min.css +1 -0
- package/dist/index.min.js +1 -0
- package/package.json +12 -9
- package/src/{chart.ls → index.ls} +0 -0
- package/src/{chart.styl → index.styl} +0 -0
- package/web/src/pug/base.pug +1 -0
- package/web/src/pug/block/axis/0.0.1/index.ls +1 -7
- package/web/src/pug/block/axis-bubble/0.0.1/index.ls +1 -5
- package/web/src/pug/block/bar/0.0.1/index.ls +1 -5
- package/web/src/pug/block/bar-list/0.0.1/index.ls +1 -5
- package/web/src/pug/block/bar-race/0.0.1/index.ls +1 -5
- package/web/src/pug/block/base/0.0.1/index.ls +63 -64
- package/web/src/pug/block/blank/0.0.1/index.ls +1 -5
- package/web/src/pug/block/bubble/0.0.1/index.ls +4 -6
- package/web/src/pug/block/bubble/0.0.1/index.pug +14 -0
- package/web/src/pug/block/curve-bar/0.0.1/index.ls +1 -5
- package/web/src/pug/block/dumbbell/0.0.1/index.ls +1 -5
- package/web/src/pug/block/empty/0.0.1/index.ls +25 -24
- package/web/src/pug/block/gauge/0.0.1/index.ls +1 -5
- package/web/src/pug/block/line/0.0.1/index.ls +1 -6
- package/web/src/pug/block/number/0.0.1/index.ls +1 -5
- package/web/src/pug/block/percent-list/0.0.1/index.ls +1 -7
- package/web/src/pug/block/pie/0.0.1/index.ls +1 -5
- package/web/src/pug/block/pie-bubble/0.0.1/index.ls +1 -5
- package/web/src/pug/block/radar/0.0.1/index.ls +1 -5
- package/web/src/pug/block/scatter/0.0.1/index.ls +1 -5
- package/web/src/pug/block/sheet/0.0.1/index.ls +1 -5
- package/web/src/pug/block/table/0.0.1/index.ls +1 -5
- package/web/src/pug/block/taiwancounty/0.0.1/index.ls +1 -5
- package/web/src/pug/block/taiwantown/0.0.1/index.ls +1 -5
- package/web/src/pug/block/taiwanvillage/0.0.1/index.ls +1 -5
- package/web/src/pug/block/treemap/0.0.1/index.ls +1 -5
- package/web/src/pug/block/voronoi-treemap/0.0.1/index.ls +1 -5
- package/web/src/pug/block/wordcloud/0.0.1/index.ls +1 -5
- package/web/src/pug/block/worldmap/0.0.1/index.ls +1 -5
- package/web/src/styl/index.styl +6 -0
- package/web/static/block/axis/0.0.1/index.html +68 -73
- package/web/static/block/axis-bubble/0.0.1/index.html +205 -210
- package/web/static/block/bar/0.0.1/index.html +484 -489
- package/web/static/block/bar-list/0.0.1/index.html +188 -193
- package/web/static/block/bar-race/0.0.1/index.html +155 -160
- package/web/static/block/base/0.0.1/index.html +2 -2
- package/web/static/block/blank/0.0.1/index.html +35 -40
- package/web/static/block/bubble/0.0.1/index.html +377 -357
- package/web/static/block/curve-bar/0.0.1/index.html +126 -131
- package/web/static/block/dumbbell/0.0.1/index.html +160 -165
- package/web/static/block/empty/0.0.1/index.html +2 -2
- package/web/static/block/gauge/0.0.1/index.html +116 -121
- package/web/static/block/line/0.0.1/index.html +502 -507
- package/web/static/block/number/0.0.1/index.html +123 -128
- package/web/static/block/percent-list/0.0.1/index.html +263 -268
- package/web/static/block/pie/0.0.1/index.html +241 -246
- package/web/static/block/pie-bubble/0.0.1/index.html +295 -300
- package/web/static/block/radar/0.0.1/index.html +137 -142
- package/web/static/block/scatter/0.0.1/index.html +207 -212
- package/web/static/block/sheet/0.0.1/index.html +93 -98
- package/web/static/block/table/0.0.1/index.html +64 -70
- package/web/static/block/taiwancounty/0.0.1/index.html +180 -185
- package/web/static/block/taiwantown/0.0.1/index.html +104 -109
- package/web/static/block/taiwanvillage/0.0.1/index.html +114 -119
- package/web/static/block/treemap/0.0.1/index.html +296 -301
- package/web/static/block/voronoi-treemap/0.0.1/index.html +311 -316
- package/web/static/block/wordcloud/0.0.1/index.html +82 -87
- package/web/static/block/worldmap/0.0.1/index.html +186 -191
- package/web/static/css/index.css +6 -0
- package/web/static/css/index.min.css +1 -0
- package/web/static/index.html +1 -1
|
@@ -1,73 +1,67 @@
|
|
|
1
|
-
<div style="height:100%"><plug name="layout"></plug><script type="@plotdb/block">
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
version: '0.0.1',
|
|
9
|
-
extend: {
|
|
10
|
-
name: "empty",
|
|
11
|
-
version: "0.0.1"
|
|
12
|
-
},
|
|
13
|
-
dependencies: [
|
|
14
|
-
{
|
|
15
|
-
url: "/assets/lib/gridjs/main/gridjs.production.min.js"
|
|
16
|
-
}, {
|
|
17
|
-
url: "/assets/lib/gridjs/main/theme/mermaid.min.css"
|
|
18
|
-
}
|
|
19
|
-
]
|
|
1
|
+
<div style="height:100%"><plug name="layout"></plug><script type="@plotdb/block">module.exports = {
|
|
2
|
+
pkg: {
|
|
3
|
+
name: 'table',
|
|
4
|
+
version: '0.0.1',
|
|
5
|
+
extend: {
|
|
6
|
+
name: "empty",
|
|
7
|
+
version: "0.0.1"
|
|
20
8
|
},
|
|
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
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
data: raw.slice(1).concat((function(){
|
|
58
|
-
var i$, to$, ref$, results$ = [];
|
|
59
|
-
for (i$ = 0, to$ = (ref$ = 20 - raw.length) > 0 ? ref$ : 0; i$ <= to$; ++i$) {
|
|
60
|
-
results$.push(i$);
|
|
61
|
-
}
|
|
62
|
-
return results$;
|
|
63
|
-
}()).map(function(){
|
|
64
|
-
return [];
|
|
65
|
-
}))
|
|
66
|
-
}).forceRender();
|
|
9
|
+
dependencies: [
|
|
10
|
+
{
|
|
11
|
+
url: "/assets/lib/gridjs/main/gridjs.production.min.js"
|
|
12
|
+
}, {
|
|
13
|
+
url: "/assets/lib/gridjs/main/theme/mermaid.min.css"
|
|
14
|
+
}
|
|
15
|
+
]
|
|
16
|
+
},
|
|
17
|
+
init: function(arg$){
|
|
18
|
+
var root, context, pubsub, gridjs;
|
|
19
|
+
root = arg$.root, context = arg$.context, pubsub = arg$.pubsub;
|
|
20
|
+
gridjs = context.gridjs;
|
|
21
|
+
return pubsub.fire('init', {
|
|
22
|
+
layout: false,
|
|
23
|
+
prepareSvg: false,
|
|
24
|
+
mod: {
|
|
25
|
+
init: function(){
|
|
26
|
+
var grid;
|
|
27
|
+
this.grid = grid = new gridjs.Grid({
|
|
28
|
+
columns: [' ', ' ', ' ', ' ', ' '],
|
|
29
|
+
height: this.root.getBoundingClientRect().height + "px",
|
|
30
|
+
fixedHeader: true,
|
|
31
|
+
sort: true,
|
|
32
|
+
search: false,
|
|
33
|
+
resizable: true,
|
|
34
|
+
data: [].concat([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10].map(function(){
|
|
35
|
+
return [];
|
|
36
|
+
}))
|
|
37
|
+
});
|
|
38
|
+
return grid.render(this.root);
|
|
39
|
+
},
|
|
40
|
+
parse: function(){
|
|
41
|
+
var head, res$, k, raw;
|
|
42
|
+
res$ = [];
|
|
43
|
+
for (k in this.raw[0] || {}) {
|
|
44
|
+
res$.push(k);
|
|
67
45
|
}
|
|
46
|
+
head = res$;
|
|
47
|
+
head.length;
|
|
48
|
+
raw = this.raw;
|
|
49
|
+
console.log(raw);
|
|
50
|
+
return;
|
|
51
|
+
return this.grid.updateConfig({
|
|
52
|
+
columns: raw[0],
|
|
53
|
+
data: raw.slice(1).concat((function(){
|
|
54
|
+
var i$, to$, ref$, results$ = [];
|
|
55
|
+
for (i$ = 0, to$ = (ref$ = 20 - raw.length) > 0 ? ref$ : 0; i$ <= to$; ++i$) {
|
|
56
|
+
results$.push(i$);
|
|
57
|
+
}
|
|
58
|
+
return results$;
|
|
59
|
+
}()).map(function(){
|
|
60
|
+
return [];
|
|
61
|
+
}))
|
|
62
|
+
}).forceRender();
|
|
68
63
|
}
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
});</script></div>
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
};</script></div>
|
|
@@ -2,201 +2,196 @@
|
|
|
2
2
|
display: grid;
|
|
3
3
|
grid-template-columns: 1fr fit-content(5em);
|
|
4
4
|
}
|
|
5
|
-
</style><script type="@plotdb/block">
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
name:
|
|
12
|
-
version:
|
|
13
|
-
extend: {
|
|
14
|
-
name: "base",
|
|
15
|
-
version: "0.0.1"
|
|
16
|
-
},
|
|
17
|
-
dependencies: [
|
|
18
|
-
{
|
|
19
|
-
url: "https://d3js.org/topojson.v2.min.js",
|
|
20
|
-
async: false
|
|
21
|
-
}, {
|
|
22
|
-
url: "https://d3js.org/d3-geo.v2.min.js",
|
|
23
|
-
async: false
|
|
24
|
-
}, {
|
|
25
|
-
name: "pdmaptw",
|
|
26
|
-
version: "local",
|
|
27
|
-
path: "index.min.js",
|
|
28
|
-
async: false
|
|
29
|
-
}, {
|
|
30
|
-
name: "pdmaptw",
|
|
31
|
-
version: "local",
|
|
32
|
-
path: "county.map.js"
|
|
33
|
-
}
|
|
34
|
-
]
|
|
5
|
+
</style><script type="@plotdb/block">var mod;
|
|
6
|
+
module.exports = {
|
|
7
|
+
pkg: {
|
|
8
|
+
name: 'taiwancounty',
|
|
9
|
+
version: '0.0.1',
|
|
10
|
+
extend: {
|
|
11
|
+
name: "base",
|
|
12
|
+
version: "0.0.1"
|
|
35
13
|
},
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
}
|
|
79
|
-
},
|
|
80
|
-
dimension: {
|
|
81
|
-
name: {
|
|
82
|
-
type: 'N',
|
|
83
|
-
name: "國家"
|
|
84
|
-
},
|
|
85
|
-
color: {
|
|
86
|
-
type: 'R',
|
|
87
|
-
name: "顏色"
|
|
88
|
-
}
|
|
89
|
-
},
|
|
90
|
-
init: function(){
|
|
91
|
-
var scale, this$ = this;
|
|
92
|
-
this.g = this.layout.getGroup('view');
|
|
93
|
-
this.obj = new pdmaptw({
|
|
94
|
-
root: this.g,
|
|
95
|
-
type: 'county'
|
|
96
|
-
});
|
|
97
|
-
this.scale = scale = {
|
|
98
|
-
color: d3.interpolateTurbo
|
|
99
|
-
};
|
|
100
|
-
this.legend = new chart.utils.legend({
|
|
101
|
-
root: this.root,
|
|
102
|
-
name: 'legend',
|
|
103
|
-
layout: this.layout,
|
|
104
|
-
shape: function(d){
|
|
105
|
-
return d3.select(this).attr('fill', scale.color(d.key));
|
|
106
|
-
}
|
|
107
|
-
});
|
|
108
|
-
this.tip = new chart.utils.tip({
|
|
109
|
-
root: this.root,
|
|
110
|
-
accessor: function(arg$){
|
|
111
|
-
var evt, data;
|
|
112
|
-
evt = arg$.evt;
|
|
113
|
-
if (!(evt.target && (data = d3.select(evt.target).datum()))) {
|
|
114
|
-
return null;
|
|
115
|
-
}
|
|
14
|
+
dependencies: [
|
|
15
|
+
{
|
|
16
|
+
url: "https://d3js.org/topojson.v2.min.js",
|
|
17
|
+
async: false
|
|
18
|
+
}, {
|
|
19
|
+
url: "https://d3js.org/d3-geo.v2.min.js",
|
|
20
|
+
async: false
|
|
21
|
+
}, {
|
|
22
|
+
name: "pdmaptw",
|
|
23
|
+
version: "local",
|
|
24
|
+
path: "index.min.js",
|
|
25
|
+
async: false
|
|
26
|
+
}, {
|
|
27
|
+
name: "pdmaptw",
|
|
28
|
+
version: "local",
|
|
29
|
+
path: "county.map.js"
|
|
30
|
+
}
|
|
31
|
+
]
|
|
32
|
+
},
|
|
33
|
+
init: function(arg$){
|
|
34
|
+
var root, context, pubsub;
|
|
35
|
+
root = arg$.root, context = arg$.context, pubsub = arg$.pubsub;
|
|
36
|
+
return pubsub.fire('init', {
|
|
37
|
+
mod: mod({
|
|
38
|
+
context: context
|
|
39
|
+
})
|
|
40
|
+
}).then(function(it){
|
|
41
|
+
return it[0];
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
mod = function(arg$){
|
|
46
|
+
var context, chart, d3, ldcolor, pdmaptw, topojson;
|
|
47
|
+
context = arg$.context;
|
|
48
|
+
chart = context.chart, d3 = context.d3, ldcolor = context.ldcolor, pdmaptw = context.pdmaptw, topojson = context.topojson;
|
|
49
|
+
return {
|
|
50
|
+
sample: function(){
|
|
51
|
+
return pdmaptw.get('county').then(function(arg$){
|
|
52
|
+
var meta, topo;
|
|
53
|
+
meta = arg$.meta, topo = arg$.topo;
|
|
54
|
+
return {
|
|
55
|
+
raw: meta.name.map(function(it){
|
|
116
56
|
return {
|
|
117
|
-
|
|
118
|
-
|
|
57
|
+
val: Math.random(),
|
|
58
|
+
name: pdmaptw.normalize(it)
|
|
119
59
|
};
|
|
120
|
-
},
|
|
121
|
-
|
|
122
|
-
|
|
60
|
+
}),
|
|
61
|
+
binding: {
|
|
62
|
+
color: {
|
|
63
|
+
key: 'val'
|
|
64
|
+
},
|
|
65
|
+
name: {
|
|
66
|
+
key: 'name'
|
|
67
|
+
}
|
|
123
68
|
}
|
|
124
|
-
});
|
|
125
|
-
return this.obj.init().then(function(){
|
|
126
|
-
return this$.obj.fit({
|
|
127
|
-
node: this$.g,
|
|
128
|
-
box: this$.layout.getNode('view').getBoundingClientRect()
|
|
129
|
-
});
|
|
130
|
-
});
|
|
131
|
-
},
|
|
132
|
-
parse: function(){
|
|
133
|
-
var this$ = this;
|
|
134
|
-
this.extent = {
|
|
135
|
-
c: [undefined, undefined]
|
|
136
69
|
};
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
70
|
+
});
|
|
71
|
+
},
|
|
72
|
+
config: {
|
|
73
|
+
palette: {
|
|
74
|
+
type: 'palette'
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
dimension: {
|
|
78
|
+
name: {
|
|
79
|
+
type: 'N',
|
|
80
|
+
name: "國家"
|
|
148
81
|
},
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
82
|
+
color: {
|
|
83
|
+
type: 'R',
|
|
84
|
+
name: "顏色"
|
|
85
|
+
}
|
|
86
|
+
},
|
|
87
|
+
init: function(){
|
|
88
|
+
var scale, this$ = this;
|
|
89
|
+
this.g = this.layout.getGroup('view');
|
|
90
|
+
this.obj = new pdmaptw({
|
|
91
|
+
root: this.g,
|
|
92
|
+
type: 'county'
|
|
93
|
+
});
|
|
94
|
+
this.scale = scale = {
|
|
95
|
+
color: d3.interpolateTurbo
|
|
96
|
+
};
|
|
97
|
+
this.legend = new chart.utils.legend({
|
|
98
|
+
root: this.root,
|
|
99
|
+
name: 'legend',
|
|
100
|
+
layout: this.layout,
|
|
101
|
+
shape: function(d){
|
|
102
|
+
return d3.select(this).attr('fill', scale.color(d.key));
|
|
103
|
+
}
|
|
104
|
+
});
|
|
105
|
+
this.tip = new chart.utils.tip({
|
|
106
|
+
root: this.root,
|
|
107
|
+
accessor: function(arg$){
|
|
108
|
+
var evt, data;
|
|
109
|
+
evt = arg$.evt;
|
|
110
|
+
if (!(evt.target && (data = d3.select(evt.target).datum()))) {
|
|
111
|
+
return null;
|
|
112
|
+
}
|
|
161
113
|
return {
|
|
162
|
-
|
|
163
|
-
|
|
114
|
+
name: data.data.name,
|
|
115
|
+
value: data.data.color
|
|
164
116
|
};
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
return
|
|
168
|
-
});
|
|
169
|
-
if (this.cfg.palette) {
|
|
170
|
-
this.scale.color = d3.scaleLinear().domain(this.ticks.map(function(it){
|
|
171
|
-
return it.key;
|
|
172
|
-
})).range(pal.map(function(it){
|
|
173
|
-
return ldcolor.web(it.value || it);
|
|
174
|
-
}));
|
|
117
|
+
},
|
|
118
|
+
range: function(){
|
|
119
|
+
return this$.layout.getNode('view').getBoundingClientRect();
|
|
175
120
|
}
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
121
|
+
});
|
|
122
|
+
return this.obj.init().then(function(){
|
|
123
|
+
return this$.obj.fit({
|
|
124
|
+
node: this$.g,
|
|
125
|
+
box: this$.layout.getNode('view').getBoundingClientRect()
|
|
180
126
|
});
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
127
|
+
});
|
|
128
|
+
},
|
|
129
|
+
parse: function(){
|
|
130
|
+
var this$ = this;
|
|
131
|
+
this.extent = {
|
|
132
|
+
c: [undefined, undefined]
|
|
133
|
+
};
|
|
134
|
+
return d3.select(this.svg).selectAll('path').each(function(d, i){
|
|
135
|
+
d.data = this$.data.filter(function(it){
|
|
136
|
+
return it.name === d.properties.name;
|
|
137
|
+
})[0] || {};
|
|
138
|
+
if (!(this$.extent.c[0] != null) || d.data.color < this$.extent.c[0]) {
|
|
139
|
+
this$.extent.c[0] = d.data.color;
|
|
140
|
+
}
|
|
141
|
+
if (!(this$.extent.c[1] != null) || d.data.color > this$.extent.c[1]) {
|
|
142
|
+
return this$.extent.c[1] = d.data.color;
|
|
143
|
+
}
|
|
144
|
+
});
|
|
145
|
+
},
|
|
146
|
+
resize: function(){
|
|
147
|
+
var ref$, pal, len, this$ = this;
|
|
148
|
+
this.tip.toggle(((ref$ = this.cfg).tip || (ref$.tip = {})).enabled != null ? this.cfg.tip.enabled : true);
|
|
149
|
+
this.obj.fit(this.layout.getBox('view'));
|
|
150
|
+
pal = this.cfg.palette
|
|
151
|
+
? this.cfg.palette.colors
|
|
152
|
+
: ['#f00', '#999', '#00f'];
|
|
153
|
+
len = pal.length;
|
|
154
|
+
this.ticks = d3.quantize(function(it){
|
|
155
|
+
return (1 - it) * (this$.extent.c[1] - this$.extent.c[0]) + this$.extent.c[0];
|
|
156
|
+
}, len).map(function(it){
|
|
157
|
+
var that;
|
|
158
|
+
return {
|
|
159
|
+
key: it,
|
|
160
|
+
text: d3.format(this$.cfg.legendFormat || '.2f')(it) + ((that = this$.binding.color.unit) ? that : '')
|
|
161
|
+
};
|
|
162
|
+
});
|
|
163
|
+
this.ticks.sort(function(a, b){
|
|
164
|
+
return a.key - b.key;
|
|
165
|
+
});
|
|
166
|
+
if (this.cfg.palette) {
|
|
167
|
+
this.scale.color = d3.scaleLinear().domain(this.ticks.map(function(it){
|
|
168
|
+
return it.key;
|
|
169
|
+
})).range(pal.map(function(it){
|
|
170
|
+
return ldcolor.web(it.value || it);
|
|
171
|
+
}));
|
|
172
|
+
}
|
|
173
|
+
this.legend.data(this.ticks);
|
|
174
|
+
return this.obj.fit({
|
|
175
|
+
node: this.g,
|
|
176
|
+
box: this.layout.getBox('view')
|
|
177
|
+
});
|
|
178
|
+
},
|
|
179
|
+
render: function(){
|
|
180
|
+
var this$ = this;
|
|
181
|
+
d3.select(this.svg).selectAll('path').transition().duration(350).attr('fill', function(d, i){
|
|
182
|
+
return this$.scale.color(d.data.color);
|
|
183
|
+
}).attr('fill-opacity', function(d, i){
|
|
184
|
+
if (this$.cfg.dimEmpty) {
|
|
185
|
+
if (d.data.color != null) {
|
|
194
186
|
return 1;
|
|
187
|
+
} else {
|
|
188
|
+
return 0.2;
|
|
195
189
|
}
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
190
|
+
} else {
|
|
191
|
+
return 1;
|
|
192
|
+
}
|
|
193
|
+
});
|
|
194
|
+
return this.legend.render();
|
|
195
|
+
}
|
|
200
196
|
};
|
|
201
|
-
|
|
202
|
-
});</script></div>
|
|
197
|
+
};</script></div>
|