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.0-beta.1 to 2.0.0-beta.2

9

build/vega-scale.js

@@ -193,4 +193,5 @@ (function (global, factory) {

function scale(x) {
var i = Math.max(d3Array.bisect(domain, x), 1);
return linear(domain[i-1]);
return x == null || x !== x
? undefined
: linear(domain[Math.max(d3Array.bisect(domain, x), 1)-1]);
}

@@ -244,3 +245,5 @@

function scale(x) {
return range$$1[(d3Array.bisect(domain, x) - 1) % range$$1.length];
return x == null || x !== x
? undefined
: range$$1[(d3Array.bisect(domain, x) - 1) % range$$1.length];
}

@@ -247,0 +250,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 o(){function e(){var e=u().length,r=l[1]<l[0],i=l[r-0],o=l[1-r],f=M(e,g,s);t=(o-i)/(f||1),d&&(t=Math.floor(t)),i+=(o-i-t*(e-g))*p,a=t*(1-g),d&&(i=Math.round(i),a=Math.round(a));var m=n.range(e).map(function(e){return i+t*e});return c(r?m.reverse():m)}var t,a,i=r.scaleOrdinal().unknown(void 0),u=i.domain,c=i.range,l=[0,1],d=!1,g=0,s=0,p=.5;return delete i.unknown,i.domain=function(n){return arguments.length?(u(n),e()):u()},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]],d=!0,e()},i.bandwidth=function(){return a},i.step=function(){return t},i.round=function(n){return arguments.length?(d=!!n,e()):d},i.padding=function(n){return arguments.length?(g=s=Math.max(0,Math.min(1,n)),e()):g},i.paddingInner=function(n){return arguments.length?(g=Math.max(0,Math.min(1,n)),e()):g},i.paddingOuter=function(n){return arguments.length?(s=Math.max(0,Math.min(1,n)),e()):s},i.align=function(n){return arguments.length?(p=Math.max(0,Math.min(1,n)),e()):p},i.invertRange=function(e){var r,t,i,o=+e[0],d=+e[1],g=l[1]<l[0],s=g?c().reverse():c(),p=s.length-1;if(d<o&&(i=o,o=d,d=i),!(d<s[0]||o>l[1-g]))return r=Math.max(0,n.bisectRight(s,o)-1),t=o===d?r:n.bisectRight(s,d)-1,o-s[r]>a+1e-10&&++r,g&&(i=r,r=p-t,t=p-i),r>t?void 0:u().slice(r,t+1)},i.invert=function(e){var n=i.invertRange([e,e]);return n?n[0]:n},i.copy=function(){return o().domain(u()).range(l).round(d).paddingInner(g).paddingOuter(s).align(p)},e()}function u(e){var n=e.copy;return e.padding=e.paddingOuter,delete e.paddingInner,e.copy=function(){return u(n())},e}function c(){return u(o().paddingInner(1))}function l(e){return k.call(e,function(e){return+e})}function d(){function e(e){var r=Math.max(n.bisect(o,e),1);return i(o[r-1])}function a(e){o=l(e),i.domain([o[0],t.peek(o)])}var i=r.scaleLinear(),o=[];return e.domain=function(n){return arguments.length?(a(n),e):o.slice()},e.range=function(n){return arguments.length?(i.range(n),e):i.range()},e.rangeRound=function(n){return arguments.length?(i.rangeRound(n),e):i.rangeRound()},e.interpolate=function(n){return arguments.length?(i.interpolate(n),e):i.interpolate()},e.ticks=function(n){var r=o.length,t=~~(r/(n||r));return t<2?e.domain():o.filter(function(e,n){return!(n%t)})},e.tickFormat=function(){return i.tickFormat.apply(i,arguments)},e.copy=function(){return d().domain(e.domain()).range(e.range())},e}function g(){function e(e){return t[(n.bisect(r,e)-1)%t.length]}var r=[],t=[];return e.domain=function(n){return arguments.length?(r=l(n),e):r.slice()},e.range=function(n){return arguments.length?(t=x.call(n),e):t.slice()},e.copy=function(){return g().domain(e.domain()).range(e.range())},e}function s(e){function n(){var e=i.domain();o=e[0],u=t.peek(e)-o}function a(n){var r=(n-o)/u;return e(c?Math.max(0,Math.min(1,r)):r)}var i=r.scaleLinear(),o=0,u=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 s().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 p(e,n){return function(){var r=n();return r.invertRange||(r.invertRange=r.invert?w(r):r.invertExtent?P(r):void 0),r.type=e,r}}function f(e,n){return arguments.length>1?(O[e]=p(e,n),this):O.hasOwnProperty(e)?O[e]:void 0}function m(e,n){q[e]=a["interpolate"+n],G[e]=a["scheme"+n]}function h(e,n){var r=n[0],a=t.peek(n)-r;return function(n){return e(r+n*a)}}function v(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(y)}function y(e,n){var r=n-e;return function(n){return e+n*r}}function b(e,n){var r=i[R(e)];return null!=n&&r&&r.gamma?r.gamma(n):r}function R(e){return"interpolate"+e.toLowerCase().split("-").map(function(e){return e[0].toUpperCase()+e.slice(1)}).join("")}var w=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)]}},P=function(e){return function(n){var r,t,a,i,o=e.range(),u=n[0],c=n[1],l=-1;for(c<u&&(t=u,u=c,c=t),a=0,i=o.length;a<i;++a)o[a]>=u&&o[a]<=c&&(l<0&&(l=a),r=a);if(!(l<0))return u=e.invertExtent(o[l]),c=e.invertExtent(o[r]),[void 0===u[0]?u[1]:u[0],void 0===c[1]?c[0]:c[1]]}},M=function(e,n,r){var t=e-n+2*r;return e?t>0?t:1:0},k=Array.prototype.map,x=Array.prototype.slice,O={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:o,point:c,sequential:s,"bin-linear":d,"bin-ordinal":g};for(var B in O)f(B,O[B]);var G={},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,cubehelix:r.interpolateCubehelixDefault,rainbow:r.interpolateRainbow,warm:r.interpolateWarm,cool:r.interpolateCool,viridis:r.interpolateViridis,magma:r.interpolateMagma,inferno:r.interpolateInferno,plasma:r.interpolatePlasma};m("blues","Blues"),m("greens","Greens"),m("greys","Greys"),m("purples","Purples"),m("reds","Reds"),m("oranges","Oranges"),m("brownbluegreen","BrBG"),m("purplegreen","PRGn"),m("pinkyellowgreen","PiYG"),m("purpleorange","PuOr"),m("redblue","RdBu"),m("redgrey","RdGy"),m("redyellowblue","RdYlBu"),m("redyellowgreen","RdYlGn"),m("spectral","Spectral"),m("bluegreen","BuGn"),m("bluepurple","BuPu"),m("greenblue","GnBu"),m("orangered","OrRd"),m("purplebluegreen","PuBuGn"),m("purpleblue","PuBu"),m("purplered","PuRd"),m("redpurple","RdPu"),m("yellowgreenblue","YlGnBu"),m("yellowgreen","YlGn"),m("yelloworangebrown","YlOrBr"),m("yelloworangered","YlOrRd");var C=function(e,n){if(arguments.length>1)return q[e]=n,this;var r=e.split("-");return e=r[0],r=+r[1]+1,r&&G.hasOwnProperty(e)?G[e][r-1]:!r&&q.hasOwnProperty(e)?q[e]:void 0};e.scale=f,e.scheme=C,e.bandSpace=M,e.interpolate=b,e.interpolateRange=h,e.scaleFraction=v,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 o(){function e(){var e=u().length,r=c[1]<c[0],i=c[r-0],o=c[1-r],f=M(e,g,s);t=(o-i)/(f||1),d&&(t=Math.floor(t)),i+=(o-i-t*(e-g))*p,a=t*(1-g),d&&(i=Math.round(i),a=Math.round(a));var m=n.range(e).map(function(e){return i+t*e});return l(r?m.reverse():m)}var t,a,i=r.scaleOrdinal().unknown(void 0),u=i.domain,l=i.range,c=[0,1],d=!1,g=0,s=0,p=.5;return delete i.unknown,i.domain=function(n){return arguments.length?(u(n),e()):u()},i.range=function(n){return arguments.length?(c=[+n[0],+n[1]],e()):c.slice()},i.rangeRound=function(n){return c=[+n[0],+n[1]],d=!0,e()},i.bandwidth=function(){return a},i.step=function(){return t},i.round=function(n){return arguments.length?(d=!!n,e()):d},i.padding=function(n){return arguments.length?(g=s=Math.max(0,Math.min(1,n)),e()):g},i.paddingInner=function(n){return arguments.length?(g=Math.max(0,Math.min(1,n)),e()):g},i.paddingOuter=function(n){return arguments.length?(s=Math.max(0,Math.min(1,n)),e()):s},i.align=function(n){return arguments.length?(p=Math.max(0,Math.min(1,n)),e()):p},i.invertRange=function(e){var r,t,i,o=+e[0],d=+e[1],g=c[1]<c[0],s=g?l().reverse():l(),p=s.length-1;if(d<o&&(i=o,o=d,d=i),!(d<s[0]||o>c[1-g]))return r=Math.max(0,n.bisectRight(s,o)-1),t=o===d?r:n.bisectRight(s,d)-1,o-s[r]>a+1e-10&&++r,g&&(i=r,r=p-t,t=p-i),r>t?void 0:u().slice(r,t+1)},i.invert=function(e){var n=i.invertRange([e,e]);return n?n[0]:n},i.copy=function(){return o().domain(u()).range(c).round(d).paddingInner(g).paddingOuter(s).align(p)},e()}function u(e){var n=e.copy;return e.padding=e.paddingOuter,delete e.paddingInner,e.copy=function(){return u(n())},e}function l(){return u(o().paddingInner(1))}function c(e){return k.call(e,function(e){return+e})}function d(){function e(e){return null==e||e!==e?void 0:i(o[Math.max(n.bisect(o,e),1)-1])}function a(e){o=c(e),i.domain([o[0],t.peek(o)])}var i=r.scaleLinear(),o=[];return e.domain=function(n){return arguments.length?(a(n),e):o.slice()},e.range=function(n){return arguments.length?(i.range(n),e):i.range()},e.rangeRound=function(n){return arguments.length?(i.rangeRound(n),e):i.rangeRound()},e.interpolate=function(n){return arguments.length?(i.interpolate(n),e):i.interpolate()},e.ticks=function(n){var r=o.length,t=~~(r/(n||r));return t<2?e.domain():o.filter(function(e,n){return!(n%t)})},e.tickFormat=function(){return i.tickFormat.apply(i,arguments)},e.copy=function(){return d().domain(e.domain()).range(e.range())},e}function g(){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=x.call(n),e):t.slice()},e.copy=function(){return g().domain(e.domain()).range(e.range())},e}function s(e){function n(){var e=i.domain();o=e[0],u=t.peek(e)-o}function a(n){var r=(n-o)/u;return e(l?Math.max(0,Math.min(1,r)):r)}var i=r.scaleLinear(),o=0,u=1,l=!1;return a.clamp=function(e){return arguments.length?(l=!!e,a):l},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 s().domain(i.domain()).clamp(l).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 p(e,n){return function(){var r=n();return r.invertRange||(r.invertRange=r.invert?w(r):r.invertExtent?P(r):void 0),r.type=e,r}}function f(e,n){return arguments.length>1?(O[e]=p(e,n),this):O.hasOwnProperty(e)?O[e]:void 0}function m(e,n){q[e]=a["interpolate"+n],G[e]=a["scheme"+n]}function h(e,n){var r=n[0],a=t.peek(n)-r;return function(n){return e(r+n*a)}}function v(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(y)}function y(e,n){var r=n-e;return function(n){return e+n*r}}function b(e,n){var r=i[R(e)];return null!=n&&r&&r.gamma?r.gamma(n):r}function R(e){return"interpolate"+e.toLowerCase().split("-").map(function(e){return e[0].toUpperCase()+e.slice(1)}).join("")}var w=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)]}},P=function(e){return function(n){var r,t,a,i,o=e.range(),u=n[0],l=n[1],c=-1;for(l<u&&(t=u,u=l,l=t),a=0,i=o.length;a<i;++a)o[a]>=u&&o[a]<=l&&(c<0&&(c=a),r=a);if(!(c<0))return u=e.invertExtent(o[c]),l=e.invertExtent(o[r]),[void 0===u[0]?u[1]:u[0],void 0===l[1]?l[0]:l[1]]}},M=function(e,n,r){var t=e-n+2*r;return e?t>0?t:1:0},k=Array.prototype.map,x=Array.prototype.slice,O={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:o,point:l,sequential:s,"bin-linear":d,"bin-ordinal":g};for(var B in O)f(B,O[B]);var G={},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,cubehelix:r.interpolateCubehelixDefault,rainbow:r.interpolateRainbow,warm:r.interpolateWarm,cool:r.interpolateCool,viridis:r.interpolateViridis,magma:r.interpolateMagma,inferno:r.interpolateInferno,plasma:r.interpolatePlasma};m("blues","Blues"),m("greens","Greens"),m("greys","Greys"),m("purples","Purples"),m("reds","Reds"),m("oranges","Oranges"),m("brownbluegreen","BrBG"),m("purplegreen","PRGn"),m("pinkyellowgreen","PiYG"),m("purpleorange","PuOr"),m("redblue","RdBu"),m("redgrey","RdGy"),m("redyellowblue","RdYlBu"),m("redyellowgreen","RdYlGn"),m("spectral","Spectral"),m("bluegreen","BuGn"),m("bluepurple","BuPu"),m("greenblue","GnBu"),m("orangered","OrRd"),m("purplebluegreen","PuBuGn"),m("purpleblue","PuBu"),m("purplered","PuRd"),m("redpurple","RdPu"),m("yellowgreenblue","YlGnBu"),m("yellowgreen","YlGn"),m("yelloworangebrown","YlOrBr"),m("yelloworangered","YlOrRd");var C=function(e,n){if(arguments.length>1)return q[e]=n,this;var r=e.split("-");return e=r[0],r=+r[1]+1,r&&G.hasOwnProperty(e)?G[e][r-1]:!r&&q.hasOwnProperty(e)?q[e]:void 0};e.scale=f,e.scheme=C,e.bandSpace=M,e.interpolate=b,e.interpolateRange=h,e.scaleFraction=v,Object.defineProperty(e,"__esModule",{value:!0})});
{
"name": "vega-scale",
"version": "2.0.0-beta.1",
"version": "2.0.0-beta.2",
"description": "Scales and color schemes for visual encoding.",

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

@@ -17,4 +17,5 @@ import {bisect} from 'd3-array';

function scale(x) {
var i = Math.max(bisect(domain, x), 1);
return linear(domain[i-1]);
return x == null || x !== x
? undefined
: linear(domain[Math.max(bisect(domain, x), 1)-1]);
}

@@ -68,3 +69,5 @@

function scale(x) {
return range[(bisect(domain, x) - 1) % range.length];
return x == null || x !== x
? undefined
: range[(bisect(domain, x) - 1) % range.length];
}

@@ -71,0 +74,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