chart 0.1.3.beta1 → 0.1.3.beta2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: db8a451b4829c7ea90c5cdcf8bd0033310c9d4e4
4
- data.tar.gz: c47f163bb79379618fdcf52e9c34b483b33d1405
3
+ metadata.gz: 6529ef081e8195dc83e23f167990599e7ad4d01d
4
+ data.tar.gz: 308ade872fcdb7706a4bf60a981e8df0a223ca2a
5
5
  SHA512:
6
- metadata.gz: 2d9d91c8573ade03d6d5b1418362e4c9d9cb11b6a29dcd8c60ba0b71468bab863a347086cb04d316f07c0859730d473a527573714500587eb9b71d9e0e9b814d
7
- data.tar.gz: b68e02b179dc394dd7fa04a066b068bd55caa1a16939d7551e0e90dd5699d611475a5934430cd709b151baa104fe4c7aa29190b4282e9af360a17c5e4ee311ee
6
+ metadata.gz: fcaf1c71fc3b668a7994c051ee4da3b915b5af4b78a60a22bb291c58734e5ffd60dbf26281ca6bf7f76841e537b41e66a87b3e7c5bcca4d666bdb48bec43873d
7
+ data.tar.gz: eb7f898dd62681d542f90ced0e691ee69efb558f864be766e4faa8941eb46b8d9b42b14984f917d508d237e3ffe292e214b78bec03983fdaadde1c0e0739ccd4
data/README.md CHANGED
@@ -52,32 +52,31 @@ At Application.js, write `//= require chart` after turbolinks. Only require the
52
52
  ```
53
53
  //= require turbolinks
54
54
  //= require chart
55
- //= require nv.d3
55
+ //= require nvd3
56
56
  //= require google
57
57
  //= require highchart
58
58
  ```
59
59
 
60
- At Application.css, write `*= require nv.d3`
60
+ At Application.css, write `*= require nvd3`
61
61
 
62
62
  ```
63
63
  *= require_tree .
64
- *= require nv.d3
64
+ *= require nvd3
65
65
  ```
66
66
 
67
67
  ## Important
68
68
 
69
69
  Chart ships with the following awesome charts:
70
70
 
