chartkick 4.1.2 → 4.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +15 -0
- data/README.md +84 -59
- data/lib/chartkick/engine.rb +2 -2
- data/lib/chartkick/version.rb +1 -1
- data/licenses/LICENSE-chart.js.txt +1 -1
- data/vendor/assets/javascripts/Chart.bundle.js +19532 -17718
- data/vendor/assets/javascripts/chartkick.js +39 -34
- metadata +3 -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
|
-
* v4.
|
5
|
+
* v4.2.0
|
6
6
|
* MIT License
|
7
7
|
*/
|
8
8
|
|
@@ -10,7 +10,7 @@
|
|
10
10
|
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
|
11
11
|
typeof define === 'function' && define.amd ? define(factory) :
|
12
12
|
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Chartkick = factory());
|
13
|
-
}(this, (function () { 'use strict';
|
13
|
+
})(this, (function () { 'use strict';
|
14
14
|
|
15
15
|
function isArray(variable) {
|
16
16
|
return Object.prototype.toString.call(variable) === "[object Array]";
|
@@ -1101,7 +1101,8 @@
|
|
1101
1101
|
zeros: chart.options.zeros
|
1102
1102
|
};
|
1103
1103
|
|
1104
|
-
|
1104
|
+
// skip when axis is an array (like with min/max)
|
1105
|
+
if (chartType !== "pie" && !isArray(options.yAxis) && !options.yAxis.labels.formatter) {
|
1105
1106
|
options.yAxis.labels.formatter = function () {
|
1106
1107
|
return formatValue("", this.value, formatOptions);
|
1107
1108
|
};
|
@@ -1401,7 +1402,7 @@
|
|
1401
1402
|
};
|
1402
1403
|
|
1403
1404
|
defaultExport.prototype.renderLineChart = function renderLineChart (chart) {
|
1404
|
-
var this$1 = this;
|
1405
|
+
var this$1$1 = this;
|
1405
1406
|
|
1406
1407
|
this.waitForLoaded(chart, function () {
|
1407
1408
|
var chartOptions = {};
|
@@ -1415,14 +1416,14 @@
|
|
1415
1416
|
}
|
1416
1417
|
|
1417
1418
|
var options = jsOptions(chart, chart.options, chartOptions);
|
1418
|
-
var data = this$1.createDataTable(chart.data, chart.xtype);
|
1419
|
+
var data = this$1$1.createDataTable(chart.data, chart.xtype);
|
1419
1420
|
|
1420
|
-
this$1.drawChart(chart, "LineChart", data, options);
|
1421
|
+
this$1$1.drawChart(chart, "LineChart", data, options);
|
1421
1422
|
});
|
1422
1423
|
};
|
1423
1424
|
|
1424
1425
|
defaultExport.prototype.renderPieChart = function renderPieChart (chart) {
|
1425
|
-
var this$1 = this;
|
1426
|
+
var this$1$1 = this;
|
1426
1427
|
|
1427
1428
|
this.waitForLoaded(chart, function () {
|
1428
1429
|
var chartOptions = {
|
@@ -1446,28 +1447,28 @@
|
|
1446
1447
|
}
|
1447
1448
|
var options = merge(merge(defaultOptions, chartOptions), chart.options.library || {});
|
1448
1449
|
|
1449
|
-
var data = new this$1.library.visualization.DataTable();
|
1450
|
+
var data = new this$1$1.library.visualization.DataTable();
|
1450
1451
|
data.addColumn("string", "");
|
1451
1452
|
data.addColumn("number", "Value");
|
1452
1453
|
data.addRows(chart.data);
|
1453
1454
|
|
1454
|
-
this$1.drawChart(chart, "PieChart", data, options);
|
1455
|
+
this$1$1.drawChart(chart, "PieChart", data, options);
|
1455
1456
|
});
|
1456
1457
|
};
|
1457
1458
|
|
1458
1459
|
defaultExport.prototype.renderColumnChart = function renderColumnChart (chart) {
|
1459
|
-
var this$1 = this;
|
1460
|
+
var this$1$1 = this;
|
1460
1461
|
|
1461
1462
|
this.waitForLoaded(chart, function () {
|
1462
1463
|
var options = jsOptions(chart, chart.options);
|
1463
|
-
var data = this$1.createDataTable(chart.data, chart.xtype);
|
1464
|
+
var data = this$1$1.createDataTable(chart.data, chart.xtype);
|
1464
1465
|
|
1465
|
-
this$1.drawChart(chart, "ColumnChart", data, options);
|
1466
|
+
this$1$1.drawChart(chart, "ColumnChart", data, options);
|
1466
1467
|
});
|
1467
1468
|
};
|
1468
1469
|
|
1469
1470
|
defaultExport.prototype.renderBarChart = function renderBarChart (chart) {
|
1470
|
-
var this$1 = this;
|
1471
|
+
var this$1$1 = this;
|
1471
1472
|
|
1472
1473
|
this.waitForLoaded(chart, function () {
|
1473
1474
|
var chartOptions = {
|
@@ -1478,14 +1479,14 @@
|
|
1478
1479
|
}
|
1479
1480
|
};
|
1480
1481
|
var options = jsOptionsFunc(defaultOptions, hideLegend, setTitle, setBarMin, setBarMax, setStacked, setXtitle, setYtitle)(chart, chart.options, chartOptions);
|
1481
|
-
var data = this$1.createDataTable(chart.data, chart.xtype);
|
1482
|
+
var data = this$1$1.createDataTable(chart.data, chart.xtype);
|
1482
1483
|
|
1483
|
-
this$1.drawChart(chart, "BarChart", data, options);
|
1484
|
+
this$1$1.drawChart(chart, "BarChart", data, options);
|
1484
1485
|
});
|
1485
1486
|
};
|
1486
1487
|
|
1487
1488
|
defaultExport.prototype.renderAreaChart = function renderAreaChart (chart) {
|
1488
|
-
var this$1 = this;
|
1489
|
+
var this$1$1 = this;
|
1489
1490
|
|
1490
1491
|
this.waitForLoaded(chart, function () {
|
1491
1492
|
var chartOptions = {
|
@@ -1495,14 +1496,14 @@
|
|
1495
1496
|
};
|
1496
1497
|
|
1497
1498
|
var options = jsOptions(chart, chart.options, chartOptions);
|
1498
|
-
var data = this$1.createDataTable(chart.data, chart.xtype);
|
1499
|
+
var data = this$1$1.createDataTable(chart.data, chart.xtype);
|
1499
1500
|
|
1500
|
-
this$1.drawChart(chart, "AreaChart", data, options);
|
1501
|
+
this$1$1.drawChart(chart, "AreaChart", data, options);
|
1501
1502
|
});
|
1502
1503
|
};
|
1503
1504
|
|
1504
1505
|
defaultExport.prototype.renderGeoChart = function renderGeoChart (chart) {
|
1505
|
-
var this$1 = this;
|
1506
|
+
var this$1$1 = this;
|
1506
1507
|
|
1507
1508
|
this.waitForLoaded(chart, "geochart", function () {
|
1508
1509
|
var chartOptions = {
|
@@ -1513,17 +1514,17 @@
|
|
1513
1514
|
};
|
1514
1515
|
var options = merge(merge(defaultOptions, chartOptions), chart.options.library || {});
|
1515
1516
|
|
1516
|
-
var data = new this$1.library.visualization.DataTable();
|
1517
|
+
var data = new this$1$1.library.visualization.DataTable();
|
1517
1518
|
data.addColumn("string", "");
|
1518
1519
|
data.addColumn("number", chart.options.label || "Value");
|
1519
1520
|
data.addRows(chart.data);
|
1520
1521
|
|
1521
|
-
this$1.drawChart(chart, "GeoChart", data, options);
|
1522
|
+
this$1$1.drawChart(chart, "GeoChart", data, options);
|
1522
1523
|
});
|
1523
1524
|
};
|
1524
1525
|
|
1525
1526
|
defaultExport.prototype.renderScatterChart = function renderScatterChart (chart) {
|
1526
|
-
var this$1 = this;
|
1527
|
+
var this$1$1 = this;
|
1527
1528
|
|
1528
1529
|
this.waitForLoaded(chart, function () {
|
1529
1530
|
var chartOptions = {};
|
@@ -1541,19 +1542,19 @@
|
|
1541
1542
|
}
|
1542
1543
|
}
|
1543
1544
|
|
1544
|
-
data = new this$1.library.visualization.DataTable();
|
1545
|
+
data = new this$1$1.library.visualization.DataTable();
|
1545
1546
|
data.addColumn("number", "");
|
1546
1547
|
for (i = 0; i < series.length; i++) {
|
1547
1548
|
data.addColumn("number", series[i].name);
|
1548
1549
|
}
|
1549
1550
|
data.addRows(rows2);
|
1550
1551
|
|
1551
|
-
this$1.drawChart(chart, "ScatterChart", data, options);
|
1552
|
+
this$1$1.drawChart(chart, "ScatterChart", data, options);
|
1552
1553
|
});
|
1553
1554
|
};
|
1554
1555
|
|
1555
1556
|
defaultExport.prototype.renderTimeline = function renderTimeline (chart) {
|
1556
|
-
var this$1 = this;
|
1557
|
+
var this$1$1 = this;
|
1557
1558
|
|
1558
1559
|
this.waitForLoaded(chart, "timeline", function () {
|
1559
1560
|
var chartOptions = {
|
@@ -1565,7 +1566,7 @@
|
|
1565
1566
|
}
|
1566
1567
|
var options = merge(merge(defaultOptions, chartOptions), chart.options.library || {});
|
1567
1568
|
|
1568
|
-
var data = new this$1.library.visualization.DataTable();
|
1569
|
+
var data = new this$1$1.library.visualization.DataTable();
|
1569
1570
|
data.addColumn({type: "string", id: "Name"});
|
1570
1571
|
data.addColumn({type: "date", id: "Start"});
|
1571
1572
|
data.addColumn({type: "date", id: "End"});
|
@@ -1573,7 +1574,7 @@
|
|
1573
1574
|
|
1574
1575
|
chart.element.style.lineHeight = "normal";
|
1575
1576
|
|
1576
|
-
this$1.drawChart(chart, "Timeline", data, options);
|
1577
|
+
this$1$1.drawChart(chart, "Timeline", data, options);
|
1577
1578
|
});
|
1578
1579
|
};
|
1579
1580
|
|
@@ -1599,7 +1600,7 @@
|
|
1599
1600
|
};
|
1600
1601
|
|
1601
1602
|
defaultExport.prototype.waitForLoaded = function waitForLoaded (chart, pack, callback) {
|
1602
|
-
var this$1 = this;
|
1603
|
+
var this$1$1 = this;
|
1603
1604
|
|
1604
1605
|
if (!callback) {
|
1605
1606
|
callback = pack;
|
@@ -1616,7 +1617,7 @@
|
|
1616
1617
|
// https://groups.google.com/forum/#!topic/google-visualization-api/fMKJcyA2yyI
|
1617
1618
|
var loadOptions = {
|
1618
1619
|
packages: [pack],
|
1619
|
-
callback: function () { this$1.runCallbacks(); }
|
1620
|
+
callback: function () { this$1$1.runCallbacks(); }
|
1620
1621
|
};
|
1621
1622
|
var config = chart.__config();
|
1622
1623
|
if (config.language) {
|
@@ -2173,7 +2174,7 @@
|
|
2173
2174
|
};
|
2174
2175
|
|
2175
2176
|
Chart.prototype.startRefresh = function startRefresh () {
|
2176
|
-
var this$1 = this;
|
2177
|
+
var this$1$1 = this;
|
2177
2178
|
|
2178
2179
|
var refresh = this.options.refresh;
|
2179
2180
|
|
@@ -2184,7 +2185,7 @@
|
|
2184
2185
|
if (!this.intervalId) {
|
2185
2186
|
if (refresh) {
|
2186
2187
|
this.intervalId = setInterval( function () {
|
2187
|
-
this$1.refreshData();
|
2188
|
+
this$1$1.refreshData();
|
2188
2189
|
}, refresh * 1000);
|
2189
2190
|
} else {
|
2190
2191
|
throw new Error("No refresh interval");
|
@@ -2493,10 +2494,14 @@
|
|
2493
2494
|
|
2494
2495
|
// clean up previous charts before Turbolinks loads new page
|
2495
2496
|
document.addEventListener("turbolinks:before-render", function() {
|
2496
|
-
|
2497
|
+
if (config.autoDestroy !== false) {
|
2498
|
+
Chartkick.destroyAll();
|
2499
|
+
}
|
2497
2500
|
});
|
2498
2501
|
document.addEventListener("turbo:before-render", function() {
|
2499
|
-
|
2502
|
+
if (config.autoDestroy !== false) {
|
2503
|
+
Chartkick.destroyAll();
|
2504
|
+
}
|
2500
2505
|
});
|
2501
2506
|
|
2502
2507
|
// use setTimeout so charting library can come later in same JS file
|
@@ -2510,4 +2515,4 @@
|
|
2510
2515
|
|
2511
2516
|
return Chartkick;
|
2512
2517
|
|
2513
|
-
}))
|
2518
|
+
}));
|
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: 4.1
|
4
|
+
version: 4.2.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:
|
11
|
+
date: 2022-08-02 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description:
|
14
14
|
email: andrew@ankane.org
|
@@ -50,7 +50,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
50
50
|
- !ruby/object:Gem::Version
|
51
51
|
version: '0'
|
52
52
|
requirements: []
|
53
|
-
rubygems_version: 3.
|
53
|
+
rubygems_version: 3.3.7
|
54
54
|
signing_key:
|
55
55
|
specification_version: 4
|
56
56
|
summary: Create beautiful JavaScript charts with one line of Ruby
|