chartx 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (84) hide show
  1. data/.gitignore +17 -0
  2. data/.gitmodules +3 -0
  3. data/Gemfile +4 -0
  4. data/LICENSE.txt +22 -0
  5. data/README.md +145 -0
  6. data/Rakefile +1 -0
  7. data/chartx.gemspec +40 -0
  8. data/lib/chartx/engine.rb +11 -0
  9. data/lib/chartx/helper.rb +184 -0
  10. data/lib/chartx/version.rb +3 -0
  11. data/lib/chartx.rb +3 -0
  12. data/screenshots/barchart.png +0 -0
  13. data/screenshots/bulletchart.png +0 -0
  14. data/screenshots/horizontalbarchart.png +0 -0
  15. data/screenshots/linechart.png +0 -0
  16. data/screenshots/linewithfocuschart.png +0 -0
  17. data/screenshots/multibarchart2.png +0 -0
  18. data/screenshots/piechart.png +0 -0
  19. data/screenshots/scatterchart.png +0 -0
  20. data/screenshots/stackedareachart.png +0 -0
  21. data/screenshots/stackedareachart3.png +0 -0
  22. data/vendor/assets/javascripts/chartx-core.js +9 -0
  23. data/vendor/assets/javascripts/chartx-models.js +2 -0
  24. data/vendor/assets/javascripts/nvd3/.gitignore +27 -0
  25. data/vendor/assets/javascripts/nvd3/.jshintrc +3 -0
  26. data/vendor/assets/javascripts/nvd3/LICENSE.md +49 -0
  27. data/vendor/assets/javascripts/nvd3/README.md +1 -0
  28. data/vendor/assets/javascripts/nvd3/lib/cie.js +155 -0
  29. data/vendor/assets/javascripts/nvd3/lib/crossfilter.js +1180 -0
  30. data/vendor/assets/javascripts/nvd3/lib/crossfilter.min.js +1 -0
  31. data/vendor/assets/javascripts/nvd3/lib/d3.js +8798 -0
  32. data/vendor/assets/javascripts/nvd3/lib/d3.min.js +5 -0
  33. data/vendor/assets/javascripts/nvd3/lib/fisheye.js +86 -0
  34. data/vendor/assets/javascripts/nvd3/lib/hive.js +80 -0
  35. data/vendor/assets/javascripts/nvd3/lib/horizon.js +192 -0
  36. data/vendor/assets/javascripts/nvd3/lib/sankey.js +292 -0
  37. data/vendor/assets/javascripts/nvd3/nv.d3.js +13048 -0
  38. data/vendor/assets/javascripts/nvd3/nv.d3.min.js +6 -0
  39. data/vendor/assets/javascripts/nvd3/src/core.js +118 -0
  40. data/vendor/assets/javascripts/nvd3/src/intro.js +1 -0
  41. data/vendor/assets/javascripts/nvd3/src/models/axis.js +398 -0
  42. data/vendor/assets/javascripts/nvd3/src/models/boilerplate.js +102 -0
  43. data/vendor/assets/javascripts/nvd3/src/models/bullet.js +377 -0
  44. data/vendor/assets/javascripts/nvd3/src/models/bulletChart.js +341 -0
  45. data/vendor/assets/javascripts/nvd3/src/models/cumulativeLineChart.js +685 -0
  46. data/vendor/assets/javascripts/nvd3/src/models/discreteBar.js +327 -0
  47. data/vendor/assets/javascripts/nvd3/src/models/discreteBarChart.js +290 -0
  48. data/vendor/assets/javascripts/nvd3/src/models/distribution.js +146 -0
  49. data/vendor/assets/javascripts/nvd3/src/models/historicalBar.js +289 -0
  50. data/vendor/assets/javascripts/nvd3/src/models/historicalBarChart.js +421 -0
  51. data/vendor/assets/javascripts/nvd3/src/models/indentedTree.js +317 -0
  52. data/vendor/assets/javascripts/nvd3/src/models/legend.js +207 -0
  53. data/vendor/assets/javascripts/nvd3/src/models/line.js +284 -0
  54. data/vendor/assets/javascripts/nvd3/src/models/lineChart.js +421 -0
  55. data/vendor/assets/javascripts/nvd3/src/models/linePlusBarChart.js +455 -0
  56. data/vendor/assets/javascripts/nvd3/src/models/linePlusBarWithFocusChart.js +665 -0
  57. data/vendor/assets/javascripts/nvd3/src/models/lineWithFisheye.js +197 -0
  58. data/vendor/assets/javascripts/nvd3/src/models/lineWithFisheyeChart.js +319 -0
  59. data/vendor/assets/javascripts/nvd3/src/models/lineWithFocusChart.js +560 -0
  60. data/vendor/assets/javascripts/nvd3/src/models/multiBar.js +442 -0
  61. data/vendor/assets/javascripts/nvd3/src/models/multiBarChart.js +506 -0
  62. data/vendor/assets/javascripts/nvd3/src/models/multiBarHorizontal.js +420 -0
  63. data/vendor/assets/javascripts/nvd3/src/models/multiBarHorizontalChart.js +448 -0
  64. data/vendor/assets/javascripts/nvd3/src/models/multiBarTimeSeries.js +371 -0
  65. data/vendor/assets/javascripts/nvd3/src/models/multiBarTimeSeriesChart.js +403 -0
  66. data/vendor/assets/javascripts/nvd3/src/models/multiChart.js +444 -0
  67. data/vendor/assets/javascripts/nvd3/src/models/ohlcBar.js +365 -0
  68. data/vendor/assets/javascripts/nvd3/src/models/parallelCoordinates.js +238 -0
  69. data/vendor/assets/javascripts/nvd3/src/models/pie.js +386 -0
  70. data/vendor/assets/javascripts/nvd3/src/models/pieChart.js +302 -0
  71. data/vendor/assets/javascripts/nvd3/src/models/scatter.js +660 -0
  72. data/vendor/assets/javascripts/nvd3/src/models/scatterChart.js +614 -0
  73. data/vendor/assets/javascripts/nvd3/src/models/scatterPlusLineChart.js +610 -0
  74. data/vendor/assets/javascripts/nvd3/src/models/sparkline.js +179 -0
  75. data/vendor/assets/javascripts/nvd3/src/models/sparklinePlus.js +293 -0
  76. data/vendor/assets/javascripts/nvd3/src/models/stackedArea.js +336 -0
  77. data/vendor/assets/javascripts/nvd3/src/models/stackedAreaChart.js +490 -0
  78. data/vendor/assets/javascripts/nvd3/src/nv.d3.css +704 -0
  79. data/vendor/assets/javascripts/nvd3/src/outro.js +1 -0
  80. data/vendor/assets/javascripts/nvd3/src/tooltip.js +133 -0
  81. data/vendor/assets/javascripts/nvd3/src/utils.js +118 -0
  82. data/vendor/assets/javascripts/set-env.js.erb +1 -0
  83. data/vendor/assets/stylesheets/chartx.css +3 -0
  84. metadata +189 -0
