Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

vega-scale

Package Overview
Dependencies
Maintainers
1
Versions
38
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vega-scale - npm Package Compare versions

Comparing version 2.0.1 to 2.0.2

8

build/vega-scale.js

@@ -573,5 +573,7 @@ (function (global, factory) {

function scaleFraction(scale, min, max) {
return scale.type === 'linear' || scale.type === 'sequential'
? function(_$$1) { return (_$$1 - min) / (max - min); }
: scale.copy().domain([min, max]).range([0, 1]).interpolate(lerp);
var delta = max - min;
return !delta ? vegaUtil.constant(0)
: scale.type === 'linear' || scale.type === 'sequential'
? function(_$$1) { return (_$$1 - min) / delta; }
: scale.copy().domain([min, max]).range([0, 1]).interpolate(lerp);
}

@@ -578,0 +580,0 @@

@@ -1,1 +0,1 @@

!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("d3-array"),require("d3-scale"),require("vega-util"),require("d3-scale-chromatic"),require("d3-interpolate")):"function"==typeof define&&define.amd?define(["exports","d3-array","d3-scale","vega-util","d3-scale-chromatic","d3-interpolate"],n):n(e.vega=e.vega||{},e.d3,e.d3,e.vega,e.d3,e.d3)}(this,function(e,n,r,t,a,i){"use strict";function u(){function e(){var e=o().length,r=l[1]<l[0],i=l[r-0],u=l[1-r],p=R(e,d,g);t=(u-i)/(p||1),f&&(t=Math.floor(t)),i+=(u-i-t*(e-d))*s,a=t*(1-d),f&&(i=Math.round(i),a=Math.round(a));var b=n.range(e).map(function(e){return i+t*e});return c(r?b.reverse():b)}var t,a,i=r.scaleOrdinal().unknown(void 0),o=i.domain,c=i.range,l=[0,1],f=!1,d=0,g=0,s=.5;return delete i.unknown,i.domain=function(n){return arguments.length?(o(n),e()):o()},i.range=function(n){return arguments.length?(l=[+n[0],+n[1]],e()):l.slice()},i.rangeRound=function(n){return l=[+n[0],+n[1]],f=!0,e()},i.bandwidth=function(){return a},i.step=function(){return t},i.round=function(n){return arguments.length?(f=!!n,e()):f},i.padding=function(n){return arguments.length?(g=Math.max(0,Math.min(1,n)),d=g,e()):d},i.paddingInner=function(n){return arguments.length?(d=Math.max(0,Math.min(1,n)),e()):d},i.paddingOuter=function(n){return arguments.length?(g=Math.max(0,Math.min(1,n)),e()):g},i.align=function(n){return arguments.length?(s=Math.max(0,Math.min(1,n)),e()):s},i.invertRange=function(e){if(null!=e[0]&&null!=e[1]){var r,t,i,u=+e[0],f=+e[1],d=l[1]<l[0],g=d?c().reverse():c(),s=g.length-1;if(u===u&&f===f&&(f<u&&(i=u,u=f,f=i),!(f<g[0]||u>l[1-d])))return r=Math.max(0,n.bisectRight(g,u)-1),t=u===f?r:n.bisectRight(g,f)-1,u-g[r]>a+1e-10&&++r,d&&(i=r,r=s-t,t=s-i),r>t?void 0:o().slice(r,t+1)}},i.invert=function(e){var n=i.invertRange([e,e]);return n?n[0]:n},i.copy=function(){return u().domain(o()).range(l).round(f).paddingInner(d).paddingOuter(g).align(s)},e()}function o(e){var n=e.copy;return e.padding=e.paddingOuter,delete e.paddingInner,e.copy=function(){return o(n())},e}function c(e){return w.call(e,function(e){return+e})}function l(){function e(e){return a(e)}function n(e){i=c(e),a.domain([i[0],t.peek(i)])}var a=r.scaleLinear(),i=[];return e.domain=function(r){return arguments.length?(n(r),e):i.slice()},e.range=function(n){return arguments.length?(a.range(n),e):a.range()},e.rangeRound=function(n){return arguments.length?(a.rangeRound(n),e):a.rangeRound()},e.interpolate=function(n){return arguments.length?(a.interpolate(n),e):a.interpolate()},e.invert=function(e){return a.invert(e)},e.ticks=function(n){var r=i.length,t=~~(r/(n||r));return t<2?e.domain():i.filter(function(e,n){return!(n%t)})},e.tickFormat=function(){return a.tickFormat.apply(a,arguments)},e.copy=function(){return l().domain(e.domain()).range(e.range())},e}function f(){function e(e){return null==e||e!==e?void 0:t[(n.bisect(r,e)-1)%t.length]}var r=[],t=[];return e.domain=function(n){return arguments.length?(r=c(n),e):r.slice()},e.range=function(n){return arguments.length?(t=P.call(n),e):t.slice()},e.copy=function(){return f().domain(e.domain()).range(e.range())},e}function d(e){function n(){var e=i.domain();u=e[0],o=t.peek(e)-u}function a(n){var r=(n-u)/o;return e(c?Math.max(0,Math.min(1,r)):r)}var i=r.scaleLinear(),u=0,o=1,c=!1;return a.clamp=function(e){return arguments.length?(c=!!e,a):c},a.domain=function(e){return arguments.length?(i.domain(e),n(),a):i.domain()},a.interpolator=function(n){return arguments.length?(e=n,a):e},a.copy=function(){return d().domain(i.domain()).clamp(c).interpolator(e)},a.ticks=function(e){return i.ticks(e)},a.tickFormat=function(e,n){return i.tickFormat(e,n)},a.nice=function(e){return i.nice(e),n(),a},a}function g(e,n){return function(){var r=n();return r.invertRange||(r.invertRange=r.invert?v(r):r.invertExtent?y(r):void 0),r.type=e,r}}function s(e,n){return arguments.length>1?(k[e]=g(e,n),this):k.hasOwnProperty(e)?k[e]:void 0}function p(e){for(var n=e.length/6|0,r=new Array(n),t=0;t<n;)r[t]="#"+e.slice(6*t,6*++t);return r}function b(e,n){q[e]=a["interpolate"+n],G[e]=a["scheme"+n]}function m(e,n){var r=n-e;return function(n){return e+n*r}}function h(e){return"interpolate"+e.toLowerCase().split("-").map(function(e){return e[0].toUpperCase()+e.slice(1)}).join("")}var v=function(e){return function(n){var r,t=n[0],a=n[1];return a<t&&(r=t,t=a,a=r),[e.invert(t),e.invert(a)]}},y=function(e){return function(n){var r,t,a,i,u=e.range(),o=n[0],c=n[1],l=-1;for(c<o&&(t=o,o=c,c=t),a=0,i=u.length;a<i;++a)u[a]>=o&&u[a]<=c&&(l<0&&(l=a),r=a);if(!(l<0))return o=e.invertExtent(u[l]),c=e.invertExtent(u[r]),[void 0===o[0]?o[1]:o[0],void 0===c[1]?c[0]:c[1]]}},R=function(e,n,r){var t=e-n+2*r;return e?t>0?t:1:0},w=Array.prototype.map,P=Array.prototype.slice,k={identity:r.scaleIdentity,linear:r.scaleLinear,log:r.scaleLog,ordinal:r.scaleOrdinal,pow:r.scalePow,sqrt:r.scaleSqrt,quantile:r.scaleQuantile,quantize:r.scaleQuantize,threshold:r.scaleThreshold,time:r.scaleTime,utc:r.scaleUtc,band:u,point:function(){return o(u().paddingInner(1))},sequential:d,"bin-linear":l,"bin-ordinal":f};for(var M in k)s(M,k[M]);var O=p("4c78a8f58518e4575672b7b254a24beeca3bb279a2ff9da69d755dbab0ac"),B=p("4c78a89ecae9f58518ffbf7954a24b88d27ab79a20f2cf5b43989483bcb6e45756ff9d9879706ebab0acd67195fcbfd2b279a2d6a5c99e765fd8b5a5"),x=new Array(3).concat("67a9cff7f7f7f1a340","0571b092c5defdb863e66101","0571b092c5def7f7f7fdb863e66101","2166ac67a9cfd1e5f0fee0b6f1a340b35806","2166ac67a9cfd1e5f0f7f7f7fee0b6f1a340b35806","2166ac4393c392c5ded1e5f0fee0b6fdb863e08214b35806","2166ac4393c392c5ded1e5f0f7f7f7fee0b6fdb863e08214b35806","0530612166ac4393c392c5ded1e5f0fee0b6fdb863e08214b358067f3b08","0530612166ac4393c392c5ded1e5f0f7f7f7fee0b6fdb863e08214b358067f3b08").map(p),G={blueorange:x},q={category10:r.schemeCategory10,category20:r.schemeCategory20,category20b:r.schemeCategory20b,category20c:r.schemeCategory20c,accent:a.schemeAccent,dark2:a.schemeDark2,paired:a.schemePaired,pastel1:a.schemePastel1,pastel2:a.schemePastel2,set1:a.schemeSet1,set2:a.schemeSet2,set3:a.schemeSet3,tableau10:O,tableau20:B,viridis:r.interpolateViridis,magma:r.interpolateMagma,inferno:r.interpolateInferno,plasma:r.interpolatePlasma,blueorange:i.interpolateRgbBasis(t.peek(x))};b("blues","Blues"),b("greens","Greens"),b("greys","Greys"),b("purples","Purples"),b("reds","Reds"),b("oranges","Oranges"),b("brownbluegreen","BrBG"),b("purplegreen","PRGn"),b("pinkyellowgreen","PiYG"),b("purpleorange","PuOr"),b("redblue","RdBu"),b("redgrey","RdGy"),b("redyellowblue","RdYlBu"),b("redyellowgreen","RdYlGn"),b("spectral","Spectral"),b("bluegreen","BuGn"),b("bluepurple","BuPu"),b("greenblue","GnBu"),b("orangered","OrRd"),b("purplebluegreen","PuBuGn"),b("purpleblue","PuBu"),b("purplered","PuRd"),b("redpurple","RdPu"),b("yellowgreenblue","YlGnBu"),b("yellowgreen","YlGn"),b("yelloworangebrown","YlOrBr"),b("yelloworangered","YlOrRd");e.scale=s,e.scheme=function(e,n){if(arguments.length>1)return q[e]=n,this;var r=e.split("-");return e=r[0],(r=+r[1]+1)&&G.hasOwnProperty(e)?G[e][r-1]:!r&&q.hasOwnProperty(e)?q[e]:void 0},e.bandSpace=R,e.interpolate=function(e,n){var r=i[h(e)];return null!=n&&r&&r.gamma?r.gamma(n):r},e.interpolateRange=function(e,n){var r=n[0],a=t.peek(n)-r;return function(n){return e(r+n*a)}},e.scaleFraction=function(e,n,r){return"linear"===e.type||"sequential"===e.type?function(e){return(e-n)/(r-n)}:e.copy().domain([n,r]).range([0,1]).interpolate(m)},Object.defineProperty(e,"__esModule",{value:!0})});
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("d3-array"),require("d3-scale"),require("vega-util"),require("d3-scale-chromatic"),require("d3-interpolate")):"function"==typeof define&&define.amd?define(["exports","d3-array","d3-scale","vega-util","d3-scale-chromatic","d3-interpolate"],n):n(e.vega=e.vega||{},e.d3,e.d3,e.vega,e.d3,e.d3)}(this,function(e,n,r,t,a,i){"use strict";function u(){function e(){var e=o().length,r=l[1]<l[0],i=l[r-0],u=l[1-r],p=R(e,d,g);t=(u-i)/(p||1),f&&(t=Math.floor(t)),i+=(u-i-t*(e-d))*s,a=t*(1-d),f&&(i=Math.round(i),a=Math.round(a));var b=n.range(e).map(function(e){return i+t*e});return c(r?b.reverse():b)}var t,a,i=r.scaleOrdinal().unknown(void 0),o=i.domain,c=i.range,l=[0,1],f=!1,d=0,g=0,s=.5;return delete i.unknown,i.domain=function(n){return arguments.length?(o(n),e()):o()},i.range=function(n){return arguments.length?(l=[+n[0],+n[1]],e()):l.slice()},i.rangeRound=function(n){return l=[+n[0],+n[1]],f=!0,e()},i.bandwidth=function(){return a},i.step=function(){return t},i.round=function(n){return arguments.length?(f=!!n,e()):f},i.padding=function(n){return arguments.length?(g=Math.max(0,Math.min(1,n)),d=g,e()):d},i.paddingInner=function(n){return arguments.length?(d=Math.max(0,Math.min(1,n)),e()):d},i.paddingOuter=function(n){return arguments.length?(g=Math.max(0,Math.min(1,n)),e()):g},i.align=function(n){return arguments.length?(s=Math.max(0,Math.min(1,n)),e()):s},i.invertRange=function(e){if(null!=e[0]&&null!=e[1]){var r,t,i,u=+e[0],f=+e[1],d=l[1]<l[0],g=d?c().reverse():c(),s=g.length-1;if(u===u&&f===f&&(f<u&&(i=u,u=f,f=i),!(f<g[0]||u>l[1-d])))return r=Math.max(0,n.bisectRight(g,u)-1),t=u===f?r:n.bisectRight(g,f)-1,u-g[r]>a+1e-10&&++r,d&&(i=r,r=s-t,t=s-i),r>t?void 0:o().slice(r,t+1)}},i.invert=function(e){var n=i.invertRange([e,e]);return n?n[0]:n},i.copy=function(){return u().domain(o()).range(l).round(f).paddingInner(d).paddingOuter(g).align(s)},e()}function o(e){var n=e.copy;return e.padding=e.paddingOuter,delete e.paddingInner,e.copy=function(){return o(n())},e}function c(e){return w.call(e,function(e){return+e})}function l(){function e(e){return a(e)}function n(e){i=c(e),a.domain([i[0],t.peek(i)])}var a=r.scaleLinear(),i=[];return e.domain=function(r){return arguments.length?(n(r),e):i.slice()},e.range=function(n){return arguments.length?(a.range(n),e):a.range()},e.rangeRound=function(n){return arguments.length?(a.rangeRound(n),e):a.rangeRound()},e.interpolate=function(n){return arguments.length?(a.interpolate(n),e):a.interpolate()},e.invert=function(e){return a.invert(e)},e.ticks=function(n){var r=i.length,t=~~(r/(n||r));return t<2?e.domain():i.filter(function(e,n){return!(n%t)})},e.tickFormat=function(){return a.tickFormat.apply(a,arguments)},e.copy=function(){return l().domain(e.domain()).range(e.range())},e}function f(){function e(e){return null==e||e!==e?void 0:t[(n.bisect(r,e)-1)%t.length]}var r=[],t=[];return e.domain=function(n){return arguments.length?(r=c(n),e):r.slice()},e.range=function(n){return arguments.length?(t=P.call(n),e):t.slice()},e.copy=function(){return f().domain(e.domain()).range(e.range())},e}function d(e){function n(){var e=i.domain();u=e[0],o=t.peek(e)-u}function a(n){var r=(n-u)/o;return e(c?Math.max(0,Math.min(1,r)):r)}var i=r.scaleLinear(),u=0,o=1,c=!1;return a.clamp=function(e){return arguments.length?(c=!!e,a):c},a.domain=function(e){return arguments.length?(i.domain(e),n(),a):i.domain()},a.interpolator=function(n){return arguments.length?(e=n,a):e},a.copy=function(){return d().domain(i.domain()).clamp(c).interpolator(e)},a.ticks=function(e){return i.ticks(e)},a.tickFormat=function(e,n){return i.tickFormat(e,n)},a.nice=function(e){return i.nice(e),n(),a},a}function g(e,n){return function(){var r=n();return r.invertRange||(r.invertRange=r.invert?v(r):r.invertExtent?y(r):void 0),r.type=e,r}}function s(e,n){return arguments.length>1?(k[e]=g(e,n),this):k.hasOwnProperty(e)?k[e]:void 0}function p(e){for(var n=e.length/6|0,r=new Array(n),t=0;t<n;)r[t]="#"+e.slice(6*t,6*++t);return r}function b(e,n){q[e]=a["interpolate"+n],G[e]=a["scheme"+n]}function m(e,n){var r=n-e;return function(n){return e+n*r}}function h(e){return"interpolate"+e.toLowerCase().split("-").map(function(e){return e[0].toUpperCase()+e.slice(1)}).join("")}var v=function(e){return function(n){var r,t=n[0],a=n[1];return a<t&&(r=t,t=a,a=r),[e.invert(t),e.invert(a)]}},y=function(e){return function(n){var r,t,a,i,u=e.range(),o=n[0],c=n[1],l=-1;for(c<o&&(t=o,o=c,c=t),a=0,i=u.length;a<i;++a)u[a]>=o&&u[a]<=c&&(l<0&&(l=a),r=a);if(!(l<0))return o=e.invertExtent(u[l]),c=e.invertExtent(u[r]),[void 0===o[0]?o[1]:o[0],void 0===c[1]?c[0]:c[1]]}},R=function(e,n,r){var t=e-n+2*r;return e?t>0?t:1:0},w=Array.prototype.map,P=Array.prototype.slice,k={identity:r.scaleIdentity,linear:r.scaleLinear,log:r.scaleLog,ordinal:r.scaleOrdinal,pow:r.scalePow,sqrt:r.scaleSqrt,quantile:r.scaleQuantile,quantize:r.scaleQuantize,threshold:r.scaleThreshold,time:r.scaleTime,utc:r.scaleUtc,band:u,point:function(){return o(u().paddingInner(1))},sequential:d,"bin-linear":l,"bin-ordinal":f};for(var M in k)s(M,k[M]);var O=p("4c78a8f58518e4575672b7b254a24beeca3bb279a2ff9da69d755dbab0ac"),B=p("4c78a89ecae9f58518ffbf7954a24b88d27ab79a20f2cf5b43989483bcb6e45756ff9d9879706ebab0acd67195fcbfd2b279a2d6a5c99e765fd8b5a5"),x=new Array(3).concat("67a9cff7f7f7f1a340","0571b092c5defdb863e66101","0571b092c5def7f7f7fdb863e66101","2166ac67a9cfd1e5f0fee0b6f1a340b35806","2166ac67a9cfd1e5f0f7f7f7fee0b6f1a340b35806","2166ac4393c392c5ded1e5f0fee0b6fdb863e08214b35806","2166ac4393c392c5ded1e5f0f7f7f7fee0b6fdb863e08214b35806","0530612166ac4393c392c5ded1e5f0fee0b6fdb863e08214b358067f3b08","0530612166ac4393c392c5ded1e5f0f7f7f7fee0b6fdb863e08214b358067f3b08").map(p),G={blueorange:x},q={category10:r.schemeCategory10,category20:r.schemeCategory20,category20b:r.schemeCategory20b,category20c:r.schemeCategory20c,accent:a.schemeAccent,dark2:a.schemeDark2,paired:a.schemePaired,pastel1:a.schemePastel1,pastel2:a.schemePastel2,set1:a.schemeSet1,set2:a.schemeSet2,set3:a.schemeSet3,tableau10:O,tableau20:B,viridis:r.interpolateViridis,magma:r.interpolateMagma,inferno:r.interpolateInferno,plasma:r.interpolatePlasma,blueorange:i.interpolateRgbBasis(t.peek(x))};b("blues","Blues"),b("greens","Greens"),b("greys","Greys"),b("purples","Purples"),b("reds","Reds"),b("oranges","Oranges"),b("brownbluegreen","BrBG"),b("purplegreen","PRGn"),b("pinkyellowgreen","PiYG"),b("purpleorange","PuOr"),b("redblue","RdBu"),b("redgrey","RdGy"),b("redyellowblue","RdYlBu"),b("redyellowgreen","RdYlGn"),b("spectral","Spectral"),b("bluegreen","BuGn"),b("bluepurple","BuPu"),b("greenblue","GnBu"),b("orangered","OrRd"),b("purplebluegreen","PuBuGn"),b("purpleblue","PuBu"),b("purplered","PuRd"),b("redpurple","RdPu"),b("yellowgreenblue","YlGnBu"),b("yellowgreen","YlGn"),b("yelloworangebrown","YlOrBr"),b("yelloworangered","YlOrRd");e.scale=s,e.scheme=function(e,n){if(arguments.length>1)return q[e]=n,this;var r=e.split("-");return e=r[0],(r=+r[1]+1)&&G.hasOwnProperty(e)?G[e][r-1]:!r&&q.hasOwnProperty(e)?q[e]:void 0},e.bandSpace=R,e.interpolate=function(e,n){var r=i[h(e)];return null!=n&&r&&r.gamma?r.gamma(n):r},e.interpolateRange=function(e,n){var r=n[0],a=t.peek(n)-r;return function(n){return e(r+n*a)}},e.scaleFraction=function(e,n,r){var a=r-n;return a?"linear"===e.type||"sequential"===e.type?function(e){return(e-n)/a}:e.copy().domain([n,r]).range([0,1]).interpolate(m):t.constant(0)},Object.defineProperty(e,"__esModule",{value:!0})});
{
"name": "vega-scale",
"version": "2.0.1",
"version": "2.0.2",
"description": "Scales and color schemes for visual encoding.",

@@ -5,0 +5,0 @@ "keywords": [

@@ -1,2 +0,2 @@

import {peek} from 'vega-util';
import {constant, peek} from 'vega-util';
import * as $ from 'd3-interpolate';

@@ -11,5 +11,7 @@

export function scaleFraction(scale, min, max) {
return scale.type === 'linear' || scale.type === 'sequential'
? function(_) { return (_ - min) / (max - min); }
: scale.copy().domain([min, max]).range([0, 1]).interpolate(lerp);
var delta = max - min;
return !delta ? constant(0)
: scale.type === 'linear' || scale.type === 'sequential'
? function(_) { return (_ - min) / delta; }
: scale.copy().domain([min, max]).range([0, 1]).interpolate(lerp);
}

@@ -16,0 +18,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc