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
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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
|
var mv = function(mv) {
mv.charts = {};
var thinWidth = 250;
var medWidth = 400;
var wideWidth = Math.max(700, document.width - thinWidth - medWidth);
mv.charter = function() {
var charter = {};
charter.init = function() {
mv.charts.date = bar(monoGroup(wide(dc.barChart("#date-chart")), "date"))
.centerBar(true)
.elasticX(true)
.x(d3.time.scale().domain([mv.heap.date.dim.bottom(1)[0].date, mv.heap.date.dim.top(1)[0].date]).nice(d3.time.hour))
.xUnits(d3.time.hours)
.xAxisPadding(2)
;
mv.charts.pc = bar(monoGroup(wide(dc.barChart("#player-chart")), "pc"))
.x(d3.scale.linear().domain([mv.heap.pc.dim.bottom(1)[0].pc, mv.heap.pc.dim.top(1)[0].pc]).nice())
;
mv.charts.blvl = bar(monoGroup(med(dc.barChart("#blvl-chart")), "blvl"))
.x(d3.scale.linear().domain([0, mv.heap.blvl.dim.top(1)[0].pcstat.blvl]))
;
mv.charts.type = pie(monoGroup(dc.pieChart("#type-chart"), "type"))
;
mv.charts.target = pie(monoGroup(dc.pieChart("#target-chart"), "target"))
;
mv.charts.wpn = pie(monoGroup(dc.pieChart("#wpn-chart"), "wpn"))
;
mv.charts.def = pie(monoGroup(dc.pieChart("#def-chart"), "def"))
.label(function(d) { return defLevelVerbose(d.data.key); })
.title(function(d) { return defLevelVerbose(d.data.key) + ": " + d.value; })
.colorAccessor(function(d) { return d.data.key; })
.colorCalculator(function(k) { switch(k) {
case 0: return "#fd350d";
case 1: return "#fdae6b";
case 2: return "#6baed6";
default: throw "Definition chart: Color access key out of range!";
}})
.filter(2)
;
mv.charts.map = monoGroup(margined(wide(dc.bubbleChart("#map-chart"))), "map")
.height(500)
.colorCalculator(d3.scale.category20c())
/* X */
.keyAccessor(function(d) { return d.value.e + 1; })
/* Y */
.valueAccessor(function(d) { return d.value.j + 1; })
/* R */
.radiusValueAccessor(function(d) { return Math.sqrt(d.value.r); })
.maxBubbleRelativeSize(0.05)
.x(d3.scale.log().domain([1, 100000]))
.y(d3.scale.log().domain([1, 300000]))
.elasticX(true)
.elasticY(true)
.renderHorizontalGridLines(true)
.renderVerticalGridLines(true)
.title(function(d) { return "Map " + d.key + ":" + d.value.r; })
.renderTitle(true)
;
mv.charts.stats = trellisChart("#stat-chart", ["str", "agi", "vit", "dex", "int", "luk"].map(function(d) { mv.heap[d].name = d; return mv.heap[d]; }));
dc.renderlet(function() { mv.charts.stats(); });
dc.renderAll();
}
function defLevelVerbose(level) {
switch (level) {
case 0: return "Undefined";
case 1: return "Mixed";
case 2: return "Defined";
default: console.log(d, d.data); throw "Unknown definedness case (" + d.data.key + "); this shouldn't happen";
}
}
return charter;
}();
function wide(chart) {
return chart
.width(wideWidth)
;
}
function med(chart) {
return chart
.width(medWidth)
;
}
function thin(chart) {
return chart
.width(thinWidth)
;
}
function short(chart) {
return chart
.height(130)
;
}
function margined(chart) {
return chart
.margins({left: 60, right: 18, top: 5, bottom: 30})
}
function monoGroup(chart, name) {
return chart
.dimension(mv.heap[name].dim)
.group(mv.heap[name].group)
.transitionDuration(500)
;
}
function bar(chart) {
return margined(short(chart))
.elasticY(true)
.gap(1)
.renderHorizontalGridLines(true)
.title(function(d) { return d.key + ": " + d.value; })
.brushOn(true)
;
}
function pie(chart) {
return thin(chart)
.radius(90)
.colorCalculator(d3.scale.category20c())
;
}
return mv;
}(mv || {});
|