chartkick 2.2.3 → 2.2.4

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of chartkick might be problematic. Click here for more details.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f46ec92735ba9997a65a29ad80eb469d3941dc2a
4
- data.tar.gz: cf59f724aa203cb7cc3fd3fad78691ffc783632e
3
+ metadata.gz: 4a12b7c456c1629ffea1a3a0e24c3d04570976df
4
+ data.tar.gz: e95c19db240c947706b9e7cada5d801a01f7816f
5
5
  SHA512:
6
- metadata.gz: 6ec3ca205f0fab3202b92603abb226a92a4304476bc40d8d0776ce523f254ec9f8a8c6f031f3fb212e85668c42e08c775f20b9b31580500e976aacc3c7c6f0b9
7
- data.tar.gz: 4b9828b60562e2bb5a1f15ff6a770aa1eca7aaef418e6dffa1beee5e1bab5e21fc43a787640b7db7a718437ec4107097eff36942188fd7c6f73309fed447843a
6
+ metadata.gz: 1607fb1576ad4245e735590dc7de1aa305c51b19b5bdefaebc42e7b9a860be1804da044cb8c2ac46fa18a3e4327946b0235ed5b2fd0fac9b004707c01e4870eb
7
+ data.tar.gz: 7a24d02544deff043efc1f7cb9fa4e51611393620bdee646e1b6b554c8941774bd8e1cca0fe98a825a4aa80c23b5ceed61357c8e03492a5e936272b4185149cf
@@ -1,3 +1,8 @@
1
+ ## 2.2.4
2
+
3
+ - Added compatibility with Rails API
4
+ - Updated Chartkick.js to 2.2.4
5
+
1
6
  ## 2.2.3
2
7
 
3
8
  - Updated Chartkick.js to 2.2.3
@@ -2,7 +2,7 @@
2
2
  * Chartkick.js
3
3
  * Create beautiful charts with one line of JavaScript
4
4
  * https://github.com/ankane/chartkick.js
5
- * v2.2.3
5
+ * v2.2.4
6
6
  * MIT License
7
7
  */
8
8
 
@@ -569,17 +569,22 @@
569
569
 
570
570
  options.xAxis.categories = categories;
571
571
 
572
- var newSeries = [];
572
+ var newSeries = [], d2;
573
573
  for (i = 0; i < series.length; i++) {
574
574
  d = [];
575
575
  for (j = 0; j < categories.length; j++) {
576
576
  d.push(rows[categories[j]][i] || 0);
577
577
  }
578
578
 
579
- newSeries.push({
579
+ d2 = {
580
580
  name: series[i].name,
581
581
  data: d
582
- });
582
+ }
583
+ if (series[i].stack) {
584
+ d2.stack = series[i].stack;
585
+ }
586
+
587
+ newSeries.push(d2);
583
588
  }
584
589
  options.series = newSeries;
585
590
 
@@ -1058,7 +1063,7 @@
1058
1063
  var defaultColors = [
1059
1064
  "#3366CC", "#DC3912", "#FF9900", "#109618", "#990099", "#3B3EAC", "#0099C6",
1060
1065
  "#DD4477", "#66AA00", "#B82E2E", "#316395", "#994499", "#22AA99", "#AAAA11",
1061
- "#6633CC", "#E67300", "#8B0707", "#329262", "#5574A6", "#3B3EAC"
1066
+ "#6633CC", "#E67300", "#8B0707", "#329262", "#5574A6", "#651067"
1062
1067
  ];
1063
1068
 
1064
1069
  var hideLegend = function (options, legend, hideLegend) {
@@ -1237,6 +1242,10 @@
1237
1242
  borderWidth: 2
1238
1243
  };
1239
1244
 
1245
+ if (s.stack) {
1246
+ dataset.stack = s.stack;
1247
+ }
1248
+
1240
1249
  if (chart.options.curve === false) {
1241
1250
  dataset.lineTension = 0;
1242
1251
  }
@@ -1565,6 +1574,22 @@
1565
1574
  return false;
1566
1575
  }
1567
1576
 
