Skip to content

Commit

Permalink
Merge pull request #90 from tillsc/master
Browse files Browse the repository at this point in the history
Fix loess calclulation for non array data
  • Loading branch information
phpepe authored Feb 27, 2019
2 parents 26bccd5 + a8778da commit b84143a
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions highcharts-regression.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
(function(factory) {
(function(factory) {
"use strict";

if (typeof module === "object" && module.exports) {
module.exports = factory;
} else {
Expand All @@ -17,7 +17,7 @@
void 0;
}
}
}
}
}(function (H) {
var processSerie = function (s, method, chart) {
if (s.regression && !s.rendered) {
Expand Down Expand Up @@ -455,7 +455,7 @@
bandwidth = bandwidth || 0.25;

var xval = data.map(function (pair) {
return pair[0];
return pair.x || pair[0];
});
var distinctX = array_unique(xval);
if (2 / distinctX.length > bandwidth) {
Expand All @@ -464,7 +464,7 @@
}

var yval = data.map(function (pair) {
return pair[1];
return pair.y || pair[1];
});

function array_unique(values) {
Expand Down

0 comments on commit b84143a

Please sign in to comment.