nvd3-rails 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitmodules +3 -0
- data/README.md +101 -0
- data/lib/nvd3-rails.rb +1 -0
- data/lib/nvd3/rails.rb +8 -0
- data/lib/nvd3/rails/engine.rb +6 -0
- data/lib/nvd3/rails/version.rb +5 -0
- data/nvd3-rails.gemspec +21 -0
- data/vendor/assets/javascripts/nvd3-rails.js +7 -0
- data/vendor/assets/javascripts/nvd3/.git.sample/HEAD +1 -0
- data/vendor/assets/javascripts/nvd3/.git.sample/config +13 -0
- data/vendor/assets/javascripts/nvd3/.git.sample/description +1 -0
- data/vendor/assets/javascripts/nvd3/.git.sample/hooks/applypatch-msg.sample +15 -0
- data/vendor/assets/javascripts/nvd3/.git.sample/hooks/commit-msg.sample +24 -0
- data/vendor/assets/javascripts/nvd3/.git.sample/hooks/post-update.sample +8 -0
- data/vendor/assets/javascripts/nvd3/.git.sample/hooks/pre-applypatch.sample +14 -0
- data/vendor/assets/javascripts/nvd3/.git.sample/hooks/pre-commit.sample +50 -0
- data/vendor/assets/javascripts/nvd3/.git.sample/hooks/pre-push.sample +53 -0
- data/vendor/assets/javascripts/nvd3/.git.sample/hooks/pre-rebase.sample +169 -0
- data/vendor/assets/javascripts/nvd3/.git.sample/hooks/prepare-commit-msg.sample +36 -0
- data/vendor/assets/javascripts/nvd3/.git.sample/hooks/update.sample +128 -0
- data/vendor/assets/javascripts/nvd3/.git.sample/index +0 -0
- data/vendor/assets/javascripts/nvd3/.git.sample/info/exclude +6 -0
- data/vendor/assets/javascripts/nvd3/.git.sample/logs/HEAD +1 -0
- data/vendor/assets/javascripts/nvd3/.git.sample/logs/refs/heads/master +1 -0
- data/vendor/assets/javascripts/nvd3/.git.sample/logs/refs/remotes/origin/HEAD +1 -0
- data/vendor/assets/javascripts/nvd3/.git.sample/objects/pack/pack-babbb312d58dd7f03870b530a1b9a84c80918be3.idx +0 -0
- data/vendor/assets/javascripts/nvd3/.git.sample/objects/pack/pack-babbb312d58dd7f03870b530a1b9a84c80918be3.pack +0 -0
- data/vendor/assets/javascripts/nvd3/.git.sample/packed-refs +5 -0
- data/vendor/assets/javascripts/nvd3/.git.sample/refs/heads/master +1 -0
- data/vendor/assets/javascripts/nvd3/.git.sample/refs/remotes/origin/HEAD +1 -0
- data/vendor/assets/javascripts/nvd3/.gitignore +24 -0
- data/vendor/assets/javascripts/nvd3/LICENSE.md +49 -0
- data/vendor/assets/javascripts/nvd3/Makefile +56 -0
- data/vendor/assets/javascripts/nvd3/README.md +43 -0
- data/vendor/assets/javascripts/nvd3/build.bat +6 -0
- data/vendor/assets/javascripts/nvd3/deprecated/bar.html +198 -0
- data/vendor/assets/javascripts/nvd3/deprecated/bar.js +250 -0
- data/vendor/assets/javascripts/nvd3/deprecated/charts/cumulativeLineChart.js +174 -0
- data/vendor/assets/javascripts/nvd3/deprecated/charts/discreteBarChart.js +157 -0
- data/vendor/assets/javascripts/nvd3/deprecated/charts/lineChart.js +159 -0
- data/vendor/assets/javascripts/nvd3/deprecated/charts/lineChartDaily.js +168 -0
- data/vendor/assets/javascripts/nvd3/deprecated/charts/stackedAreaChart.js +177 -0
- data/vendor/assets/javascripts/nvd3/deprecated/cumulativeLine.html +171 -0
- data/vendor/assets/javascripts/nvd3/deprecated/cumulativeLine.js +334 -0
- data/vendor/assets/javascripts/nvd3/deprecated/discreteBarChartWithEnabledTooltip.html +129 -0
- data/vendor/assets/javascripts/nvd3/deprecated/discreteBarChartWithEnabledTooltip.js +222 -0
- data/vendor/assets/javascripts/nvd3/deprecated/discreteBarWithAxes.html +172 -0
- data/vendor/assets/javascripts/nvd3/deprecated/discreteBarWithAxes.js +152 -0
- data/vendor/assets/javascripts/nvd3/deprecated/lineChart-old.html +83 -0
- data/vendor/assets/javascripts/nvd3/deprecated/lineChartDaily.html +109 -0
- data/vendor/assets/javascripts/nvd3/deprecated/linePlusBar.html +173 -0
- data/vendor/assets/javascripts/nvd3/deprecated/linePlusBar.js +250 -0
- data/vendor/assets/javascripts/nvd3/deprecated/lineWithFocus.html +137 -0
- data/vendor/assets/javascripts/nvd3/deprecated/lineWithFocus.js +354 -0
- data/vendor/assets/javascripts/nvd3/deprecated/lineWithFourAxes.html +144 -0
- data/vendor/assets/javascripts/nvd3/deprecated/lineWithFourAxes.js +218 -0
- data/vendor/assets/javascripts/nvd3/deprecated/lineWithLegend.html +142 -0
- data/vendor/assets/javascripts/nvd3/deprecated/lineWithLegend.js +176 -0
- data/vendor/assets/javascripts/nvd3/deprecated/monthendAxis.html +99 -0
- data/vendor/assets/javascripts/nvd3/deprecated/multiBarHorizontalWithLegend.html +258 -0
- data/vendor/assets/javascripts/nvd3/deprecated/multiBarHorizontalWithLegend.js +226 -0
- data/vendor/assets/javascripts/nvd3/deprecated/multiBarWithLegend.html +162 -0
- data/vendor/assets/javascripts/nvd3/deprecated/multiBarWithLegend.js +249 -0
- data/vendor/assets/javascripts/nvd3/deprecated/pie.js +263 -0
- data/vendor/assets/javascripts/nvd3/deprecated/scatterChart.html +110 -0
- data/vendor/assets/javascripts/nvd3/deprecated/scatterChart.js +294 -0
- data/vendor/assets/javascripts/nvd3/deprecated/scatterFisheyeChart.js +418 -0
- data/vendor/assets/javascripts/nvd3/deprecated/scatterWithLegend.html +167 -0
- data/vendor/assets/javascripts/nvd3/deprecated/scatterWithLegend.js +261 -0
- data/vendor/assets/javascripts/nvd3/deprecated/stackedArea.js +286 -0
- data/vendor/assets/javascripts/nvd3/deprecated/stackedAreaChart.html +183 -0
- data/vendor/assets/javascripts/nvd3/deprecated/stackedAreaChart_old.html +137 -0
- data/vendor/assets/javascripts/nvd3/deprecated/stackedAreaWithLegend.html +222 -0
- data/vendor/assets/javascripts/nvd3/deprecated/stackedAreaWithLegend.js +297 -0
- data/vendor/assets/javascripts/nvd3/examples/bullet.html +96 -0
- data/vendor/assets/javascripts/nvd3/examples/bulletChart.html +94 -0
- data/vendor/assets/javascripts/nvd3/examples/crossfilter.html +167 -0
- data/vendor/assets/javascripts/nvd3/examples/crossfilterWithDimentions.html +180 -0
- data/vendor/assets/javascripts/nvd3/examples/crossfilterWithTables.html +288 -0
- data/vendor/assets/javascripts/nvd3/examples/cumulativeLineChart.html +155 -0
- data/vendor/assets/javascripts/nvd3/examples/discreteBarChart.html +116 -0
- data/vendor/assets/javascripts/nvd3/examples/dynamicTimeSeries.html +148 -0
- data/vendor/assets/javascripts/nvd3/examples/historicalBar.html +157 -0
- data/vendor/assets/javascripts/nvd3/examples/horizon.html +163 -0
- data/vendor/assets/javascripts/nvd3/examples/images/grey-minus.png +0 -0
- data/vendor/assets/javascripts/nvd3/examples/images/grey-plus.png +0 -0
- data/vendor/assets/javascripts/nvd3/examples/indentedtree.html +126 -0
- data/vendor/assets/javascripts/nvd3/examples/legend.html +75 -0
- data/vendor/assets/javascripts/nvd3/examples/line.html +95 -0
- data/vendor/assets/javascripts/nvd3/examples/lineChart.html +112 -0
- data/vendor/assets/javascripts/nvd3/examples/lineChartSVGResize.html +151 -0
- data/vendor/assets/javascripts/nvd3/examples/linePlusBarChart.html +114 -0
- data/vendor/assets/javascripts/nvd3/examples/linePlusBarWithFocusChart.html +128 -0
- data/vendor/assets/javascripts/nvd3/examples/lineTimeSeries.html +142 -0
- data/vendor/assets/javascripts/nvd3/examples/lineWithFisheyeChart.html +101 -0
- data/vendor/assets/javascripts/nvd3/examples/lineWithFocusChart.html +87 -0
- data/vendor/assets/javascripts/nvd3/examples/multiBar.html +92 -0
- data/vendor/assets/javascripts/nvd3/examples/multiBarChart.html +93 -0
- data/vendor/assets/javascripts/nvd3/examples/multiBarHorizontalChart.html +388 -0
- data/vendor/assets/javascripts/nvd3/examples/multiChart.html +93 -0
- data/vendor/assets/javascripts/nvd3/examples/nations.json +1 -0
- data/vendor/assets/javascripts/nvd3/examples/pie.html +93 -0
- data/vendor/assets/javascripts/nvd3/examples/pieChart.html +114 -0
- data/vendor/assets/javascripts/nvd3/examples/scatter.html +95 -0
- data/vendor/assets/javascripts/nvd3/examples/scatterChart.html +115 -0
- data/vendor/assets/javascripts/nvd3/examples/scatterPlusLineChart.html +116 -0
- data/vendor/assets/javascripts/nvd3/examples/sparkline.html +62 -0
- data/vendor/assets/javascripts/nvd3/examples/sparklinePlus.html +67 -0
- data/vendor/assets/javascripts/nvd3/examples/stackedArea.html +155 -0
- data/vendor/assets/javascripts/nvd3/examples/stackedAreaChart.html +245 -0
- data/vendor/assets/javascripts/nvd3/examples/stream_layers.js +35 -0
- data/vendor/assets/javascripts/nvd3/lib/cie.js +155 -0
- data/vendor/assets/javascripts/nvd3/lib/crossfilter.js +1180 -0
- data/vendor/assets/javascripts/nvd3/lib/crossfilter.min.js +1 -0
- data/vendor/assets/javascripts/nvd3/lib/d3.v2.js +7033 -0
- data/vendor/assets/javascripts/nvd3/lib/d3.v2.min.js +4 -0
- data/vendor/assets/javascripts/nvd3/lib/fisheye.js +86 -0
- data/vendor/assets/javascripts/nvd3/lib/hive.js +80 -0
- data/vendor/assets/javascripts/nvd3/lib/horizon.js +192 -0
- data/vendor/assets/javascripts/nvd3/lib/sankey.js +292 -0
- data/vendor/assets/javascripts/nvd3/nv.d3.js +11762 -0
- data/vendor/assets/javascripts/nvd3/src/core.js +117 -0
- data/vendor/assets/javascripts/nvd3/src/models/axis.js +398 -0
- data/vendor/assets/javascripts/nvd3/src/models/backup/bullet.js +250 -0
- data/vendor/assets/javascripts/nvd3/src/models/backup/bulletChart.js +349 -0
- data/vendor/assets/javascripts/nvd3/src/models/bullet.js +377 -0
- data/vendor/assets/javascripts/nvd3/src/models/bulletChart.js +341 -0
- data/vendor/assets/javascripts/nvd3/src/models/cumulativeLineChart.js +609 -0
- data/vendor/assets/javascripts/nvd3/src/models/discreteBar.js +327 -0
- data/vendor/assets/javascripts/nvd3/src/models/discreteBarChart.js +290 -0
- data/vendor/assets/javascripts/nvd3/src/models/distribution.js +146 -0
- data/vendor/assets/javascripts/nvd3/src/models/historicalBar.js +289 -0
- data/vendor/assets/javascripts/nvd3/src/models/indentedTree.js +306 -0
- data/vendor/assets/javascripts/nvd3/src/models/legend.js +203 -0
- data/vendor/assets/javascripts/nvd3/src/models/line.js +286 -0
- data/vendor/assets/javascripts/nvd3/src/models/lineChart.js +359 -0
- data/vendor/assets/javascripts/nvd3/src/models/lineDynTimeSeriesChart.js +434 -0
- data/vendor/assets/javascripts/nvd3/src/models/linePlusBarChart.js +422 -0
- data/vendor/assets/javascripts/nvd3/src/models/linePlusBarWithFocusChart.js +657 -0
- data/vendor/assets/javascripts/nvd3/src/models/lineTimeSeriesChart.js +340 -0
- data/vendor/assets/javascripts/nvd3/src/models/lineWithFisheye.js +197 -0
- data/vendor/assets/javascripts/nvd3/src/models/lineWithFisheyeChart.js +324 -0
- data/vendor/assets/javascripts/nvd3/src/models/lineWithFocusChart.js +565 -0
- data/vendor/assets/javascripts/nvd3/src/models/multiAxisLineChart.js +312 -0
- data/vendor/assets/javascripts/nvd3/src/models/multiBar.js +416 -0
- data/vendor/assets/javascripts/nvd3/src/models/multiBarChart.js +445 -0
- data/vendor/assets/javascripts/nvd3/src/models/multiBarHorizontal.js +420 -0
- data/vendor/assets/javascripts/nvd3/src/models/multiBarHorizontalChart.js +415 -0
- data/vendor/assets/javascripts/nvd3/src/models/multiBarTimeSeries.js +371 -0
- data/vendor/assets/javascripts/nvd3/src/models/multiBarTimeSeriesChart.js +403 -0
- data/vendor/assets/javascripts/nvd3/src/models/multiChart.js +444 -0
- data/vendor/assets/javascripts/nvd3/src/models/ohlcBar.js +365 -0
- data/vendor/assets/javascripts/nvd3/src/models/pie.js +358 -0
- data/vendor/assets/javascripts/nvd3/src/models/pieChart.js +281 -0
- data/vendor/assets/javascripts/nvd3/src/models/scatter.js +622 -0
- data/vendor/assets/javascripts/nvd3/src/models/scatterChart.js +576 -0
- data/vendor/assets/javascripts/nvd3/src/models/scatterPlusLineChart.js +577 -0
- data/vendor/assets/javascripts/nvd3/src/models/sparkline.js +179 -0
- data/vendor/assets/javascripts/nvd3/src/models/sparklinePlus.js +291 -0
- data/vendor/assets/javascripts/nvd3/src/models/stackedArea.js +336 -0
- data/vendor/assets/javascripts/nvd3/src/models/stackedAreaChart.js +453 -0
- data/vendor/assets/javascripts/nvd3/src/nv.d3.css +671 -0
- data/vendor/assets/javascripts/nvd3/src/tooltip.js +129 -0
- data/vendor/assets/javascripts/nvd3/src/utils.js +105 -0
- data/vendor/assets/javascripts/set-nvd3-env.js.erb +5 -0
- data/vendor/assets/stylesheets/nvd3-rails.css +3 -0
- metadata +233 -0
@@ -0,0 +1,336 @@
|
|
1
|
+
|
2
|
+
nv.models.stackedArea = function() {
|
3
|
+
|
4
|
+
//============================================================
|
5
|
+
// Public Variables with Default Settings
|
6
|
+
//------------------------------------------------------------
|
7
|
+
|
8
|
+
var margin = {top: 0, right: 0, bottom: 0, left: 0}
|
9
|
+
, width = 960
|
10
|
+
, height = 500
|
11
|
+
, color = nv.utils.defaultColor() // a function that computes the color
|
12
|
+
, id = Math.floor(Math.random() * 100000) //Create semi-unique ID incase user doesn't selet one
|
13
|
+
, getX = function(d) { return d.x } // accessor to get the x value from a data point
|
14
|
+
, getY = function(d) { return d.y } // accessor to get the y value from a data point
|
15
|
+
, style = 'stack'
|
16
|
+
, offset = 'zero'
|
17
|
+
, order = 'default'
|
18
|
+
, interpolate = 'linear' // controls the line interpolation
|
19
|
+
, clipEdge = false // if true, masks lines within x and y scale
|
20
|
+
, x //can be accessed via chart.xScale()
|
21
|
+
, y //can be accessed via chart.yScale()
|
22
|
+
, scatter = nv.models.scatter()
|
23
|
+
, dispatch = d3.dispatch('tooltipShow', 'tooltipHide', 'areaClick', 'areaMouseover', 'areaMouseout')
|
24
|
+
;
|
25
|
+
|
26
|
+
scatter
|
27
|
+
.size(2.2) // default size
|
28
|
+
.sizeDomain([2.2]) // all the same size by default
|
29
|
+
;
|
30
|
+
|
31
|
+
/************************************
|
32
|
+
* offset:
|
33
|
+
* 'wiggle' (stream)
|
34
|
+
* 'zero' (stacked)
|
35
|
+
* 'expand' (normalize to 100%)
|
36
|
+
* 'silhouette' (simple centered)
|
37
|
+
*
|
38
|
+
* order:
|
39
|
+
* 'inside-out' (stream)
|
40
|
+
* 'default' (input order)
|
41
|
+
************************************/
|
42
|
+
|
43
|
+
//============================================================
|
44
|
+
|
45
|
+
|
46
|
+
function chart(selection) {
|
47
|
+
selection.each(function(data) {
|
48
|
+
var availableWidth = width - margin.left - margin.right,
|
49
|
+
availableHeight = height - margin.top - margin.bottom,
|
50
|
+
container = d3.select(this);
|
51
|
+
|
52
|
+
//------------------------------------------------------------
|
53
|
+
// Setup Scales
|
54
|
+
|
55
|
+
x = scatter.xScale();
|
56
|
+
y = scatter.yScale();
|
57
|
+
|
58
|
+
//------------------------------------------------------------
|
59
|
+
|
60
|
+
|
61
|
+
// Injecting point index into each point because d3.layout.stack().out does not give index
|
62
|
+
// ***Also storing getY(d,i) as stackedY so that it can be set to 0 if series is disabled
|
63
|
+
data = data.map(function(aseries, i) {
|
64
|
+
aseries.values = aseries.values.map(function(d, j) {
|
65
|
+
d.index = j;
|
66
|
+
d.stackedY = aseries.disabled ? 0 : getY(d,j);
|
67
|
+
return d;
|
68
|
+
})
|
69
|
+
return aseries;
|
70
|
+
});
|
71
|
+
|
72
|
+
|
73
|
+
data = d3.layout.stack()
|
74
|
+
.order(order)
|
75
|
+
.offset(offset)
|
76
|
+
.values(function(d) { return d.values }) //TODO: make values customizeable in EVERY model in this fashion
|
77
|
+
.x(getX)
|
78
|
+
.y(function(d) { return d.stackedY })
|
79
|
+
.out(function(d, y0, y) {
|
80
|
+
d.display = {
|
81
|
+
y: y,
|
82
|
+
y0: y0
|
83
|
+
};
|
84
|
+
})
|
85
|
+
(data);
|
86
|
+
|
87
|
+
|
88
|
+
//------------------------------------------------------------
|
89
|
+
// Setup containers and skeleton of chart
|
90
|
+
|
91
|
+
var wrap = container.selectAll('g.nv-wrap.nv-stackedarea').data([data]);
|
92
|
+
var wrapEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-stackedarea');
|
93
|
+
var defsEnter = wrapEnter.append('defs');
|
94
|
+
var gEnter = wrapEnter.append('g');
|
95
|
+
var g = wrap.select('g');
|
96
|
+
|
97
|
+
gEnter.append('g').attr('class', 'nv-areaWrap');
|
98
|
+
gEnter.append('g').attr('class', 'nv-scatterWrap');
|
99
|
+
|
100
|
+
wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')');
|
101
|
+
|
102
|
+
//------------------------------------------------------------
|
103
|
+
|
104
|
+
|
105
|
+
scatter
|
106
|
+
.width(availableWidth)
|
107
|
+
.height(availableHeight)
|
108
|
+
.x(getX)
|
109
|
+
.y(function(d) { return d.display.y + d.display.y0 })
|
110
|
+
.forceY([0])
|
111
|
+
.color(data.map(function(d,i) {
|
112
|
+
return d.color || color(d, i);
|
113
|
+
}).filter(function(d,i) { return !data[i].disabled }));
|
114
|
+
|
115
|
+
|
116
|
+
var scatterWrap = g.select('.nv-scatterWrap')
|
117
|
+
.datum(data.filter(function(d) { return !d.disabled }))
|
118
|
+
|
119
|
+
//d3.transition(scatterWrap).call(scatter);
|
120
|
+
scatterWrap.call(scatter);
|
121
|
+
|
122
|
+
|
123
|
+
|
124
|
+
|
125
|
+
|
126
|
+
defsEnter.append('clipPath')
|
127
|
+
.attr('id', 'nv-edge-clip-' + id)
|
128
|
+
.append('rect');
|
129
|
+
|
130
|
+
wrap.select('#nv-edge-clip-' + id + ' rect')
|
131
|
+
.attr('width', availableWidth)
|
132
|
+
.attr('height', availableHeight);
|
133
|
+
|
134
|
+
g .attr('clip-path', clipEdge ? 'url(#nv-edge-clip-' + id + ')' : '');
|
135
|
+
|
136
|
+
|
137
|
+
|
138
|
+
|
139
|
+
var area = d3.svg.area()
|
140
|
+
.x(function(d,i) { return x(getX(d,i)) })
|
141
|
+
.y0(function(d) { return y(d.display.y0) })
|
142
|
+
.y1(function(d) { return y(d.display.y + d.display.y0) })
|
143
|
+
.interpolate(interpolate);
|
144
|
+
|
145
|
+
var zeroArea = d3.svg.area()
|
146
|
+
.x(function(d,i) { return x(getX(d,i)) })
|
147
|
+
.y0(function(d) { return y(d.display.y0) })
|
148
|
+
.y1(function(d) { return y(d.display.y0) });
|
149
|
+
|
150
|
+
|
151
|
+
var path = g.select('.nv-areaWrap').selectAll('path.nv-area')
|
152
|
+
.data(function(d) { return d });
|
153
|
+
//.data(function(d) { return d }, function(d) { return d.key });
|
154
|
+
path.enter().append('path').attr('class', function(d,i) { return 'nv-area nv-area-' + i })
|
155
|
+
.on('mouseover', function(d,i) {
|
156
|
+
d3.select(this).classed('hover', true);
|
157
|
+
dispatch.areaMouseover({
|
158
|
+
point: d,
|
159
|
+
series: d.key,
|
160
|
+
pos: [d3.event.pageX, d3.event.pageY],
|
161
|
+
seriesIndex: i
|
162
|
+
});
|
163
|
+
})
|
164
|
+
.on('mouseout', function(d,i) {
|
165
|
+
d3.select(this).classed('hover', false);
|
166
|
+
dispatch.areaMouseout({
|
167
|
+
point: d,
|
168
|
+
series: d.key,
|
169
|
+
pos: [d3.event.pageX, d3.event.pageY],
|
170
|
+
seriesIndex: i
|
171
|
+
});
|
172
|
+
})
|
173
|
+
.on('click', function(d,i) {
|
174
|
+
d3.select(this).classed('hover', false);
|
175
|
+
dispatch.areaClick({
|
176
|
+
point: d,
|
177
|
+
series: d.key,
|
178
|
+
pos: [d3.event.pageX, d3.event.pageY],
|
179
|
+
seriesIndex: i
|
180
|
+
});
|
181
|
+
})
|
182
|
+
//d3.transition(path.exit())
|
183
|
+
path.exit()
|
184
|
+
.attr('d', function(d,i) { return zeroArea(d.values,i) })
|
185
|
+
.remove();
|
186
|
+
path
|
187
|
+
.style('fill', function(d,i){ return d.color || color(d, i) })
|
188
|
+
.style('stroke', function(d,i){ return d.color || color(d, i) });
|
189
|
+
//d3.transition(path)
|
190
|
+
path
|
191
|
+
.attr('d', function(d,i) { return area(d.values,i) })
|
192
|
+
|
193
|
+
|
194
|
+
//============================================================
|
195
|
+
// Event Handling/Dispatching (in chart's scope)
|
196
|
+
//------------------------------------------------------------
|
197
|
+
|
198
|
+
scatter.dispatch.on('elementMouseover.area', function(e) {
|
199
|
+
g.select('.nv-chart-' + id + ' .nv-area-' + e.seriesIndex).classed('hover', true);
|
200
|
+
});
|
201
|
+
scatter.dispatch.on('elementMouseout.area', function(e) {
|
202
|
+
g.select('.nv-chart-' + id + ' .nv-area-' + e.seriesIndex).classed('hover', false);
|
203
|
+
});
|
204
|
+
|
205
|
+
//============================================================
|
206
|
+
|
207
|
+
});
|
208
|
+
|
209
|
+
|
210
|
+
return chart;
|
211
|
+
}
|
212
|
+
|
213
|
+
|
214
|
+
//============================================================
|
215
|
+
// Event Handling/Dispatching (out of chart's scope)
|
216
|
+
//------------------------------------------------------------
|
217
|
+
|
218
|
+
scatter.dispatch.on('elementClick.area', function(e) {
|
219
|
+
dispatch.areaClick(e);
|
220
|
+
})
|
221
|
+
scatter.dispatch.on('elementMouseover.tooltip', function(e) {
|
222
|
+
e.pos = [e.pos[0] + margin.left, e.pos[1] + margin.top],
|
223
|
+
dispatch.tooltipShow(e);
|
224
|
+
});
|
225
|
+
scatter.dispatch.on('elementMouseout.tooltip', function(e) {
|
226
|
+
dispatch.tooltipHide(e);
|
227
|
+
});
|
228
|
+
|
229
|
+
//============================================================
|
230
|
+
|
231
|
+
|
232
|
+
//============================================================
|
233
|
+
// Global getters and setters
|
234
|
+
//------------------------------------------------------------
|
235
|
+
|
236
|
+
chart.dispatch = dispatch;
|
237
|
+
chart.scatter = scatter;
|
238
|
+
|
239
|
+
d3.rebind(chart, scatter, 'interactive', 'size', 'xScale', 'yScale', 'zScale', 'xDomain', 'yDomain', 'sizeDomain', 'forceX', 'forceY', 'forceSize', 'clipVoronoi', 'clipRadius');
|
240
|
+
|
241
|
+
chart.x = function(_) {
|
242
|
+
if (!arguments.length) return getX;
|
243
|
+
getX = d3.functor(_);
|
244
|
+
return chart;
|
245
|
+
};
|
246
|
+
|
247
|
+
chart.y = function(_) {
|
248
|
+
if (!arguments.length) return getY;
|
249
|
+
getY = d3.functor(_);
|
250
|
+
return chart;
|
251
|
+
}
|
252
|
+
|
253
|
+
chart.margin = function(_) {
|
254
|
+
if (!arguments.length) return margin;
|
255
|
+
margin.top = typeof _.top != 'undefined' ? _.top : margin.top;
|
256
|
+
margin.right = typeof _.right != 'undefined' ? _.right : margin.right;
|
257
|
+
margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom;
|
258
|
+
margin.left = typeof _.left != 'undefined' ? _.left : margin.left;
|
259
|
+
return chart;
|
260
|
+
};
|
261
|
+
|
262
|
+
chart.width = function(_) {
|
263
|
+
if (!arguments.length) return width;
|
264
|
+
width = _;
|
265
|
+
return chart;
|
266
|
+
};
|
267
|
+
|
268
|
+
chart.height = function(_) {
|
269
|
+
if (!arguments.length) return height;
|
270
|
+
height = _;
|
271
|
+
return chart;
|
272
|
+
};
|
273
|
+
|
274
|
+
chart.clipEdge = function(_) {
|
275
|
+
if (!arguments.length) return clipEdge;
|
276
|
+
clipEdge = _;
|
277
|
+
return chart;
|
278
|
+
};
|
279
|
+
|
280
|
+
chart.color = function(_) {
|
281
|
+
if (!arguments.length) return color;
|
282
|
+
color = nv.utils.getColor(_);
|
283
|
+
return chart;
|
284
|
+
};
|
285
|
+
|
286
|
+
chart.offset = function(_) {
|
287
|
+
if (!arguments.length) return offset;
|
288
|
+
offset = _;
|
289
|
+
return chart;
|
290
|
+
};
|
291
|
+
|
292
|
+
chart.order = function(_) {
|
293
|
+
if (!arguments.length) return order;
|
294
|
+
order = _;
|
295
|
+
return chart;
|
296
|
+
};
|
297
|
+
|
298
|
+
//shortcut for offset + order
|
299
|
+
chart.style = function(_) {
|
300
|
+
if (!arguments.length) return style;
|
301
|
+
style = _;
|
302
|
+
|
303
|
+
switch (style) {
|
304
|
+
case 'stack':
|
305
|
+
chart.offset('zero');
|
306
|
+
chart.order('default');
|
307
|
+
break;
|
308
|
+
case 'stream':
|
309
|
+
chart.offset('wiggle');
|
310
|
+
chart.order('inside-out');
|
311
|
+
break;
|
312
|
+
case 'stream-center':
|
313
|
+
chart.offset('silhouette');
|
314
|
+
chart.order('inside-out');
|
315
|
+
break;
|
316
|
+
case 'expand':
|
317
|
+
chart.offset('expand');
|
318
|
+
chart.order('default');
|
319
|
+
break;
|
320
|
+
}
|
321
|
+
|
322
|
+
return chart;
|
323
|
+
};
|
324
|
+
|
325
|
+
chart.interpolate = function(_) {
|
326
|
+
if (!arguments.length) return interpolate;
|
327
|
+
interpolate = _;
|
328
|
+
return interpolate;
|
329
|
+
|
330
|
+
};
|
331
|
+
|
332
|
+
//============================================================
|
333
|
+
|
334
|
+
|
335
|
+
return chart;
|
336
|
+
}
|
@@ -0,0 +1,453 @@
|
|
1
|
+
|
2
|
+
nv.models.stackedAreaChart = function() {
|
3
|
+
|
4
|
+
//============================================================
|
5
|
+
// Public Variables with Default Settings
|
6
|
+
//------------------------------------------------------------
|
7
|
+
|
8
|
+
var stacked = nv.models.stackedArea()
|
9
|
+
, xAxis = nv.models.axis()
|
10
|
+
, yAxis = nv.models.axis()
|
11
|
+
, legend = nv.models.legend()
|
12
|
+
, controls = nv.models.legend()
|
13
|
+
;
|
14
|
+
|
15
|
+
var margin = {top: 30, right: 25, bottom: 50, left: 60}
|
16
|
+
, width = null
|
17
|
+
, height = null
|
18
|
+
, color = nv.utils.defaultColor() // a function that takes in d, i and returns color
|
19
|
+
, showControls = true
|
20
|
+
, showLegend = true
|
21
|
+
, tooltips = true
|
22
|
+
, tooltip = function(key, x, y, e, graph) {
|
23
|
+
return '<h3>' + key + '</h3>' +
|
24
|
+
'<p>' + y + ' on ' + x + '</p>'
|
25
|
+
}
|
26
|
+
, x //can be accessed via chart.xScale()
|
27
|
+
, y //can be accessed via chart.yScale()
|
28
|
+
, yAxisTickFormat = d3.format(',.2f')
|
29
|
+
, state = { style: stacked.style() }
|
30
|
+
, noData = 'No Data Available.'
|
31
|
+
, dispatch = d3.dispatch('tooltipShow', 'tooltipHide', 'stateChange', 'changeState')
|
32
|
+
, controlWidth = 250
|
33
|
+
;
|
34
|
+
|
35
|
+
xAxis
|
36
|
+
.orient('bottom')
|
37
|
+
.tickPadding(7)
|
38
|
+
;
|
39
|
+
yAxis
|
40
|
+
.orient('left')
|
41
|
+
;
|
42
|
+
stacked.scatter
|
43
|
+
.pointActive(function(d) {
|
44
|
+
//console.log(stacked.y()(d), !!Math.round(stacked.y()(d) * 100));
|
45
|
+
return !!Math.round(stacked.y()(d) * 100);
|
46
|
+
})
|
47
|
+
;
|
48
|
+
|
49
|
+
//============================================================
|
50
|
+
|
51
|
+
|
52
|
+
//============================================================
|
53
|
+
// Private Variables
|
54
|
+
//------------------------------------------------------------
|
55
|
+
|
56
|
+
var showTooltip = function(e, offsetElement) {
|
57
|
+
var left = e.pos[0] + ( offsetElement.offsetLeft || 0 ),
|
58
|
+
top = e.pos[1] + ( offsetElement.offsetTop || 0),
|
59
|
+
x = xAxis.tickFormat()(stacked.x()(e.point, e.pointIndex)),
|
60
|
+
y = yAxis.tickFormat()(stacked.y()(e.point, e.pointIndex)),
|
61
|
+
content = tooltip(e.series.key, x, y, e, chart);
|
62
|
+
|
63
|
+
nv.tooltip.show([left, top], content, e.value < 0 ? 'n' : 's', null, offsetElement);
|
64
|
+
};
|
65
|
+
|
66
|
+
//============================================================
|
67
|
+
|
68
|
+
|
69
|
+
function chart(selection) {
|
70
|
+
selection.each(function(data) {
|
71
|
+
var container = d3.select(this),
|
72
|
+
that = this;
|
73
|
+
|
74
|
+
var availableWidth = (width || parseInt(container.style('width')) || 960)
|
75
|
+
- margin.left - margin.right,
|
76
|
+
availableHeight = (height || parseInt(container.style('height')) || 400)
|
77
|
+
- margin.top - margin.bottom;
|
78
|
+
|
79
|
+
chart.update = function() { chart(selection) };
|
80
|
+
chart.container = this;
|
81
|
+
|
82
|
+
//------------------------------------------------------------
|
83
|
+
// Display No Data message if there's nothing to show.
|
84
|
+
|
85
|
+
if (!data || !data.length || !data.filter(function(d) { return d.values.length }).length) {
|
86
|
+
var noDataText = container.selectAll('.nv-noData').data([noData]);
|
87
|
+
|
88
|
+
noDataText.enter().append('text')
|
89
|
+
.attr('class', 'nvd3 nv-noData')
|
90
|
+
.attr('dy', '-.7em')
|
91
|
+
.style('text-anchor', 'middle');
|
92
|
+
|
93
|
+
noDataText
|
94
|
+
.attr('x', margin.left + availableWidth / 2)
|
95
|
+
.attr('y', margin.top + availableHeight / 2)
|
96
|
+
.text(function(d) { return d });
|
97
|
+
|
98
|
+
return chart;
|
99
|
+
} else {
|
100
|
+
container.selectAll('.nv-noData').remove();
|
101
|
+
}
|
102
|
+
|
103
|
+
//------------------------------------------------------------
|
104
|
+
|
105
|
+
|
106
|
+
//------------------------------------------------------------
|
107
|
+
// Setup Scales
|
108
|
+
|
109
|
+
x = stacked.xScale();
|
110
|
+
y = stacked.yScale();
|
111
|
+
|
112
|
+
//------------------------------------------------------------
|
113
|
+
|
114
|
+
|
115
|
+
//------------------------------------------------------------
|
116
|
+
// Setup containers and skeleton of chart
|
117
|
+
|
118
|
+
var wrap = container.selectAll('g.nv-wrap.nv-stackedAreaChart').data([data]);
|
119
|
+
var gEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-stackedAreaChart').append('g');
|
120
|
+
var g = wrap.select('g');
|
121
|
+
|
122
|
+
gEnter.append('g').attr('class', 'nv-x nv-axis');
|
123
|
+
gEnter.append('g').attr('class', 'nv-y nv-axis');
|
124
|
+
gEnter.append('g').attr('class', 'nv-stackedWrap');
|
125
|
+
gEnter.append('g').attr('class', 'nv-legendWrap');
|
126
|
+
gEnter.append('g').attr('class', 'nv-controlsWrap');
|
127
|
+
|
128
|
+
//------------------------------------------------------------
|
129
|
+
|
130
|
+
|
131
|
+
//------------------------------------------------------------
|
132
|
+
// Legend
|
133
|
+
|
134
|
+
if (showLegend) {
|
135
|
+
legend
|
136
|
+
.width( availableWidth - controlWidth );
|
137
|
+
|
138
|
+
g.select('.nv-legendWrap')
|
139
|
+
.datum(data)
|
140
|
+
.call(legend);
|
141
|
+
|
142
|
+
if ( margin.top != legend.height()) {
|
143
|
+
margin.top = legend.height();
|
144
|
+
availableHeight = (height || parseInt(container.style('height')) || 400)
|
145
|
+
- margin.top - margin.bottom;
|
146
|
+
}
|
147
|
+
|
148
|
+
g.select('.nv-legendWrap')
|
149
|
+
.attr('transform', 'translate(' + controlWidth + ',' + (-margin.top) +')');
|
150
|
+
}
|
151
|
+
|
152
|
+
//------------------------------------------------------------
|
153
|
+
|
154
|
+
|
155
|
+
//------------------------------------------------------------
|
156
|
+
// Controls
|
157
|
+
|
158
|
+
if (showControls) {
|
159
|
+
var controlsData = [
|
160
|
+
{ key: 'Stacked', disabled: stacked.offset() != 'zero' },
|
161
|
+
{ key: 'Stream', disabled: stacked.offset() != 'wiggle' },
|
162
|
+
{ key: 'Expanded', disabled: stacked.offset() != 'expand' }
|
163
|
+
];
|
164
|
+
|
165
|
+
controls
|
166
|
+
.width( controlWidth )
|
167
|
+
.color(['#444', '#444', '#444']);
|
168
|
+
|
169
|
+
g.select('.nv-controlsWrap')
|
170
|
+
.datum(controlsData)
|
171
|
+
.call(controls);
|
172
|
+
|
173
|
+
|
174
|
+
if ( margin.top != Math.max(controls.height(), legend.height()) ) {
|
175
|
+
margin.top = Math.max(controls.height(), legend.height());
|
176
|
+
availableHeight = (height || parseInt(container.style('height')) || 400)
|
177
|
+
- margin.top - margin.bottom;
|
178
|
+
}
|
179
|
+
|
180
|
+
|
181
|
+
g.select('.nv-controlsWrap')
|
182
|
+
.attr('transform', 'translate(0,' + (-margin.top) +')');
|
183
|
+
}
|
184
|
+
|
185
|
+
//------------------------------------------------------------
|
186
|
+
|
187
|
+
|
188
|
+
wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')');
|
189
|
+
|
190
|
+
|
191
|
+
//------------------------------------------------------------
|
192
|
+
// Main Chart Component(s)
|
193
|
+
|
194
|
+
stacked
|
195
|
+
.width(availableWidth)
|
196
|
+
.height(availableHeight)
|
197
|
+
|
198
|
+
var stackedWrap = g.select('.nv-stackedWrap')
|
199
|
+
.datum(data);
|
200
|
+
//d3.transition(stackedWrap).call(stacked);
|
201
|
+
stackedWrap.call(stacked);
|
202
|
+
|
203
|
+
//------------------------------------------------------------
|
204
|
+
|
205
|
+
|
206
|
+
//------------------------------------------------------------
|
207
|
+
// Setup Axes
|
208
|
+
|
209
|
+
xAxis
|
210
|
+
.scale(x)
|
211
|
+
.ticks( availableWidth / 100 )
|
212
|
+
.tickSize( -availableHeight, 0);
|
213
|
+
|
214
|
+
g.select('.nv-x.nv-axis')
|
215
|
+
.attr('transform', 'translate(0,' + availableHeight + ')');
|
216
|
+
//d3.transition(g.select('.nv-x.nv-axis'))
|
217
|
+
g.select('.nv-x.nv-axis')
|
218
|
+
.transition().duration(0)
|
219
|
+
.call(xAxis);
|
220
|
+
|
221
|
+
yAxis
|
222
|
+
.scale(y)
|
223
|
+
.ticks(stacked.offset() == 'wiggle' ? 0 : availableHeight / 36)
|
224
|
+
.tickSize(-availableWidth, 0)
|
225
|
+
.setTickFormat(stacked.offset() == 'expand' ? d3.format('%') : yAxisTickFormat);
|
226
|
+
|
227
|
+
//d3.transition(g.select('.nv-y.nv-axis'))
|
228
|
+
g.select('.nv-y.nv-axis')
|
229
|
+
.transition().duration(0)
|
230
|
+
.call(yAxis);
|
231
|
+
|
232
|
+
//------------------------------------------------------------
|
233
|
+
|
234
|
+
|
235
|
+
//============================================================
|
236
|
+
// Event Handling/Dispatching (in chart's scope)
|
237
|
+
//------------------------------------------------------------
|
238
|
+
|
239
|
+
stacked.dispatch.on('areaClick.toggle', function(e) {
|
240
|
+
if (data.filter(function(d) { return !d.disabled }).length === 1)
|
241
|
+
data = data.map(function(d) {
|
242
|
+
d.disabled = false;
|
243
|
+
return d
|
244
|
+
});
|
245
|
+
else
|
246
|
+
data = data.map(function(d,i) {
|
247
|
+
d.disabled = (i != e.seriesIndex);
|
248
|
+
return d
|
249
|
+
});
|
250
|
+
|
251
|
+
//selection.transition().call(chart);
|
252
|
+
chart(selection);
|
253
|
+
});
|
254
|
+
|
255
|
+
legend.dispatch.on('legendClick', function(d,i) {
|
256
|
+
d.disabled = !d.disabled;
|
257
|
+
|
258
|
+
if (!data.filter(function(d) { return !d.disabled }).length) {
|
259
|
+
data.map(function(d) {
|
260
|
+
d.disabled = false;
|
261
|
+
return d;
|
262
|
+
});
|
263
|
+
}
|
264
|
+
|
265
|
+
state.disabled = data.map(function(d) { return !!d.disabled });
|
266
|
+
dispatch.stateChange(state);
|
267
|
+
|
268
|
+
//selection.transition().call(chart);
|
269
|
+
chart(selection);
|
270
|
+
});
|
271
|
+
|
272
|
+
controls.dispatch.on('legendClick', function(d,i) {
|
273
|
+
if (!d.disabled) return;
|
274
|
+
|
275
|
+
controlsData = controlsData.map(function(s) {
|
276
|
+
s.disabled = true;
|
277
|
+
return s;
|
278
|
+
});
|
279
|
+
d.disabled = false;
|
280
|
+
|
281
|
+
switch (d.key) {
|
282
|
+
case 'Stacked':
|
283
|
+
stacked.style('stack');
|
284
|
+
break;
|
285
|
+
case 'Stream':
|
286
|
+
stacked.style('stream');
|
287
|
+
break;
|
288
|
+
case 'Expanded':
|
289
|
+
stacked.style('expand');
|
290
|
+
break;
|
291
|
+
}
|
292
|
+
|
293
|
+
state.style = stacked.style();
|
294
|
+
dispatch.stateChange(state);
|
295
|
+
|
296
|
+
//selection.transition().call(chart);
|
297
|
+
chart(selection);
|
298
|
+
});
|
299
|
+
|
300
|
+
dispatch.on('tooltipShow', function(e) {
|
301
|
+
if (tooltips) showTooltip(e, that.parentNode);
|
302
|
+
});
|
303
|
+
|
304
|
+
// Update chart from a state object passed to event handler
|
305
|
+
dispatch.on('changeState', function(e) {
|
306
|
+
|
307
|
+
if (typeof e.disabled !== 'undefined') {
|
308
|
+
data.forEach(function(series,i) {
|
309
|
+
series.disabled = e.disabled[i];
|
310
|
+
});
|
311
|
+
|
312
|
+
state.disabled = e.disabled;
|
313
|
+
}
|
314
|
+
|
315
|
+
if (typeof e.style !== 'undefined') {
|
316
|
+
stacked.style(e.style);
|
317
|
+
}
|
318
|
+
|
319
|
+
selection.call(chart);
|
320
|
+
});
|
321
|
+
|
322
|
+
});
|
323
|
+
|
324
|
+
|
325
|
+
return chart;
|
326
|
+
}
|
327
|
+
|
328
|
+
|
329
|
+
//============================================================
|
330
|
+
// Event Handling/Dispatching (out of chart's scope)
|
331
|
+
//------------------------------------------------------------
|
332
|
+
|
333
|
+
stacked.dispatch.on('tooltipShow', function(e) {
|
334
|
+
//disable tooltips when value ~= 0
|
335
|
+
//// TODO: consider removing points from voronoi that have 0 value instead of this hack
|
336
|
+
/*
|
337
|
+
if (!Math.round(stacked.y()(e.point) * 100)) { // 100 will not be good for very small numbers... will have to think about making this valu dynamic, based on data range
|
338
|
+
setTimeout(function() { d3.selectAll('.point.hover').classed('hover', false) }, 0);
|
339
|
+
return false;
|
340
|
+
}
|
341
|
+
*/
|
342
|
+
|
343
|
+
e.pos = [e.pos[0] + margin.left, e.pos[1] + margin.top],
|
344
|
+
dispatch.tooltipShow(e);
|
345
|
+
});
|
346
|
+
|
347
|
+
stacked.dispatch.on('tooltipHide', function(e) {
|
348
|
+
dispatch.tooltipHide(e);
|
349
|
+
});
|
350
|
+
|
351
|
+
dispatch.on('tooltipHide', function() {
|
352
|
+
if (tooltips) nv.tooltip.cleanup();
|
353
|
+
});
|
354
|
+
|
355
|
+
//============================================================
|
356
|
+
|
357
|
+
|
358
|
+
//============================================================
|
359
|
+
// Expose Public Variables
|
360
|
+
//------------------------------------------------------------
|
361
|
+
|
362
|
+
// expose chart's sub-components
|
363
|
+
chart.dispatch = dispatch;
|
364
|
+
chart.stacked = stacked;
|
365
|
+
chart.legend = legend;
|
366
|
+
chart.controls = controls;
|
367
|
+
chart.xAxis = xAxis;
|
368
|
+
chart.yAxis = yAxis;
|
369
|
+
|
370
|
+
d3.rebind(chart, stacked, 'x', 'y', 'size', 'xScale', 'yScale', 'xDomain', 'yDomain', 'sizeDomain', 'interactive', 'offset', 'order', 'style', 'clipEdge', 'forceX', 'forceY', 'forceSize', 'interpolate');
|
371
|
+
|
372
|
+
chart.margin = function(_) {
|
373
|
+
if (!arguments.length) return margin;
|
374
|
+
margin.top = typeof _.top != 'undefined' ? _.top : margin.top;
|
375
|
+
margin.right = typeof _.right != 'undefined' ? _.right : margin.right;
|
376
|
+
margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom;
|
377
|
+
margin.left = typeof _.left != 'undefined' ? _.left : margin.left;
|
378
|
+
return chart;
|
379
|
+
};
|
380
|
+
|
381
|
+
chart.width = function(_) {
|
382
|
+
if (!arguments.length) return getWidth;
|
383
|
+
width = _;
|
384
|
+
return chart;
|
385
|
+
};
|
386
|
+
|
387
|
+
chart.height = function(_) {
|
388
|
+
if (!arguments.length) return getHeight;
|
389
|
+
height = _;
|
390
|
+
return chart;
|
391
|
+
};
|
392
|
+
|
393
|
+
chart.color = function(_) {
|
394
|
+
if (!arguments.length) return color;
|
395
|
+
color = nv.utils.getColor(_);
|
396
|
+
legend.color(color);
|
397
|
+
stacked.color(color);
|
398
|
+
return chart;
|
399
|
+
};
|
400
|
+
|
401
|
+
chart.showControls = function(_) {
|
402
|
+
if (!arguments.length) return showControls;
|
403
|
+
showControls = _;
|
404
|
+
return chart;
|
405
|
+
};
|
406
|
+
|
407
|
+
chart.showLegend = function(_) {
|
408
|
+
if (!arguments.length) return showLegend;
|
409
|
+
showLegend = _;
|
410
|
+
return chart;
|
411
|
+
};
|
412
|
+
|
413
|
+
chart.tooltip = function(_) {
|
414
|
+
if (!arguments.length) return tooltip;
|
415
|
+
tooltip = _;
|
416
|
+
return chart;
|
417
|
+
};
|
418
|
+
|
419
|
+
chart.tooltips = function(_) {
|
420
|
+
if (!arguments.length) return tooltips;
|
421
|
+
tooltips = _;
|
422
|
+
return chart;
|
423
|
+
};
|
424
|
+
|
425
|
+
chart.tooltipContent = function(_) {
|
426
|
+
if (!arguments.length) return tooltip;
|
427
|
+
tooltip = _;
|
428
|
+
return chart;
|
429
|
+
};
|
430
|
+
|
431
|
+
chart.state = function(_) {
|
432
|
+
if (!arguments.length) return state;
|
433
|
+
state = _;
|
434
|
+
return chart;
|
435
|
+
};
|
436
|
+
|
437
|
+
chart.noData = function(_) {
|
438
|
+
if (!arguments.length) return noData;
|
439
|
+
noData = _;
|
440
|
+
return chart;
|
441
|
+
};
|
442
|
+
|
443
|
+
yAxis.setTickFormat = yAxis.tickFormat;
|
444
|
+
yAxis.tickFormat = function(_) {
|
445
|
+
if (!arguments.length) return yAxisTickFormat;
|
446
|
+
yAxisTickFormat = _;
|
447
|
+
return yAxis;
|
448
|
+
};
|
449
|
+
|
450
|
+
//============================================================
|
451
|
+
|
452
|
+
return chart;
|
453
|
+
}
|