@d3fc/d3fc-sample
Advanced tools
Comparing version 4.0.11 to 4.1.0
(function (global, factory) { | ||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('d3-array')) : | ||
typeof define === 'function' && define.amd ? define(['exports', 'd3-array'], factory) : | ||
(global = global || self, factory(global.fc = global.fc || {}, global.d3)); | ||
}(this, function (exports, d3Array) { 'use strict'; | ||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('d3-array'), require('@d3fc/d3fc-rebind')) : | ||
typeof define === 'function' && define.amd ? define(['exports', 'd3-array', '@d3fc/d3fc-rebind'], factory) : | ||
(global = global || self, factory(global.fc = global.fc || {}, global.d3, global.fc)); | ||
}(this, function (exports, d3Array, d3fcRebind) { 'use strict'; | ||
@@ -30,23 +30,2 @@ function bucket () { | ||
var createReboundMethod = ((target, source, name) => { | ||
const method = source[name]; | ||
if (typeof method !== 'function') { | ||
throw new Error(`Attempt to rebind ${name} which isn't a function on the source object`); | ||
} | ||
return (...args) => { | ||
var value = method.apply(source, args); | ||
return value === source ? target : value; | ||
}; | ||
}); | ||
var rebind = ((target, source, ...names) => { | ||
for (const name of names) { | ||
target[name] = createReboundMethod(target, source, name); | ||
} | ||
return target; | ||
}); | ||
function largestTriangleOneBucket () { | ||
@@ -94,3 +73,3 @@ var dataBucketer = bucket(); | ||
rebind(largestTriangleOneBucket, dataBucketer, 'bucketSize'); | ||
d3fcRebind.rebind(largestTriangleOneBucket, dataBucketer, 'bucketSize'); | ||
@@ -161,3 +140,3 @@ largestTriangleOneBucket.x = function (d) { | ||
rebind(largestTriangleThreeBucket, dataBucketer, 'bucketSize'); | ||
d3fcRebind.rebind(largestTriangleThreeBucket, dataBucketer, 'bucketSize'); | ||
@@ -241,3 +220,3 @@ largestTriangleThreeBucket.x = function (d) { | ||
rebind(modeMedian, dataBucketer, 'bucketSize'); | ||
d3fcRebind.rebind(modeMedian, dataBucketer, 'bucketSize'); | ||
@@ -244,0 +223,0 @@ modeMedian.value = function (x) { |
@@ -1,1 +0,1 @@ | ||
(function(a,b){"object"==typeof exports&&"undefined"!=typeof module?b(exports,require("d3-array")):"function"==typeof define&&define.amd?define(["exports","d3-array"],b):(a=a||self,b(a.fc=a.fc||{},a.d3))})(this,function(a,b){'use strict';var g=Math.abs;function c(){var a=10,c=function(c){var d=Math.ceil;return 1>=a?c.map(function(a){return[a]}):b.range(0,d(c.length/a)).map(function(b){return c.slice(b*a,(b+1)*a)})};return c.bucketSize=function(b){return arguments.length?(a=b,c):a},c}function d(){function a(a){var c=a.map(function(a){return[e(a),f(a)]}),d=b.range(1,c.length-1).map(function(a){var b=c[a-1],d=c[a],e=c[a+1];return .5*g((b[0]-e[0])*(d[1]-b[1])-(b[0]-d[0])*(e[1]-b[1]))});return d}var d=c(),e=function(a){return a},f=function(a){return a},h=function(c){if(d.bucketSize()>=c.length)return c;var e=a(c),f=d(e),g=d(c.slice(1,c.length-1)),h=g.map(function(a,c){var d=f[c],e=b.max(d),g=d.indexOf(e);return a[g]});return[].concat([c[0]],h,[c[c.length-1]])};return i(h,d,"bucketSize"),h.x=function(a){return arguments.length?(e=a,h):e},h.y=function(a){return arguments.length?(f=a,h):f},h}function e(){var a=function(a){return a},e=function(a){return a},d=c(),f=function(c){if(d.bucketSize()>=c.length)return c;var f=d(c.slice(1,c.length-1)),h=c[0],i=c[c.length-1],j=[].concat([h],f,[i]),k=a(h),l=e(h),m=f.map(function(c,d){var f=b.mean(j[d+1],a),h=b.mean(j[d+1],e),i=c.map(function(b){return[a(b),e(b)]}),m=i.map(function(a){return .5*g((k-f)*(a[1]-l)-(k-a[0])*(h-l))}),n=m.indexOf(b.max(m)),o=i[n];return k=o[0],l=o[1],c[n]});return[].concat([c[0]],m,[c[c.length-1]])};return i(f,d,"bucketSize"),f.x=function(b){return arguments.length?(a=b,f):a},f.y=function(a){return arguments.length?(e=a,f):e},f}function f(){var a=c(),d=function(a){return a},e=function(c){if(a.bucketSize()>c.length)return c;var e=b.extent(c,d),f=a(c.slice(1,c.length-1)),g=f.map(function(a){var c,f,b=Math.floor,g={},h=!0,i=a.map(d),j=i.filter(function(a){return a===e[0]||a===e[1]}).map(function(a){return i.indexOf(a)})[0];return void 0===j?(i.forEach(function(a,b){void 0===g[a]&&(g[a]=0),g[a]++,g[a]>g[c]||void 0===c?(c=a,f=b,h=!0):g[a]===g[c]&&(h=!1)}),h?a[f]:a[b(a.length/2)]):a[j]});return[].concat([c[0]],g,[c[c.length-1]])};return i(e,a,"bucketSize"),e.value=function(a){return arguments.length?(d=a,e):d},e}var h=(a,b,c)=>{const d=b[c];if("function"!=typeof d)throw new Error(`Attempt to rebind ${c} which isn't a function on the source object`);return(...c)=>{var e=d.apply(b,c);return e===b?a:e}},i=(a,b,...c)=>{for(const d of c)a[d]=h(a,b,d);return a};a.bucket=c,a.largestTriangleOneBucket=d,a.largestTriangleThreeBucket=e,a.modeMedian=f,Object.defineProperty(a,"__esModule",{value:!0})}); | ||
(function(a,b){"object"==typeof exports&&"undefined"!=typeof module?b(exports,require("d3-array"),require("@d3fc/d3fc-rebind")):"function"==typeof define&&define.amd?define(["exports","d3-array","@d3fc/d3fc-rebind"],b):(a=a||self,b(a.fc=a.fc||{},a.d3,a.fc))})(this,function(a,b,c){'use strict';var h=Math.abs;function d(){var a=10,c=function(c){var d=Math.ceil;return 1>=a?c.map(function(a){return[a]}):b.range(0,d(c.length/a)).map(function(b){return c.slice(b*a,(b+1)*a)})};return c.bucketSize=function(b){return arguments.length?(a=b,c):a},c}function e(){function a(a){var c=a.map(function(a){return[f(a),g(a)]}),d=b.range(1,c.length-1).map(function(a){var b=c[a-1],d=c[a],e=c[a+1];return .5*h((b[0]-e[0])*(d[1]-b[1])-(b[0]-d[0])*(e[1]-b[1]))});return d}var e=d(),f=function(a){return a},g=function(a){return a},i=function(c){if(e.bucketSize()>=c.length)return c;var d=a(c),f=e(d),g=e(c.slice(1,c.length-1)),h=g.map(function(a,c){var d=f[c],e=b.max(d),g=d.indexOf(e);return a[g]});return[].concat([c[0]],h,[c[c.length-1]])};return c.rebind(i,e,"bucketSize"),i.x=function(a){return arguments.length?(f=a,i):f},i.y=function(a){return arguments.length?(g=a,i):g},i}function f(){var a=function(a){return a},e=function(a){return a},f=d(),g=function(c){if(f.bucketSize()>=c.length)return c;var d=f(c.slice(1,c.length-1)),g=c[0],i=c[c.length-1],j=[].concat([g],d,[i]),k=a(g),l=e(g),m=d.map(function(c,d){var f=b.mean(j[d+1],a),g=b.mean(j[d+1],e),i=c.map(function(b){return[a(b),e(b)]}),m=i.map(function(a){return .5*h((k-f)*(a[1]-l)-(k-a[0])*(g-l))}),n=m.indexOf(b.max(m)),o=i[n];return k=o[0],l=o[1],c[n]});return[].concat([c[0]],m,[c[c.length-1]])};return c.rebind(g,f,"bucketSize"),g.x=function(b){return arguments.length?(a=b,g):a},g.y=function(a){return arguments.length?(e=a,g):e},g}function g(){var a=d(),e=function(a){return a},f=function(c){if(a.bucketSize()>c.length)return c;var d=b.extent(c,e),f=a(c.slice(1,c.length-1)),g=f.map(function(a){var c,f,b=Math.floor,g={},h=!0,i=a.map(e),j=i.filter(function(a){return a===d[0]||a===d[1]}).map(function(a){return i.indexOf(a)})[0];return void 0===j?(i.forEach(function(a,b){void 0===g[a]&&(g[a]=0),g[a]++,g[a]>g[c]||void 0===c?(c=a,f=b,h=!0):g[a]===g[c]&&(h=!1)}),h?a[f]:a[b(a.length/2)]):a[j]});return[].concat([c[0]],g,[c[c.length-1]])};return c.rebind(f,a,"bucketSize"),f.value=function(a){return arguments.length?(e=a,f):e},f}a.bucket=d,a.largestTriangleOneBucket=e,a.largestTriangleThreeBucket=f,a.modeMedian=g,Object.defineProperty(a,"__esModule",{value:!0})}); |
@@ -6,2 +6,13 @@ # Change Log | ||
# 4.1.0 (2020-03-19) | ||
### Features | ||
* add fill to webgl boxplot ([7ea7859](https://github.com/d3fc/d3fc/commit/7ea7859)) | ||
## [4.0.11](https://github.com/d3fc/d3fc/compare/@d3fc/d3fc-sample@4.0.10...@d3fc/d3fc-sample@4.0.11) (2019-11-28) | ||
@@ -8,0 +19,0 @@ |
{ | ||
"name": "@d3fc/d3fc-sample", | ||
"version": "4.0.11", | ||
"version": "4.1.0", | ||
"description": "A data subsampler that chooses representative data points using a largest triangle or mode-median approach.", | ||
@@ -39,3 +39,3 @@ "license": "MIT", | ||
}, | ||
"gitHead": "de82a1a109ddce4b5721fc4e0d2039ddd497817d" | ||
"gitHead": "8a27597494353a1441a1a71ca06707d9e28c4381" | ||
} |
265037
1119