chartkick 2.0.1 → 2.0.2
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 +4 -4
- data/CHANGELOG.md +5 -0
- data/README.md +2 -1
- data/app/assets/javascripts/chartkick.js +36 -1
- data/lib/chartkick/version.rb +1 -1
- data/vendor/assets/javascripts/Chart.bundle.js +14 -5
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7d2cca10828cf50bfef4cf0d276ca3b5f03874c6
|
4
|
+
data.tar.gz: 7dd04885900e535eda3bada4bb9efd91792dab01
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0481002107a308918f2db7bdb4fa6c2e820ae4d305b497c3e3acde5c51702bc42107b3c6e81e6c188f41c67e7af904d581617b37f8bd6a35605e94297c3e228b
|
7
|
+
data.tar.gz: 7ca0e4af5586b5b30f400452032ce81706775783ddd7414ee54d0fc570a96eac97ac741383d0de0d4ab5a97266b71fcccd4a6c9028900ef96cde4173a80c76a6
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -40,7 +40,7 @@ Area chart
|
|
40
40
|
<%= area_chart Visit.group_by_minute(:created_at).maximum(:load_time) %>
|
41
41
|
```
|
42
42
|
|
43
|
-
Scatter chart
|
43
|
+
Scatter chart
|
44
44
|
|
45
45
|
```erb
|
46
46
|
<%= scatter_chart City.pluck(:size, :population) %>
|
@@ -328,6 +328,7 @@ Check out [chartkick.js](https://github.com/ankane/chartkick.js)
|
|
328
328
|
## Tutorials
|
329
329
|
|
330
330
|
- [Make Easy Graphs and Charts on Rails with Chartkick](https://www.sitepoint.com/make-easy-graphs-and-charts-on-rails-with-chartkick/)
|
331
|
+
- [Practical Graphs on Rails: Chartkick in Practice](https://www.sitepoint.com/graphs-on-rails-chartkick-in-practice/)
|
331
332
|
|
332
333
|
## Upgrading
|
333
334
|
|
@@ -2,7 +2,7 @@
|
|
2
2
|
* Chartkick.js
|
3
3
|
* Create beautiful JavaScript charts with minimal code
|
4
4
|
* https://github.com/ankane/chartkick.js
|
5
|
-
* v2.0.
|
5
|
+
* v2.0.1
|
6
6
|
* MIT License
|
7
7
|
*/
|
8
8
|
|
@@ -1109,6 +1109,41 @@
|
|
1109
1109
|
this.renderBarChart = function (chart) {
|
1110
1110
|
self.renderColumnChart(chart, "bar");
|
1111
1111
|
};
|
1112
|
+
|
1113
|
+
this.renderScatterChart = function (chart) {
|
1114
|
+
var options = jsOptions(chart.data, chart.options);
|
1115
|
+
|
1116
|
+
var colors = chart.options.colors || defaultColors;
|
1117
|
+
|
1118
|
+
var datasets = [];
|
1119
|
+
var series = chart.data;
|
1120
|
+
for (var i = 0; i < series.length; i++) {
|
1121
|
+
var s = series[i];
|
1122
|
+
var d = [];
|
1123
|
+
for (var j = 0; j < s.data.length; j++) {
|
1124
|
+
d.push({
|
1125
|
+
x: toFloat(s.data[j][0]),
|
1126
|
+
y: toFloat(s.data[j][1])
|
1127
|
+
});
|
1128
|
+
}
|
1129
|
+
|
1130
|
+
datasets.push({
|
1131
|
+
label: s.name,
|
1132
|
+
showLine: false,
|
1133
|
+
data: d,
|
1134
|
+
borderColor: colors[i],
|
1135
|
+
backgroundColor: colors[i],
|
1136
|
+
pointBackgroundColor: colors[i]
|
1137
|
+
})
|
1138
|
+
}
|
1139
|
+
|
1140
|
+
var data = {datasets: datasets};
|
1141
|
+
|
1142
|
+
options.scales.xAxes[0].type = "linear";
|
1143
|
+
options.scales.xAxes[0].position = "bottom";
|
1144
|
+
|
1145
|
+
drawChart(chart, "line", data, options);
|
1146
|
+
};
|
1112
1147
|
};
|
1113
1148
|
|
1114
1149
|
adapters.unshift(ChartjsAdapter);
|
data/lib/chartkick/version.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
/*!
|
2
2
|
* Chart.js
|
3
3
|
* http://chartjs.org/
|
4
|
-
* Version: 2.2.
|
4
|
+
* Version: 2.2.1
|
5
5
|
*
|
6
6
|
* Copyright 2016 Nick Downie
|
7
7
|
* Released under the MIT license
|
@@ -6775,7 +6775,7 @@ module.exports = function(Chart) {
|
|
6775
6775
|
var meta = chart.getDatasetMeta(0);
|
6776
6776
|
var ds = data.datasets[0];
|
6777
6777
|
var arc = meta.data[i];
|
6778
|
-
var custom = arc.custom || {};
|
6778
|
+
var custom = arc && arc.custom || {};
|
6779
6779
|
var getValueAtIndexOrDefault = helpers.getValueAtIndexOrDefault;
|
6780
6780
|
var arcOpts = chart.options.elements.arc;
|
6781
6781
|
var fill = custom.backgroundColor ? custom.backgroundColor : getValueAtIndexOrDefault(ds.backgroundColor, i, arcOpts.backgroundColor);
|
@@ -6982,6 +6982,10 @@ module.exports = function(Chart) {
|
|
6982
6982
|
}
|
6983
6983
|
});
|
6984
6984
|
|
6985
|
+
/*if (total === 0) {
|
6986
|
+
total = NaN;
|
6987
|
+
}*/
|
6988
|
+
|
6985
6989
|
return total;
|
6986
6990
|
},
|
6987
6991
|
|
@@ -12864,7 +12868,7 @@ module.exports = function(Chart) {
|
|
12864
12868
|
}
|
12865
12869
|
|
12866
12870
|
if (!loop) {
|
12867
|
-
ctx.lineTo(points[
|
12871
|
+
ctx.lineTo(points[lastDrawnIndex]._view.x, scaleZero);
|
12868
12872
|
}
|
12869
12873
|
|
12870
12874
|
ctx.fillStyle = vm.backgroundColor || globalDefaults.defaultColor;
|
@@ -12907,7 +12911,7 @@ module.exports = function(Chart) {
|
|
12907
12911
|
previous = lastDrawnIndex === -1 ? previous : points[lastDrawnIndex];
|
12908
12912
|
|
12909
12913
|
if (!currentVM.skip) {
|
12910
|
-
if (lastDrawnIndex !== (index - 1) && !spanGaps) {
|
12914
|
+
if ((lastDrawnIndex !== (index - 1) && !spanGaps) || lastDrawnIndex === -1) {
|
12911
12915
|
// There was a gap and this is the first point after the gap
|
12912
12916
|
ctx.moveTo(currentVM.x, currentVM.y);
|
12913
12917
|
} else {
|
@@ -14428,10 +14432,15 @@ module.exports = function(Chart) {
|
|
14428
14432
|
// Only round the last tick if we have no hard maximum
|
14429
14433
|
if (!me.options.time.max) {
|
14430
14434
|
var roundedEnd = me.getMomentStartOf(me.lastTick);
|
14431
|
-
|
14435
|
+
var delta = roundedEnd.diff(me.lastTick, me.tickUnit, true);
|
14436
|
+
if (delta < 0) {
|
14432
14437
|
// Do not use end of because we need me to be in the next time unit
|
14433
14438
|
me.lastTick = me.getMomentStartOf(me.lastTick.add(1, me.tickUnit));
|
14439
|
+
} else if (delta >= 0) {
|
14440
|
+
me.lastTick = roundedEnd;
|
14434
14441
|
}
|
14442
|
+
|
14443
|
+
me.scaleSizeInUnits = me.lastTick.diff(me.firstTick, me.tickUnit, true);
|
14435
14444
|
}
|
14436
14445
|
|
14437
14446
|
me.smallestLabelSeparation = me.width;
|
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.0.
|
4
|
+
version: 2.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Kane
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-08-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|