chartkick 4.0.4 → 4.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -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.0.5
6
6
  * MIT License
7
7
  */
8
8
 
@@ -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
  }
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.0.5
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-07-07 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description:
14
14
  email: andrew@ankane.org