chartkick 4.0.4 → 4.1.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -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.0.4
5
+ * v4.1.1
6
6
  * MIT License
7
7
  */
8
8
 
@@ -748,17 +748,17 @@
748
748
 
749
749
  if (chart.xtype === "datetime") {
750
750
  if (notnull(xmin)) {
751
- options.scales.x.ticks.min = toDate(xmin).getTime();
751
+ options.scales.x.min = toDate(xmin).getTime();
752
752
  }
753
753
  if (notnull(xmax)) {
754
- options.scales.x.ticks.max = toDate(xmax).getTime();
754
+ options.scales.x.max = toDate(xmax).getTime();
755
755
  }
756
756
  } else if (chart.xtype === "number") {
757
757
  if (notnull(xmin)) {
758
- options.scales.x.ticks.min = xmin;
758
+ options.scales.x.min = xmin;
759
759
  }
760
760
  if (notnull(xmax)) {
761
- options.scales.x.ticks.max = xmax;
761
+ options.scales.x.max = xmax;
762
762
  }
763
763
  }
764
764
 
@@ -865,8 +865,8 @@
865
865
  var data = createDataTable(chart, options, chartType || "line");
866
866
 
867
867
  if (chart.xtype === "number") {
868
- options.scales.x.type = "linear";
869
- options.scales.x.position = "bottom";
868
+ options.scales.x.type = options.scales.x.type || "linear";
869
+ options.scales.x.position = options.scales.x.position ||"bottom";
870
870
  } else {
871
871
  options.scales.x.type = chart.xtype === "string" ? "category" : "time";
872
872
  }
@@ -956,8 +956,8 @@
956
956
 
957
957
  var data = createDataTable(chart, options, chartType);
958
958
 
959
- options.scales.x.type = "linear";
960
- options.scales.x.position = "bottom";
959
+ options.scales.x.type = options.scales.x.type || "linear";
960
+ options.scales.x.position = options.scales.x.position || "bottom";
961
961
 
962
962
  // prevent grouping hover and tooltips
963
963
  if (!("mode" in options.interaction)) {
@@ -1107,7 +1107,7 @@
1107
1107
  };
1108
1108
  }
1109
1109
 
1110
- if (!options.tooltip.pointFormatter) {
1110
+ if (!options.tooltip.pointFormatter && !options.tooltip.pointFormat) {
1111
1111
  options.tooltip.pointFormatter = function () {
1112
1112
  return '<span style="color:' + this.color + '">\u25CF</span> ' + formatValue(this.series.name + ': <b>', this.y, formatOptions) + '</b><br/>';
1113
1113
  };
@@ -1149,7 +1149,11 @@
1149
1149
  }
1150
1150
 
1151
1151
  var options = jsOptions$1(chart, chart.options, chartOptions), data, i, j;
1152
- options.xAxis.type = chart.xtype === "string" ? "category" : (chart.xtype === "number" ? "linear" : "datetime");
1152
+ if (chart.xtype === "number") {
1153
+ options.xAxis.type = options.xAxis.type || "linear";
1154
+ } else {
1155
+ options.xAxis.type = chart.xtype === "string" ? "category" : "datetime";
1156
+ }
1153
1157
  if (!options.chart.type) {
1154
1158
  options.chart.type = chartType;
1155
1159
  }
@@ -2491,6 +2495,9 @@
2491
2495
  document.addEventListener("turbolinks:before-render", function() {
2492
2496
  Chartkick.destroyAll();
2493
2497
  });
2498
+ document.addEventListener("turbo:before-render", function() {
2499
+ Chartkick.destroyAll();
2500
+ });
2494
2501
 
2495
2502
  // use setTimeout so charting library can come later in same JS file
2496
2503
  setTimeout(function() {
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.0.4
4
+ version: 4.1.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: 2021-05-01 00:00:00.000000000 Z
11
+ date: 2021-11-06 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.2.3
53
+ rubygems_version: 3.2.22
54
54
  signing_key:
55
55
  specification_version: 4
56
56
  summary: Create beautiful JavaScript charts with one line of Ruby