streamlinesocial / highcharts-regression

Linear and non-linear regression support for highcharts
MIT License
73 stars 64 forks source link

Loess equation expects data as a simple array #79

Closed borys-p closed 5 years ago

borys-p commented 6 years ago

It seems that the _loess() function assumes input data will always be a simple, two-values array. But Highcharts allows a much more detailed description of each point. For example I'm using a line chart with categories on the X-axis and each datapoint looks like that:

{ y: 123, name: "category name", someCustomAttribute: 42 }

and the regression module obviously fails when trying to read pair[0] and pair[1]. The solution here would require at least two steps:

  1. Treating the .data property as an array of Points that contain .x and .y properties
  2. Somehow dealing with categories in addition to time series
phpepe commented 6 years ago

That's correct. We have pending the support for non-integer x axis as you said, not only for loess, for all regression types. Will keep keep this ticket open as holder for different input data structure