1577
+ // creates a shallow copy of each element of the array
1578
+ // elements are expected to be objects
1579
+ function copySeries(series) {
1580
+ var newSeries = [], i, j;
1581
+ for (i = 0; i < series.length; i++) {
1582
+ var copy = {}
1583
+ for (j in series[i]) {
1584
+ if (series[i].hasOwnProperty(j)) {
1585
+ copy[j] = series[i][j];
1586
+ }
1587
+ }
1588
+ newSeries.push(copy)
1589
+ }
1590
+ return newSeries;
1591
+ }
1592
+
1568
1593
  function processSeries(chart, keyType) {
1569
1594
  var i;
1570
1595
 
@@ -1591,6 +1616,7 @@
1591
1616
  }
1592
1617
 
1593
1618
  // right format
1619
+ series = copySeries(series);
1594
1620
  for (i = 0; i < series.length; i++) {
1595
1621
  series[i].data = formatSeriesData(toArr(series[i].data), keyType);
1596
1622
  }
@@ -1702,10 +1728,10 @@
1702
1728
  fetchDataSource(chart, callback, chart.rawData);
1703
1729
  };
1704
1730
  chart.refreshData = function () {
1705
- if (typeof dataSource === "string") {
1731
+ if (typeof chart.dataSource === "string") {
1706
1732
  // prevent browser from caching
1707
- var sep = dataSource.indexOf("?") === -1 ? "?" : "&";
1708
- var url = dataSource + sep + "_=" + (new Date()).getTime();
1733
+ var sep = chart.dataSource.indexOf("?") === -1 ? "?" : "&";
1734
+ var url = chart.dataSource + sep + "_=" + (new Date()).getTime();
1709
1735
  fetchDataSource(chart, callback, url);
1710
1736
  }
1711
1737
  };
@@ -7,7 +7,7 @@ Gem::Specification.new do |spec|
7
7
  spec.name = "chartkick"
8
8
  spec.version = Chartkick::VERSION
9
9
  spec.authors = ["Andrew Kane"]
10
- spec.email = ["acekane1@gmail.com"]
10
+ spec.email = ["andrew@chartkick.com"]
11
11
  spec.description = "Create beautiful JavaScript charts with one line of Ruby"
12
12
  spec.summary = "Create beautiful JavaScript charts with one line of Ruby"
13
13
  spec.homepage = "http://chartkick.com"
@@ -1,11 +1,13 @@
1
1
  module Chartkick
2
2
  class Engine < ::Rails::Engine
3
3
  initializer "precompile", group: :all do |app|
4
- if defined?(Sprockets) && Gem::Version.new(Sprockets::VERSION) >= Gem::Version.new("4.0.0.beta1")
5
- app.config.assets.precompile << "chartkick.js"
6
- else
7
- # use a proc instead of a string
8
- app.config.assets.precompile << proc { |path| path == "chartkick.js" }
4
+ if app.config.respond_to?(:assets)
5
+ if defined?(Sprockets) && Gem::Version.new(Sprockets::VERSION) >= Gem::Version.new("4.0.0.beta1")
6
+ app.config.assets.precompile << "chartkick.js"
7
+ else
8
+ # use a proc instead of a string
9
+ app.config.assets.precompile << proc { |path| path == "chartkick.js" }
10
+ end
9
11
  end
10
12
  end
11
13
 
@@ -1,3 +1,3 @@
1
1
  module Chartkick
2
- VERSION = "2.2.3"
2
+ VERSION = "2.2.4"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chartkick
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.3
4
+ version: 2.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Kane
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-02-23 00:00:00.000000000 Z
11
+ date: 2017-05-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -54,7 +54,7 @@ dependencies:
54
54
  version: '0'
55
55
  description: Create beautiful JavaScript charts with one line of Ruby
56
56
  email:
57
- - acekane1@gmail.com
57
+ - andrew@chartkick.com
58
58
  executables: []
59
59
  extensions: []
60
60
  extra_rdoc_files: []
@@ -96,7 +96,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
96
96
  version: '0'
97
97
  requirements: []
98
98
  rubyforge_project:
99
- rubygems_version: 2.6.8
99
+ rubygems_version: 2.6.11
100
100
  signing_key:
101
101
  specification_version: 4
102
102
  summary: Create beautiful JavaScript charts with one line of Ruby