71
- * [ChartJS](https://github.com/nnnick/Chart.js/)(1.02)
72
- * [NVD3](https://github.com/novus/nvd3)(1.8.2)
71
+ * [ChartJS](https://github.com/nnnick/Chart.js/) (1.02)
72
+ * [NVD3](https://github.com/novus/nvd3) (1.8.2)
73
73
  * [Google Chart](https://developers.google.com/chart/)
74
- * [Highchart](http://www.highcharts.com)(4.2.3)
74
+ * [Highchart](http://www.highcharts.com) (4.2.3)
75
75
 
76
76
  ## Example Usage
77
77
 
78
78
  ![Chart](assets/images/pie.gif)
79
79
 
80
-
81
80
  At your View
82
81
  ```
83
82
  <%= pie :pie_chart, @pieSize, @pieData%>
@@ -1,3 +1,3 @@
1
1
  module Chart
2
- VERSION = "0.1.3.beta1"
2
+ VERSION = "0.1.3.beta2"
3
3
  end
@@ -1522,7 +1522,7 @@ nv.utils.arrayEquals = function (array1, array2) {
1522
1522
  if (!array1 || !array2)
1523
1523
  return false;
1524
1524
 
1525
- // compare lengths - can save a lot of time
1525
+ // compare lengths - can save a lot of time
1526
1526
  if (array1.length != array2.length)
1527
1527
  return false;
1528
1528
 
@@ -1864,9 +1864,9 @@ nv.utils.arrayEquals = function (array1, array2) {
1864
1864
  and the arithmetic trick below solves that.
1865
1865
  */
1866
1866
  return !parseFloat(Math.round(d * 100000) / 1000000) && (d !== undefined)
1867
- })
1867
+ })
1868
1868
  .classed('zero', true);
1869
-
1869
+
1870
1870
  //store old scales for use in transitions on update
1871
1871
  scale0 = scale.copy();
1872
1872
 
@@ -4158,7 +4158,7 @@ nv.models.discreteBarChart = function() {
4158
4158
  gEnter.append('g').attr('class', 'nv-legendWrap');
4159
4159
 
4160
4160
  g.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')');
4161
-
4161
+
4162
4162
  if (showLegend) {
4163
4163
  legend.width(availableWidth);
4164
4164
 
@@ -4174,11 +4174,11 @@ nv.models.discreteBarChart = function() {
4174
4174
  wrap.select('.nv-legendWrap')
4175
4175
  .attr('transform', 'translate(0,' + (-margin.top) +')')
4176
4176
  }
4177
-
4177
+
4178
4178
  if (rightAlignYAxis) {
4179
4179
  g.select(".nv-y.nv-axis")
4180
4180
  .attr("transform", "translate(" + availableWidth + ",0)");
4181
- }
4181
+ }
4182
4182
 
4183
4183
  if (rightAlignYAxis) {
4184
4184
  g.select(".nv-y.nv-axis")
@@ -4675,13 +4675,13 @@ nv.models.furiousLegend = function() {
4675
4675
  var seriesWidths = [];
4676
4676
  series.each(function(d,i) {
4677
4677
  var legendText;
4678
- if (getKey(d).length > maxKeyLength) {
4678
+ if (getKey(d).length > maxKeyLength) {
4679
4679
  var trimmedKey = getKey(d).substring(0, maxKeyLength);
4680
4680
  legendText = d3.select(this).select('text').text(trimmedKey + "...");
4681
4681
  d3.select(this).append("svg:title").text(getKey(d));
4682
4682
  } else {
4683
4683
  legendText = d3.select(this).select('text');
4684
- }
4684
+ }
4685
4685
  var nodeTextLength;
4686
4686
  try {
4687
4687
  nodeTextLength = legendText.node().getComputedTextLength();
@@ -5651,13 +5651,13 @@ nv.models.legend = function() {
5651
5651
  var seriesWidths = [];
5652
5652
  series.each(function(d,i) {
5653
5653
  var legendText;
5654
- if (getKey(d).length > maxKeyLength) {
5654
+ if (getKey(d).length > maxKeyLength) {
5655
5655
  var trimmedKey = getKey(d).substring(0, maxKeyLength);
5656
5656
  legendText = d3.select(this).select('text').text(trimmedKey + "...");
5657
5657
  d3.select(this).append("svg:title").text(getKey(d));
5658
5658
  } else {
5659
5659
  legendText = d3.select(this).select('text');
5660
- }
5660
+ }
5661
5661
  var nodeTextLength;
5662
5662
  try {
5663
5663
  nodeTextLength = legendText.node().getComputedTextLength();
@@ -6141,7 +6141,7 @@ nv.models.lineChart = function() {
6141
6141
  }).headerFormatter(function(d, i) {
6142
6142
  return xAxis.tickFormat()(d, i);
6143
6143
  });
6144
-
6144
+
6145
6145
  interactiveLayer.tooltip.valueFormatter(function(d, i) {
6146
6146
  return yAxis.tickFormat()(d, i);
6147
6147
  }).headerFormatter(function(d, i) {
@@ -6188,7 +6188,7 @@ nv.models.lineChart = function() {
6188
6188
  availableHeight1 = nv.utils.availableHeight(height, container, margin) - (focusEnable ? focusHeight : 0),
6189
6189
  availableHeight2 = focusHeight - margin2.top - margin2.bottom;
6190
6190
 
6191
- chart.update = function() {
6191
+ chart.update = function() {
6192
6192
  if( duration === 0 ) {
6193
6193
  container.call( chart );
6194
6194
  } else {
@@ -6291,7 +6291,7 @@ nv.models.lineChart = function() {
6291
6291
  g.select('.nv-focus .nv-background rect')
6292
6292
  .attr('width', availableWidth)
6293
6293
  .attr('height', availableHeight1);
6294
-
6294
+
6295
6295
  lines
6296
6296
  .width(availableWidth)
6297
6297
  .height(availableHeight1)
@@ -6342,7 +6342,7 @@ nv.models.lineChart = function() {
6342
6342
  ;
6343
6343
  }
6344
6344
  }
6345
-
6345
+
6346
6346
  g.select('.nv-focus .nv-x.nv-axis')
6347
6347
  .attr('transform', 'translate(0,' + availableHeight1 + ')');
6348
6348
 
@@ -6361,81 +6361,81 @@ nv.models.lineChart = function() {
6361
6361
  .color(data.map(function(d,i) {
6362
6362
  return d.color || color(d, i);
6363
6363
  }).filter(function(d,i) { return !data[i].disabled; }));
6364
-
6364
+
6365
6365
  g.select('.nv-context')
6366
6366
  .attr('transform', 'translate(0,' + ( availableHeight1 + margin.bottom + margin2.top) + ')')
6367
6367
  .style('display', focusEnable ? 'initial' : 'none')
6368
6368
  ;
6369
-
6369
+
6370
6370
  var contextLinesWrap = g.select('.nv-context .nv-linesWrap')
6371
6371
  .datum(data.filter(function(d) { return !d.disabled; }))
6372
6372
  ;
6373
-
6373
+
6374
6374
  d3.transition(contextLinesWrap).call(lines2);
6375
-
6376
-
6375
+
6376
+
6377
6377
  // Setup Brush
6378
6378
  brush
6379
6379
  .x(x2)
6380
6380
  .on('brush', function() {
6381
6381
  onBrush();
6382
6382
  });
6383
-
6383
+
6384
6384
  if (brushExtent) brush.extent(brushExtent);
6385
-
6385
+
6386
6386
  var brushBG = g.select('.nv-brushBackground').selectAll('g')
6387
6387
  .data([brushExtent || brush.extent()]);
6388
-
6388
+
6389
6389
  var brushBGenter = brushBG.enter()
6390
6390
  .append('g');
6391
-
6391
+
6392
6392
  brushBGenter.append('rect')
6393
6393
  .attr('class', 'left')
6394
6394
  .attr('x', 0)
6395
6395
  .attr('y', 0)
6396
6396
  .attr('height', availableHeight2);
6397
-
6397
+
6398
6398
  brushBGenter.append('rect')
6399
6399
  .attr('class', 'right')
6400
6400
  .attr('x', 0)
6401
6401
  .attr('y', 0)
6402
6402
  .attr('height', availableHeight2);
6403
-
6403
+
6404
6404
  var gBrush = g.select('.nv-x.nv-brush')
6405
6405
  .call(brush);
6406
6406
  gBrush.selectAll('rect')
6407
6407
  .attr('height', availableHeight2);
6408
6408
  gBrush.selectAll('.resize').append('path').attr('d', resizePath);
6409
-
6409
+
6410
6410
  onBrush();
6411
-
6411
+
6412
6412
  g.select('.nv-context .nv-background rect')
6413
6413
  .attr('width', availableWidth)
6414
6414
  .attr('height', availableHeight2);
6415
-
6415
+
6416
6416
  // Setup Secondary (Context) Axes
6417
6417
  if (focusShowAxisX) {
6418
6418
  x2Axis
6419
6419
  .scale(x2)
6420
6420
  ._ticks( nv.utils.calcTicksX(availableWidth/100, data) )
6421
6421
  .tickSize(-availableHeight2, 0);
6422
-
6422
+
6423
6423
  g.select('.nv-context .nv-x.nv-axis')
6424
6424
  .attr('transform', 'translate(0,' + y2.range()[0] + ')');
6425
6425
  d3.transition(g.select('.nv-context .nv-x.nv-axis'))
6426
6426
  .call(x2Axis);
6427
6427
  }
6428
-
6428
+
6429
6429
  if (focusShowAxisY) {
6430
6430
  y2Axis
6431
6431
  .scale(y2)
6432
6432
  ._ticks( nv.utils.calcTicksY(availableHeight2/36, data) )
6433
6433
  .tickSize( -availableWidth, 0);
6434
-
6434
+
6435
6435
  d3.transition(g.select('.nv-context .nv-y.nv-axis'))
6436
6436
  .call(y2Axis);
6437
6437
  }
6438
-
6438
+
6439
6439
  g.select('.nv-context .nv-x.nv-axis')
6440
6440
  .attr('transform', 'translate(0,' + y2.range()[0] + ')');
6441
6441
  }
@@ -6549,7 +6549,7 @@ nv.models.lineChart = function() {
6549
6549
  //============================================================
6550
6550
  // Functions
6551
6551
  //------------------------------------------------------------
6552
-
6552
+
6553
6553
  // Taken from crossfilter (http://square.github.com/crossfilter/)
6554
6554
  function resizePath(d) {
6555
6555
  var e = +(d == 'e'),
@@ -6565,8 +6565,8 @@ nv.models.lineChart = function() {
6565
6565
  + 'M' + (4.5 * x) + ',' + (y + 8)
6566
6566
  + 'V' + (2 * y - 8);
6567
6567
  }
6568
-
6569
-
6568
+
6569
+
6570
6570
  function updateBrushBG() {
6571
6571
  if (!brush.empty()) brush.extent(brushExtent);
6572
6572
  brushBG
@@ -6576,28 +6576,28 @@ nv.models.lineChart = function() {
6576
6576
  rightWidth = availableWidth - x2(d[1]);
6577
6577
  d3.select(this).select('.left')
6578
6578
  .attr('width', leftWidth < 0 ? 0 : leftWidth);
6579
-
6579
+
6580
6580
  d3.select(this).select('.right')
6581
6581
  .attr('x', x2(d[1]))
6582
6582
  .attr('width', rightWidth < 0 ? 0 : rightWidth);
6583
6583
  });
6584
6584
  }
6585
-
6586
-
6585
+
6586
+
6587
6587
  function onBrush() {
6588
6588
  brushExtent = brush.empty() ? null : brush.extent();
6589
6589
  var extent = brush.empty() ? x2.domain() : brush.extent();
6590
-
6590
+
6591
6591
  //The brush extent cannot be less than one. If it is, don't update the line chart.
6592
6592
  if (Math.abs(extent[0] - extent[1]) <= 1) {
6593
6593
  return;
6594
6594
  }
6595
-
6595
+
6596
6596
  dispatch.brush({extent: extent, brush: brush});
6597
-
6598
-
6597
+
6598
+
6599
6599
  updateBrushBG();
6600
-
6600
+
6601
6601
  // Update Main (Focus)
6602
6602
  var focusLinesWrap = g.select('.nv-focus .nv-linesWrap')
6603
6603
  .datum(
@@ -6616,8 +6616,8 @@ nv.models.lineChart = function() {
6616
6616
  })
6617
6617
  );
6618
6618
  focusLinesWrap.transition().duration(duration).call(lines);
6619
-
6620
-
6619
+
6620
+
6621
6621
  // Update Main (Focus) Axes
6622
6622
  updateXAxis();
6623
6623
  updateYAxis();
@@ -6747,7 +6747,7 @@ nv.models.lineChart = function() {
6747
6747
 
6748
6748
  nv.models.lineWithFocusChart = function() {
6749
6749
  return nv.models.lineChart()
6750
- .margin({ bottom: 30 })
6750
+ .margin({ bottom: 30 })
6751
6751
  .focusEnable( true );
6752
6752
  };
6753
6753
  nv.models.linePlusBarChart = function() {
@@ -9888,10 +9888,10 @@ nv.models.parallelCoordinates = function() {
9888
9888
  if (active.length === 0) {
9889
9889
  active = data;
9890
9890
  }; //set all active before first brush call
9891
-
9891
+
9892
9892
  dimensionNames = dimensionData.sort(function (a, b) { return a.currentPosition - b.currentPosition; }).map(function (d) { return d.key });
9893
9893
  enabledDimensions = dimensionData.filter(function (d) { return !d.disabled; });
9894
-
9894
+
9895
9895
 
9896
9896
  // Setup Scales
9897
9897
  x.rangePoints([0, availableWidth], 1).domain(enabledDimensions.map(function (d) { return d.key; }));
@@ -9978,7 +9978,7 @@ nv.models.parallelCoordinates = function() {
9978
9978
  .attr("y1", function(d) { return d[1]; })
9979
9979
  .attr("x2", function(d) { return d[2]; })
9980
9980
  .attr("y2", function(d) { return d[3]; });
9981
-
9981
+
9982
9982
  //Add the text "undefined values" under the missing value line
9983
9983
  missingValueslineText = wrap.select('.missingValuesline').selectAll('text').data(["undefined values"]);
9984
9984
  missingValueslineText.append('text').data(["undefined values"]);
@@ -10136,7 +10136,7 @@ nv.models.parallelCoordinates = function() {
10136
10136
  if (visible)
10137
10137
  y[f.dimension].brush.extent(f.extent);
10138
10138
  });
10139
-
10139
+
10140
10140
  dimensions.select('.nv-brushBackground')
10141
10141
  .each(function (d) {
10142
10142
  d3.select(this).call(y[d.key].brush);
@@ -10146,7 +10146,7 @@ nv.models.parallelCoordinates = function() {
10146
10146
  .attr('x', -8)
10147
10147
  .attr('width', 16);
10148
10148
  }
10149
-
10149
+
10150
10150
  // Handles a brush event, toggling the display of foreground lines.
10151
10151
  function brushstart() {
10152
10152
  //If brush aren't visible, show it before brushing again.
@@ -10154,7 +10154,7 @@ nv.models.parallelCoordinates = function() {
10154
10154
  restoreBrush(true);
10155
10155
  }
10156
10156
  }
10157
-
10157
+
10158
10158
  // Handles a brush event, toggling the display of foreground lines.
10159
10159
  function brush() {
10160
10160
  actives = dimensionNames.filter(function (p) { return !y[p].brush.empty(); }),
@@ -10278,7 +10278,7 @@ nv.models.parallelCoordinates = function() {
10278
10278
  } else {
10279
10279
  _.forEach(function (k, i) { dimensionData[i].key = k })
10280
10280
  }
10281
-
10281
+
10282
10282
  }},
10283
10283
  dimensionFormats: {get: function () { return dimensionData.map(function (d) { return d.format }); }, set: function (_) {
10284
10284
  // deprecated after 1.8.1
@@ -10333,7 +10333,7 @@ nv.models.parallelCoordinatesChart = function () {
10333
10333
  ;
10334
10334
 
10335
10335
  //============================================================
10336
-
10336
+
10337
10337
  //============================================================
10338
10338
  // Private Variables
10339
10339
  //------------------------------------------------------------
@@ -10425,7 +10425,7 @@ nv.models.parallelCoordinatesChart = function () {
10425
10425
  } else {
10426
10426
  container.selectAll('.nv-noData').remove();
10427
10427
  }
10428
-
10428
+
10429
10429
  //------------------------------------------------------------
10430
10430
  // Setup containers and skeleton of chart
10431
10431
 
@@ -10433,7 +10433,7 @@ nv.models.parallelCoordinatesChart = function () {
10433
10433
  var gEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-parallelCoordinatesChart').append('g');
10434
10434
 
10435
10435
  var g = wrap.select('g');
10436
-
10436
+
10437
10437
  gEnter.append('g').attr('class', 'nv-parallelCoordinatesWrap');
10438
10438
  gEnter.append('g').attr('class', 'nv-legendWrap');
10439
10439
 
@@ -10459,8 +10459,8 @@ nv.models.parallelCoordinatesChart = function () {
10459
10459
  }
10460
10460
  wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')');
10461
10461
 
10462
-
10463
-
10462
+
10463
+
10464
10464
 
10465
10465
  // Main Chart Component(s)
10466
10466
  parallelCoordinates
@@ -10468,12 +10468,12 @@ nv.models.parallelCoordinatesChart = function () {
10468
10468
  .height(availableHeight)
10469
10469
  .dimensionData(dimensionNames)
10470
10470
  .displayBrush(displayBrush);
10471
-
10471
+
10472
10472
  var parallelCoordinatesWrap = g.select('.nv-parallelCoordinatesWrap ')
10473
10473
  .datum(data);
10474
10474
 
10475
10475
  parallelCoordinatesWrap.transition().call(parallelCoordinates);
10476
-
10476
+
10477
10477
  //============================================================
10478
10478
  // Event Handling/Dispatching (in chart's scope)
10479
10479
  //------------------------------------------------------------
@@ -10547,7 +10547,7 @@ nv.models.parallelCoordinatesChart = function () {
10547
10547
  //============================================================
10548
10548
  // Expose Public Variables
10549
10549
  //------------------------------------------------------------
10550
-
10550
+
10551
10551
  // expose chart's sub-components
10552
10552
  chart.dispatch = dispatch;
10553
10553
  chart.parallelCoordinates = parallelCoordinates;
@@ -12205,7 +12205,7 @@ nv.models.sparkline = function() {
12205
12205
  //------------------------------------------------------------
12206
12206
 
12207
12207
  var renderWatch = nv.utils.renderWatch(dispatch);
12208
-
12208
+
12209
12209
  function chart(selection) {
12210
12210
  renderWatch.reset();
12211
12211
  selection.each(function(data) {
@@ -12270,7 +12270,7 @@ nv.models.sparkline = function() {
12270
12270
  getY(d, d.pointIndex) == y.domain()[0] ? 'nv-point nv-minValue' : 'nv-point nv-maxValue'
12271
12271
  });
12272
12272
  });
12273
-
12273
+
12274
12274
  renderWatch.renderEnd('sparkline immediate');
12275
12275
  return chart;
12276
12276
  }
@@ -12338,7 +12338,7 @@ nv.models.sparklinePlus = function() {
12338
12338
  , noData = null
12339
12339
  , dispatch = d3.dispatch('renderEnd')
12340
12340
  ;
12341
-
12341
+
12342
12342
  //============================================================
12343
12343
  // Private Variables
12344
12344
  //------------------------------------------------------------
@@ -12632,13 +12632,13 @@ nv.models.stackedArea = function() {
12632
12632
  gEnter.append('g').attr('class', 'nv-scatterWrap');
12633
12633
 
12634
12634
  wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')');
12635
-
12635
+
12636
12636
  // If the user has not specified forceY, make sure 0 is included in the domain
12637
12637
  // Otherwise, use user-specified values for forceY
12638
12638
  if (scatter.forceY().length == 0) {
12639
12639
  scatter.forceY().push(0);
12640
12640
  }
12641
-
12641
+
12642
12642
  scatter
12643
12643
  .width(availableWidth)
12644
12644
  .height(availableHeight)
@@ -13476,7 +13476,7 @@ nv.models.sunburst = function() {
13476
13476
 
13477
13477
  var g = wrapEnter.selectAll('nv-sunburst');
13478
13478
 
13479
- chart.update = function() {
13479
+ chart.update = function() {
13480
13480
  if ( duration === 0 ) {
13481
13481
  container.call(chart);
13482
13482
  } else {
@@ -13786,4 +13786,4 @@ nv.models.sunburstChart = function() {
13786
13786
  };
13787
13787
 
13788
13788
  nv.version = "1.8.2";
13789
- })();
13789
+ })();
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chart
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3.beta1
4
+ version: 0.1.3.beta2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bryan Lim
@@ -68,8 +68,8 @@ files:
68
68
  - vendor/assets/javascripts/d3.js
69
69
  - vendor/assets/javascripts/google.js
70
70
  - vendor/assets/javascripts/highcharts.js
71
- - vendor/assets/javascripts/nv.d3.js
72
- - vendor/assets/stylesheets/nv.d3.css
71
+ - vendor/assets/javascripts/nvd3.js
72
+ - vendor/assets/stylesheets/nvd3.css
73
73
  homepage: http://github.com/ytbryan/chart
74
74
  licenses:
75
75
  - MIT