@@ -0,0 +1,560 @@
1
+
2
+ nv.models.lineWithFocusChart = function() {
3
+
4
+ //============================================================
5
+ // Public Variables with Default Settings
6
+ //------------------------------------------------------------
7
+
8
+ var lines = nv.models.line()
9
+ , lines2 = nv.models.line()
10
+ , xAxis = nv.models.axis()
11
+ , yAxis = nv.models.axis()
12
+ , x2Axis = nv.models.axis()
13
+ , y2Axis = nv.models.axis()
14
+ , legend = nv.models.legend()
15
+ , brush = d3.svg.brush()
16
+ ;
17
+
18
+ var margin = {top: 30, right: 30, bottom: 30, left: 60}
19
+ , margin2 = {top: 0, right: 30, bottom: 20, left: 60}
20
+ , color = nv.utils.defaultColor()
21
+ , width = null
22
+ , height = null
23
+ , height2 = 100
24
+ , x
25
+ , y
26
+ , x2
27
+ , y2
28
+ , showLegend = true
29
+ , brushExtent = null
30
+ , tooltips = true
31
+ , tooltip = function(key, x, y, e, graph) {
32
+ return '<h3>' + key + '</h3>' +
33
+ '<p>' + y + ' at ' + x + '</p>'
34
+ }
35
+ , noData = "No Data Available."
36
+ , dispatch = d3.dispatch('tooltipShow', 'tooltipHide', 'brush')
37
+ ;
38
+
39
+ lines
40
+ .clipEdge(true)
41
+ ;
42
+ lines2
43
+ .interactive(false)
44
+ ;
45
+ xAxis
46
+ .orient('bottom')
47
+ .tickPadding(5)
48
+ ;
49
+ yAxis
50
+ .orient('left')
51
+ ;
52
+ x2Axis
53
+ .orient('bottom')
54
+ .tickPadding(5)
55
+ ;
56
+ y2Axis
57
+ .orient('left')
58
+ ;
59
+ //============================================================
60
+
61
+
62
+ //============================================================
63
+ // Private Variables
64
+ //------------------------------------------------------------
65
+
66
+ var showTooltip = function(e, offsetElement) {
67
+ var left = e.pos[0] + ( offsetElement.offsetLeft || 0 ),
68
+ top = e.pos[1] + ( offsetElement.offsetTop || 0),
69
+ x = xAxis.tickFormat()(lines.x()(e.point, e.pointIndex)),
70
+ y = yAxis.tickFormat()(lines.y()(e.point, e.pointIndex)),
71
+ content = tooltip(e.series.key, x, y, e, chart);
72
+
73
+ nv.tooltip.show([left, top], content, null, null, offsetElement);
74
+ };
75
+
76
+ //============================================================
77
+
78
+
79
+ function chart(selection) {
80
+ selection.each(function(data) {
81
+ var container = d3.select(this),
82
+ that = this;
83
+
84
+ var availableWidth = (width || parseInt(container.style('width')) || 960)
85
+ - margin.left - margin.right,
86
+ availableHeight1 = (height || parseInt(container.style('height')) || 400)
87
+ - margin.top - margin.bottom - height2,
88
+ availableHeight2 = height2 - margin2.top - margin2.bottom;
89
+
90
+ chart.update = function() { container.transition().call(chart) };
91
+ chart.container = this;
92
+
93
+
94
+ //------------------------------------------------------------
95
+ // Display No Data message if there's nothing to show.
96
+
97
+ if (!data || !data.length || !data.filter(function(d) { return d.values.length }).length) {
98
+ var noDataText = container.selectAll('.nv-noData').data([noData]);
99
+
100
+ noDataText.enter().append('text')
101
+ .attr('class', 'nvd3 nv-noData')
102
+ .attr('dy', '-.7em')
103
+ .style('text-anchor', 'middle');
104
+
105
+ noDataText
106
+ .attr('x', margin.left + availableWidth / 2)
107
+ .attr('y', margin.top + availableHeight1 / 2)
108
+ .text(function(d) { return d });
109
+
110
+ return chart;
111
+ } else {
112
+ container.selectAll('.nv-noData').remove();
113
+ }
114
+
115
+ //------------------------------------------------------------
116
+
117
+
118
+ //------------------------------------------------------------
119
+ // Setup Scales
120
+
121
+ x = lines.xScale();
122
+ y = lines.yScale();
123
+ x2 = lines2.xScale();
124
+ y2 = lines2.yScale();
125
+
126
+ //------------------------------------------------------------
127
+
128
+
129
+ //------------------------------------------------------------
130
+ // Setup containers and skeleton of chart
131
+
132
+ var wrap = container.selectAll('g.nv-wrap.nv-lineWithFocusChart').data([data]);
133
+ var gEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-lineWithFocusChart').append('g');
134
+ var g = wrap.select('g');
135
+
136
+ gEnter.append('g').attr('class', 'nv-legendWrap');
137
+
138
+ var focusEnter = gEnter.append('g').attr('class', 'nv-focus');
139
+ focusEnter.append('g').attr('class', 'nv-x nv-axis');
140
+ focusEnter.append('g').attr('class', 'nv-y nv-axis');
141
+ focusEnter.append('g').attr('class', 'nv-linesWrap');
142
+
143
+ var contextEnter = gEnter.append('g').attr('class', 'nv-context');
144
+ contextEnter.append('g').attr('class', 'nv-x nv-axis');
145
+ contextEnter.append('g').attr('class', 'nv-y nv-axis');
146
+ contextEnter.append('g').attr('class', 'nv-linesWrap');
147
+ contextEnter.append('g').attr('class', 'nv-brushBackground');
148
+ contextEnter.append('g').attr('class', 'nv-x nv-brush');
149
+
150
+ //------------------------------------------------------------
151
+
152
+
153
+ //------------------------------------------------------------
154
+ // Legend
155
+
156
+ if (showLegend) {
157
+ legend.width(availableWidth);
158
+
159
+ g.select('.nv-legendWrap')
160
+ .datum(data)
161
+ .call(legend);
162
+
163
+ if ( margin.top != legend.height()) {
164
+ margin.top = legend.height();
165
+ availableHeight1 = (height || parseInt(container.style('height')) || 400)
166
+ - margin.top - margin.bottom - height2;
167
+ }
168
+
169
+ g.select('.nv-legendWrap')
170
+ .attr('transform', 'translate(0,' + (-margin.top) +')')
171
+ }
172
+
173
+ //------------------------------------------------------------
174
+
175
+
176
+ wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')');
177
+
178
+
179
+ //------------------------------------------------------------
180
+ // Main Chart Component(s)
181
+
182
+ lines
183
+ .width(availableWidth)
184
+ .height(availableHeight1)
185
+ .color(
186
+ data
187
+ .map(function(d,i) {
188
+ return d.color || color(d, i);
189
+ })
190
+ .filter(function(d,i) {
191
+ return !data[i].disabled;
192
+ })
193
+ );
194
+
195
+ lines2
196
+ .defined(lines.defined())
197
+ .width(availableWidth)
198
+ .height(availableHeight2)
199
+ .color(
200
+ data
201
+ .map(function(d,i) {
202
+ return d.color || color(d, i);
203
+ })
204
+ .filter(function(d,i) {
205
+ return !data[i].disabled;
206
+ })
207
+ );
208
+
209
+ g.select('.nv-context')
210
+ .attr('transform', 'translate(0,' + ( availableHeight1 + margin.bottom + margin2.top) + ')')
211
+
212
+ var contextLinesWrap = g.select('.nv-context .nv-linesWrap')
213
+ .datum(data.filter(function(d) { return !d.disabled }))
214
+
215
+ d3.transition(contextLinesWrap).call(lines2);
216
+
217
+ //------------------------------------------------------------
218
+
219
+
220
+ /*
221
+ var focusLinesWrap = g.select('.nv-focus .nv-linesWrap')
222
+ .datum(data.filter(function(d) { return !d.disabled }))
223
+
224
+ d3.transition(focusLinesWrap).call(lines);
225
+ */
226
+
227
+
228
+ //------------------------------------------------------------
229
+ // Setup Main (Focus) Axes
230
+
231
+ xAxis
232
+ .scale(x)
233
+ .ticks( availableWidth / 100 )
234
+ .tickSize(-availableHeight1, 0);
235
+
236
+ yAxis
237
+ .scale(y)
238
+ .ticks( availableHeight1 / 36 )
239
+ .tickSize( -availableWidth, 0);
240
+
241
+ g.select('.nv-focus .nv-x.nv-axis')
242
+ .attr('transform', 'translate(0,' + availableHeight1 + ')');
243
+
244
+ //------------------------------------------------------------
245
+
246
+
247
+ //------------------------------------------------------------
248
+ // Setup Brush
249
+
250
+ brush
251
+ .x(x2)
252
+ .on('brush', onBrush);
253
+
254
+ if (brushExtent) brush.extent(brushExtent);
255
+
256
+ var brushBG = g.select('.nv-brushBackground').selectAll('g')
257
+ .data([brushExtent || brush.extent()])
258
+
259
+ var brushBGenter = brushBG.enter()
260
+ .append('g');
261
+
262
+ brushBGenter.append('rect')
263
+ .attr('class', 'left')
264
+ .attr('x', 0)
265
+ .attr('y', 0)
266
+ .attr('height', availableHeight2);
267
+
268
+ brushBGenter.append('rect')
269
+ .attr('class', 'right')
270
+ .attr('x', 0)
271
+ .attr('y', 0)
272
+ .attr('height', availableHeight2);
273
+
274
+ gBrush = g.select('.nv-x.nv-brush')
275
+ .call(brush);
276
+ gBrush.selectAll('rect')
277
+ //.attr('y', -5)
278
+ .attr('height', availableHeight2);
279
+ gBrush.selectAll('.resize').append('path').attr('d', resizePath);
280
+
281
+ onBrush();
282
+
283
+ //------------------------------------------------------------
284
+
285
+
286
+ //------------------------------------------------------------
287
+ // Setup Secondary (Context) Axes
288
+
289
+ x2Axis
290
+ .scale(x2)
291
+ .ticks( availableWidth / 100 )
292
+ .tickSize(-availableHeight2, 0);
293
+
294
+ g.select('.nv-context .nv-x.nv-axis')
295
+ .attr('transform', 'translate(0,' + y2.range()[0] + ')');
296
+ d3.transition(g.select('.nv-context .nv-x.nv-axis'))
297
+ .call(x2Axis);
298
+
299
+
300
+ y2Axis
301
+ .scale(y2)
302
+ .ticks( availableHeight2 / 36 )
303
+ .tickSize( -availableWidth, 0);
304
+
305
+ d3.transition(g.select('.nv-context .nv-y.nv-axis'))
306
+ .call(y2Axis);
307
+
308
+ g.select('.nv-context .nv-x.nv-axis')
309
+ .attr('transform', 'translate(0,' + y2.range()[0] + ')');
310
+
311
+ //------------------------------------------------------------
312
+
313
+
314
+ //============================================================
315
+ // Event Handling/Dispatching (in chart's scope)
316
+ //------------------------------------------------------------
317
+
318
+ legend.dispatch.on('legendClick', function(d,i) {
319
+ d.disabled = !d.disabled;
320
+
321
+ if (!data.filter(function(d) { return !d.disabled }).length) {
322
+ data.map(function(d) {
323
+ d.disabled = false;
324
+ wrap.selectAll('.nv-series').classed('disabled', false);
325
+ return d;
326
+ });
327
+ }
328
+
329
+ container.transition().call(chart);
330
+ });
331
+
332
+ dispatch.on('tooltipShow', function(e) {
333
+ if (tooltips) showTooltip(e, that.parentNode);
334
+ });
335
+
336
+ //============================================================
337
+
338
+
339
+ //============================================================
340
+ // Functions
341
+ //------------------------------------------------------------
342
+
343
+ // Taken from crossfilter (http://square.github.com/crossfilter/)
344
+ function resizePath(d) {
345
+ var e = +(d == 'e'),
346
+ x = e ? 1 : -1,
347
+ y = availableHeight2 / 3;
348
+ return 'M' + (.5 * x) + ',' + y
349
+ + 'A6,6 0 0 ' + e + ' ' + (6.5 * x) + ',' + (y + 6)
350
+ + 'V' + (2 * y - 6)
351
+ + 'A6,6 0 0 ' + e + ' ' + (.5 * x) + ',' + (2 * y)
352
+ + 'Z'
353
+ + 'M' + (2.5 * x) + ',' + (y + 8)
354
+ + 'V' + (2 * y - 8)
355
+ + 'M' + (4.5 * x) + ',' + (y + 8)
356
+ + 'V' + (2 * y - 8);
357
+ }
358
+
359
+
360
+ function updateBrushBG() {
361
+ if (!brush.empty()) brush.extent(brushExtent);
362
+ brushBG
363
+ .data([brush.empty() ? x2.domain() : brushExtent])
364
+ .each(function(d,i) {
365
+ var leftWidth = x2(d[0]) - x.range()[0],
366
+ rightWidth = x.range()[1] - x2(d[1]);
367
+ d3.select(this).select('.left')
368
+ .attr('width', leftWidth < 0 ? 0 : leftWidth);
369
+
370
+ d3.select(this).select('.right')
371
+ .attr('x', x2(d[1]))
372
+ .attr('width', rightWidth < 0 ? 0 : rightWidth);
373
+ });
374
+ }
375
+
376
+
377
+ function onBrush() {
378
+ brushExtent = brush.empty() ? null : brush.extent();
379
+ extent = brush.empty() ? x2.domain() : brush.extent();
380
+
381
+
382
+ dispatch.brush({extent: extent, brush: brush});
383
+
384
+
385
+ updateBrushBG();
386
+
387
+ // Update Main (Focus)
388
+ var focusLinesWrap = g.select('.nv-focus .nv-linesWrap')
389
+ .datum(
390
+ data
391
+ .filter(function(d) { return !d.disabled })
392
+ .map(function(d,i) {
393
+ return {
394
+ key: d.key,
395
+ values: d.values.filter(function(d,i) {
396
+ return lines.x()(d,i) >= extent[0] && lines.x()(d,i) <= extent[1];
397
+ })
398
+ }
399
+ })
400
+ );
401
+ d3.transition(focusLinesWrap).call(lines);
402
+
403
+
404
+ // Update Main (Focus) Axes
405
+ d3.transition(g.select('.nv-focus .nv-x.nv-axis'))
406
+ .call(xAxis);
407
+ d3.transition(g.select('.nv-focus .nv-y.nv-axis'))
408
+ .call(yAxis);
409
+ }
410
+
411
+ //============================================================
412
+
413
+
414
+ });
415
+
416
+ return chart;
417
+ }
418
+
419
+
420
+ //============================================================
421
+ // Event Handling/Dispatching (out of chart's scope)
422
+ //------------------------------------------------------------
423
+
424
+ lines.dispatch.on('elementMouseover.tooltip', function(e) {
425
+ e.pos = [e.pos[0] + margin.left, e.pos[1] + margin.top];
426
+ dispatch.tooltipShow(e);
427
+ });
428
+
429
+ lines.dispatch.on('elementMouseout.tooltip', function(e) {
430
+ dispatch.tooltipHide(e);
431
+ });
432
+
433
+ dispatch.on('tooltipHide', function() {
434
+ if (tooltips) nv.tooltip.cleanup();
435
+ });
436
+
437
+ //============================================================
438
+
439
+
440
+ //============================================================
441
+ // Expose Public Variables
442
+ //------------------------------------------------------------
443
+
444
+ // expose chart's sub-components
445
+ chart.dispatch = dispatch;
446
+ chart.legend = legend;
447
+ chart.lines = lines;
448
+ chart.lines2 = lines2;
449
+ chart.xAxis = xAxis;
450
+ chart.yAxis = yAxis;
451
+ chart.x2Axis = x2Axis;
452
+ chart.y2Axis = y2Axis;
453
+
454
+ d3.rebind(chart, lines, 'defined', 'isArea', 'size', 'xDomain', 'yDomain', 'forceX', 'forceY', 'interactive', 'clipEdge', 'clipVoronoi', 'id');
455
+
456
+ chart.x = function(_) {
457
+ if (!arguments.length) return lines.x;
458
+ lines.x(_);
459
+ lines2.x(_);
460
+ return chart;
461
+ };
462
+
463
+ chart.y = function(_) {
464
+ if (!arguments.length) return lines.y;
465
+ lines.y(_);
466
+ lines2.y(_);
467
+ return chart;
468
+ };
469
+
470
+ chart.margin = function(_) {
471
+ if (!arguments.length) return margin;
472
+ margin.top = typeof _.top != 'undefined' ? _.top : margin.top;
473
+ margin.right = typeof _.right != 'undefined' ? _.right : margin.right;
474
+ margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom;
475
+ margin.left = typeof _.left != 'undefined' ? _.left : margin.left;
476
+ return chart;
477
+ };
478
+
479
+ chart.margin2 = function(_) {
480
+ if (!arguments.length) return margin2;
481
+ margin2 = _;
482
+ return chart;
483
+ };
484
+
485
+ chart.width = function(_) {
486
+ if (!arguments.length) return width;
487
+ width = _;
488
+ return chart;
489
+ };
490
+
491
+ chart.height = function(_) {
492
+ if (!arguments.length) return height;
493
+ height = _;
494
+ return chart;
495
+ };
496
+
497
+ chart.height2 = function(_) {
498
+ if (!arguments.length) return height2;
499
+ height2 = _;
500
+ return chart;
501
+ };
502
+
503
+ chart.color = function(_) {
504
+ if (!arguments.length) return color;
505
+ color =nv.utils.getColor(_);
506
+ legend.color(color);
507
+ return chart;
508
+ };
509
+
510
+ chart.showLegend = function(_) {
511
+ if (!arguments.length) return showLegend;
512
+ showLegend = _;
513
+ return chart;
514
+ };
515
+
516
+ chart.tooltips = function(_) {
517
+ if (!arguments.length) return tooltips;
518
+ tooltips = _;
519
+ return chart;
520
+ };
521
+
522
+ chart.tooltipContent = function(_) {
523
+ if (!arguments.length) return tooltip;
524
+ tooltip = _;
525
+ return chart;
526
+ };
527
+
528
+ chart.interpolate = function(_) {
529
+ if (!arguments.length) return lines.interpolate();
530
+ lines.interpolate(_);
531
+ lines2.interpolate(_);
532
+ return chart;
533
+ };
534
+
535
+ chart.noData = function(_) {
536
+ if (!arguments.length) return noData;
537
+ noData = _;
538
+ return chart;
539
+ };
540
+
541
+ // Chart has multiple similar Axes, to prevent code duplication, probably need to link all axis functions manually like below
542
+ chart.xTickFormat = function(_) {
543
+ if (!arguments.length) return xAxis.tickFormat();
544
+ xAxis.tickFormat(_);
545
+ x2Axis.tickFormat(_);
546
+ return chart;
547
+ };
548
+
549
+ chart.yTickFormat = function(_) {
550
+ if (!arguments.length) return yAxis.tickFormat();
551
+ yAxis.tickFormat(_);
552
+ y2Axis.tickFormat(_);
553
+ return chart;
554
+ };
555
+
556
+ //============================================================
557
+
558
+
559
+ return chart;
560
+ }