chartkick 3.0.0 → 3.0.1
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 +4 -0
- data/README.md +3 -1
- data/lib/chartkick/version.rb +1 -1
- data/vendor/assets/javascripts/chartkick.js +32 -27
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4095d5927227369af302a38b18031a3e92ff04e8f9c75d2b9ee9d52ab5532457
|
4
|
+
data.tar.gz: 3441a58be2bfdca1073ca9595a51e25b7b801e8003690d97146d5c9208bde633
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2d19a25abd114e54310aa2828328d0ed1d6ce19f1a6a5c7185a1e647eaefdfb6c3ddabd216a4e8726613beaa0a945f97d56c946cc074823376b2cffd3525d28c
|
7
|
+
data.tar.gz: 38ffd924959c50e7849cb6cb32297b081c376c2695499913737212e7e6c2172ff646d24719b2eb27b3f8ad2984acbd7154e859378ed5375963f19f0444f90f9e
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
Create beautiful JavaScript charts with one line of Ruby. No more fighting with charting libraries!
|
4
4
|
|
5
|
-
[See it in action](https://
|
5
|
+
[See it in action](https://chartkick.com)
|
6
6
|
|
7
7
|
:fire: For admin charts and dashboards, check out [Blazer](https://github.com/ankane/blazer/)
|
8
8
|
|
@@ -300,6 +300,8 @@ If you want to use the charting library directly, get the code with:
|
|
300
300
|
|
301
301
|
The code will be logged to the JavaScript console.
|
302
302
|
|
303
|
+
**Note:** JavaScript functions cannot be logged, so it may not be identical.
|
304
|
+
|
303
305
|
### Download Charts
|
304
306
|
|
305
307
|
*Chart.js only*
|
data/lib/chartkick/version.rb
CHANGED
@@ -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
|
-
* v3.0.
|
5
|
+
* v3.0.1
|
6
6
|
* MIT License
|
7
7
|
*/
|
8
8
|
|
@@ -501,25 +501,7 @@
|
|
501
501
|
|
502
502
|
var i, j, s, d, key, rows = [], rows2 = [];
|
503
503
|
|
504
|
-
if (
|
505
|
-
for (var i$2 = 0; i$2 < series.length; i$2++) {
|
506
|
-
var s$2 = series[i$2];
|
507
|
-
var d$1 = [];
|
508
|
-
for (var j$2 = 0; j$2 < s$2.data.length; j$2++) {
|
509
|
-
var point = {
|
510
|
-
x: toFloat(s$2.data[j$2][0]),
|
511
|
-
y: toFloat(s$2.data[j$2][1])
|
512
|
-
};
|
513
|
-
if (chartType === "bubble") {
|
514
|
-
point.r = toFloat(s$2.data[j$2][2]) * 20 / max;
|
515
|
-
// custom attribute, for tooltip
|
516
|
-
point.v = s$2.data[j$2][2];
|
517
|
-
}
|
518
|
-
d$1.push(point);
|
519
|
-
}
|
520
|
-
rows2.push(d$1);
|
521
|
-
}
|
522
|
-
} else {
|
504
|
+
if (chartType === "bar" || chartType === "column" || (chart.xtype !== "number" && chart.xtype !== "bubble")) {
|
523
505
|
var sortedLabels = [];
|
524
506
|
|
525
507
|
for (i = 0; i < series.length; i++) {
|
@@ -538,7 +520,7 @@
|
|
538
520
|
}
|
539
521
|
}
|
540
522
|
|
541
|
-
if (chart.xtype === "datetime") {
|
523
|
+
if (chart.xtype === "datetime" || chart.xtype === "number") {
|
542
524
|
sortedLabels.sort(sortByNumber);
|
543
525
|
}
|
544
526
|
|
@@ -571,6 +553,24 @@
|
|
571
553
|
rows2[j].push(rows[i][j] === undefined ? null : rows[i][j]);
|
572
554
|
}
|
573
555
|
}
|
556
|
+
} else {
|
557
|
+
for (var i$2 = 0; i$2 < series.length; i$2++) {
|
558
|
+
var s$2 = series[i$2];
|
559
|
+
var d$1 = [];
|
560
|
+
for (var j$2 = 0; j$2 < s$2.data.length; j$2++) {
|
561
|
+
var point = {
|
562
|
+
x: toFloat(s$2.data[j$2][0]),
|
563
|
+
y: toFloat(s$2.data[j$2][1])
|
564
|
+
};
|
565
|
+
if (chartType === "bubble") {
|
566
|
+
point.r = toFloat(s$2.data[j$2][2]) * 20 / max;
|
567
|
+
// custom attribute, for tooltip
|
568
|
+
point.v = s$2.data[j$2][2];
|
569
|
+
}
|
570
|
+
d$1.push(point);
|
571
|
+
}
|
572
|
+
rows2.push(d$1);
|
573
|
+
}
|
574
574
|
}
|
575
575
|
|
576
576
|
for (i = 0; i < series.length; i++) {
|
@@ -580,7 +580,7 @@
|
|
580
580
|
var backgroundColor = chartType !== "line" ? addOpacity(color, 0.5) : color;
|
581
581
|
|
582
582
|
var dataset = {
|
583
|
-
label: s.name,
|
583
|
+
label: s.name || "",
|
584
584
|
data: rows2[i],
|
585
585
|
fill: chartType === "area",
|
586
586
|
borderColor: color,
|
@@ -590,10 +590,6 @@
|
|
590
590
|
pointHoverBackgroundColor: color
|
591
591
|
};
|
592
592
|
|
593
|
-
if (chartType === "scatter" || chartType === "bubble") {
|
594
|
-
dataset.showLine = false;
|
595
|
-
}
|
596
|
-
|
597
593
|
if (s.stack) {
|
598
594
|
dataset.stack = s.stack;
|
599
595
|
}
|
@@ -695,7 +691,12 @@
|
|
695
691
|
|
696
692
|
var data = createDataTable(chart, options, chartType || "line");
|
697
693
|
|
698
|
-
|
694
|
+
if (chart.xtype === "number") {
|
695
|
+
options.scales.xAxes[0].type = "linear";
|
696
|
+
options.scales.xAxes[0].position = "bottom";
|
697
|
+
} else {
|
698
|
+
options.scales.xAxes[0].type = chart.xtype === "string" ? "category" : "time";
|
699
|
+
}
|
699
700
|
|
700
701
|
this.drawChart(chart, "line", data, options);
|
701
702
|
};
|
@@ -768,6 +769,10 @@
|
|
768
769
|
var options = jsOptions(chart, chart.options);
|
769
770
|
setFormatOptions(chart, options, chartType);
|
770
771
|
|
772
|
+
if (!("showLines" in options)) {
|
773
|
+
options.showLines = false;
|
774
|
+
}
|
775
|
+
|
771
776
|
var data = createDataTable(chart, options, chartType);
|
772
777
|
|
773
778
|
options.scales.xAxes[0].type = "linear";
|
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: 3.0.
|
4
|
+
version: 3.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Kane
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-08-
|
11
|
+
date: 2018-08-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|