vega-scale
Advanced tools
Comparing version 3.0.0 to 4.0.0
(function (global, factory) { | ||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('d3-time'), require('d3-array'), require('d3-scale'), require('vega-util'), require('d3-interpolate'), require('d3-scale-chromatic')) : | ||
typeof define === 'function' && define.amd ? define(['exports', 'd3-time', 'd3-array', 'd3-scale', 'vega-util', 'd3-interpolate', 'd3-scale-chromatic'], factory) : | ||
(global = global || self, factory(global.vega = {}, global.d3, global.d3, global.d3, global.vega, global.d3, global.d3)); | ||
}(this, function (exports, d3Time, d3Array, $, vegaUtil, $$1, _) { 'use strict'; | ||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('d3-time'), require('d3-array'), require('d3-scale'), require('vega-util'), require('d3-interpolate')) : | ||
typeof define === 'function' && define.amd ? define(['exports', 'd3-time', 'd3-array', 'd3-scale', 'vega-util', 'd3-interpolate'], factory) : | ||
(global = global || self, factory(global.vega = {}, global.d3, global.d3, global.d3, global.vega, global.d3)); | ||
}(this, function (exports, d3Time, d3Array, $, vegaUtil, $$1) { 'use strict'; | ||
@@ -143,5 +143,5 @@ function bandSpace(count, paddingInner, paddingOuter) { | ||
function invertRange(scale) { | ||
return function(_$$1) { | ||
var lo = _$$1[0], | ||
hi = _$$1[1], | ||
return function(_) { | ||
var lo = _[0], | ||
hi = _[1], | ||
t; | ||
@@ -163,6 +163,6 @@ | ||
function invertRangeExtent(scale) { | ||
return function(_$$1) { | ||
return function(_) { | ||
var range = scale.range(), | ||
lo = _$$1[0], | ||
hi = _$$1[1], | ||
lo = _[0], | ||
hi = _[1], | ||
min = -1, max, t, i, n; | ||
@@ -230,5 +230,5 @@ | ||
scale.domain = function(_$$1) { | ||
scale.domain = function(_) { | ||
if (arguments.length) { | ||
domain(_$$1); | ||
domain(_); | ||
return rescale(); | ||
@@ -240,5 +240,5 @@ } else { | ||
scale.range = function(_$$1) { | ||
scale.range = function(_) { | ||
if (arguments.length) { | ||
range = [+_$$1[0], +_$$1[1]]; | ||
range = [+_[0], +_[1]]; | ||
return rescale(); | ||
@@ -250,4 +250,4 @@ } else { | ||
scale.rangeRound = function(_$$1) { | ||
range = [+_$$1[0], +_$$1[1]]; | ||
scale.rangeRound = function(_) { | ||
range = [+_[0], +_[1]]; | ||
round = true; | ||
@@ -265,5 +265,5 @@ return rescale(); | ||
scale.round = function(_$$1) { | ||
scale.round = function(_) { | ||
if (arguments.length) { | ||
round = !!_$$1; | ||
round = !!_; | ||
return rescale(); | ||
@@ -275,5 +275,5 @@ } else { | ||
scale.padding = function(_$$1) { | ||
scale.padding = function(_) { | ||
if (arguments.length) { | ||
paddingOuter = Math.max(0, Math.min(1, _$$1)); | ||
paddingOuter = Math.max(0, Math.min(1, _)); | ||
paddingInner = paddingOuter; | ||
@@ -286,5 +286,5 @@ return rescale(); | ||
scale.paddingInner = function(_$$1) { | ||
scale.paddingInner = function(_) { | ||
if (arguments.length) { | ||
paddingInner = Math.max(0, Math.min(1, _$$1)); | ||
paddingInner = Math.max(0, Math.min(1, _)); | ||
return rescale(); | ||
@@ -296,5 +296,5 @@ } else { | ||
scale.paddingOuter = function(_$$1) { | ||
scale.paddingOuter = function(_) { | ||
if (arguments.length) { | ||
paddingOuter = Math.max(0, Math.min(1, _$$1)); | ||
paddingOuter = Math.max(0, Math.min(1, _)); | ||
return rescale(); | ||
@@ -306,5 +306,5 @@ } else { | ||
scale.align = function(_$$1) { | ||
scale.align = function(_) { | ||
if (arguments.length) { | ||
align = Math.max(0, Math.min(1, _$$1)); | ||
align = Math.max(0, Math.min(1, _)); | ||
return rescale(); | ||
@@ -316,8 +316,8 @@ } else { | ||
scale.invertRange = function(_$$1) { | ||
scale.invertRange = function(_) { | ||
// bail if range has null or undefined values | ||
if (_$$1[0] == null || _$$1[1] == null) return; | ||
if (_[0] == null || _[1] == null) return; | ||
var lo = +_$$1[0], | ||
hi = +_$$1[1], | ||
var lo = +_[0], | ||
hi = +_[1], | ||
reverse = range[1] < range[0], | ||
@@ -354,4 +354,4 @@ values = reverse ? ordinalRange().reverse() : ordinalRange(), | ||
scale.invert = function(_$$1) { | ||
var value = scale.invertRange([_$$1, _$$1]); | ||
scale.invert = function(_) { | ||
var value = scale.invertRange([_, _]); | ||
return value ? value[0] : value; | ||
@@ -392,4 +392,4 @@ }; | ||
function numbers(_$$1) { | ||
return map.call(_$$1, function(x) { return +x; }); | ||
function numbers(_) { | ||
return map.call(_, function(x) { return +x; }); | ||
} | ||
@@ -409,5 +409,5 @@ | ||
scale.domain = function(_$$1) { | ||
scale.domain = function(_) { | ||
if (arguments.length) { | ||
domain = numbers(_$$1); | ||
domain = numbers(_); | ||
return scale; | ||
@@ -419,5 +419,5 @@ } else { | ||
scale.range = function(_$$1) { | ||
scale.range = function(_) { | ||
if (arguments.length) { | ||
range = slice.call(_$$1); | ||
range = slice.call(_); | ||
return scale; | ||
@@ -519,5 +519,16 @@ } else { | ||
function scaleCopy(scale$$1) { | ||
const t = scale$$1.type, | ||
s = scale$$1.copy(); | ||
function interpolateColors(colors, type, gamma) { | ||
return $$1.piecewise(interpolate(type || 'rgb', gamma), colors); | ||
} | ||
function quantizeInterpolator(interpolator, count) { | ||
var samples = new Array(count), | ||
n = count + 1; | ||
for (var i = 0; i < count;) samples[i] = interpolator(++i / n); | ||
return samples; | ||
} | ||
function scaleCopy(scale) { | ||
const t = scale.type, | ||
s = scale.copy(); | ||
s.type = t; | ||
@@ -527,3 +538,3 @@ return s; | ||
function scaleFraction(scale$$1, min, max) { | ||
function scaleFraction(scale$1, min, max) { | ||
var delta = max - min, i, t, s; | ||
@@ -534,6 +545,6 @@ | ||
} else { | ||
i = (t = scale$$1.type).indexOf('-'); | ||
i = (t = scale$1.type).indexOf('-'); | ||
t = i < 0 ? t : t.slice(i + 1); | ||
s = scale(t)().domain([min, max]).range([0, 1]); | ||
scaleProps.forEach(m => scale$$1[m] ? s[m](scale$$1[m]()) : 0); | ||
scaleProps.forEach(m => scale$1[m] ? s[m](scale$1[m]()) : 0); | ||
return s; | ||
@@ -557,142 +568,105 @@ } | ||
function colors(specifier) { | ||
var n = specifier.length / 6 | 0, colors = new Array(n), i = 0; | ||
while (i < n) colors[i] = "#" + specifier.slice(i * 6, ++i * 6); | ||
return colors; | ||
} | ||
const continuous = { | ||
blues: 'cfe1f2bed8eca8cee58fc1de74b2d75ba3cf4592c63181bd206fb2125ca40a4a90', | ||
greens: 'd3eecdc0e6baabdda594d3917bc77d60ba6c46ab5e329a512089430e7735036429', | ||
greys: 'e2e2e2d4d4d4c4c4c4b1b1b19d9d9d8888887575756262624d4d4d3535351e1e1e', | ||
oranges: 'fdd8b3fdc998fdb87bfda55efc9244f87f2cf06b18e4580bd14904b93d029f3303', | ||
purples: 'e2e1efd4d4e8c4c5e0b4b3d6a3a0cc928ec3827cb97566ae684ea25c3696501f8c', | ||
reds: 'fdc9b4fcb49afc9e80fc8767fa7051f6573fec3f2fdc2a25c81b1db21218970b13', | ||
var category20 = colors( | ||
'1f77b4aec7e8ff7f0effbb782ca02c98df8ad62728ff98969467bdc5b0d58c564bc49c94e377c2f7b6d27f7f7fc7c7c7bcbd22dbdb8d17becf9edae5' | ||
); | ||
blueGreen: 'd5efedc1e8e0a7ddd18bd2be70c6a958ba9144ad77319c5d2089460e7736036429', | ||
bluePurple: 'ccddecbad0e4a8c2dd9ab0d4919cc98d85be8b6db28a55a6873c99822287730f71', | ||
greenBlue: 'd3eecec5e8c3b1e1bb9bd8bb82cec269c2ca51b2cd3c9fc7288abd1675b10b60a1', | ||
orangeRed: 'fddcaffdcf9bfdc18afdad77fb9562f67d53ee6545e24932d32d1ebf130da70403', | ||
purpleBlue: 'dbdaebc8cee4b1c3de97b7d87bacd15b9fc93a90c01e7fb70b70ab056199045281', | ||
purpleBlueGreen: 'dbd8eac8cee4b0c3de93b7d872acd1549fc83892bb1c88a3097f8702736b016353', | ||
purpleRed: 'dcc9e2d3b3d7ce9eccd186c0da6bb2e14da0e23189d91e6fc61159ab07498f023a', | ||
redPurple: 'fccfccfcbec0faa9b8f98faff571a5ec539ddb3695c41b8aa908808d0179700174', | ||
yellowGreen: 'e4f4acd1eca0b9e2949ed68880c97c62bb6e47aa5e3297502083440e723b036034', | ||
yellowOrangeBrown: 'feeaa1fedd84fecc63feb746fca031f68921eb7215db5e0bc54c05ab3d038f3204', | ||
yellowOrangeRed: 'fee087fed16ffebd59fea849fd903efc7335f9522bee3423de1b20ca0b22af0225', | ||
var category20b = colors( | ||
'393b795254a36b6ecf9c9ede6379398ca252b5cf6bcedb9c8c6d31bd9e39e7ba52e7cb94843c39ad494ad6616be7969c7b4173a55194ce6dbdde9ed6' | ||
); | ||
blueOrange: '134b852f78b35da2cb9dcae1d2e5eff2f0ebfce0bafbbf74e8932fc5690d994a07', | ||
brownBlueGreen: '704108a0651ac79548e3c78af3e6c6eef1eac9e9e48ed1c74da79e187a72025147', | ||
purpleGreen: '5b1667834792a67fb6c9aed3e6d6e8eff0efd9efd5aedda971bb75368e490e5e29', | ||
purpleOrange: '4114696647968f83b7b9b4d6dadbebf3eeeafce0bafbbf74e8932fc5690d994a07', | ||
redBlue: '8c0d25bf363adf745ef4ae91fbdbc9f2efeed2e5ef9dcae15da2cb2f78b3134b85', | ||
redGrey: '8c0d25bf363adf745ef4ae91fcdccbfaf4f1e2e2e2c0c0c0969696646464343434', | ||
yellowGreenBlue: 'eff9bddbf1b4bde5b594d5b969c5be45b4c22c9ec02182b82163aa23479c1c3185', | ||
redYellowBlue: 'a50026d4322cf16e43fcac64fedd90faf8c1dcf1ecabd6e875abd04a74b4313695', | ||
redYellowGreen: 'a50026d4322cf16e43fcac63fedd8df9f7aed7ee8ea4d86e64bc6122964f006837', | ||
pinkYellowGreen: '8e0152c0267edd72adf0b3d6faddedf5f3efe1f2cab6de8780bb474f9125276419', | ||
spectral: '9e0142d13c4bf0704afcac63fedd8dfbf8b0e0f3a1a9dda269bda94288b55e4fa2', | ||
var category20c = colors( | ||
'3182bd6baed69ecae1c6dbefe6550dfd8d3cfdae6bfdd0a231a35474c476a1d99bc7e9c0756bb19e9ac8bcbddcdadaeb636363969696bdbdbdd9d9d9' | ||
); | ||
viridis: '440154470e61481a6c482575472f7d443a834144873d4e8a39568c35608d31688e2d708e2a788e27818e23888e21918d1f988b1fa08822a8842ab07f35b77943bf7154c56866cc5d7ad1518fd744a5db36bcdf27d2e21be9e51afde725', | ||
magma: '0000040404130b0924150e3720114b2c11603b0f704a107957157e651a80721f817f24828c29819a2e80a8327db6377ac43c75d1426fde4968e95462f1605df76f5cfa7f5efc8f65fe9f6dfeaf78febf84fece91fddea0fcedaffcfdbf', | ||
inferno: '0000040403130c0826170c3b240c4f330a5f420a68500d6c5d126e6b176e781c6d86216b932667a12b62ae305cbb3755c73e4cd24644dd513ae65c30ed6925f3771af8850ffb9506fca50afcb519fac62df6d645f2e661f3f484fcffa4', | ||
plasma: '0d088723069033059742039d5002a25d01a66a00a87801a88405a7900da49c179ea72198b12a90ba3488c33d80cb4779d35171da5a69e16462e76e5bed7953f2834cf68f44fa9a3dfca636fdb32ffec029fcce25f9dc24f5ea27f0f921', | ||
var tableau10 = colors( | ||
'4c78a8f58518e4575672b7b254a24beeca3bb279a2ff9da69d755dbab0ac' | ||
); | ||
rainbow: '6e40aa883eb1a43db3bf3cafd83fa4ee4395fe4b83ff576eff6659ff7847ff8c38f3a130e2b72fcfcc36bee044aff05b8ff4576ff65b52f6673af27828ea8d1ddfa319d0b81cbecb23abd82f96e03d82e14c6edb5a5dd0664dbf6e40aa', | ||
sinebow: 'ff4040fc582af47218e78d0bd5a703bfbf00a7d5038de70b72f41858fc2a40ff402afc5818f4720be78d03d5a700bfbf03a7d50b8de71872f42a58fc4040ff582afc7218f48d0be7a703d5bf00bfd503a7e70b8df41872fc2a58ff4040', | ||
var tableau20 = colors( | ||
'4c78a89ecae9f58518ffbf7954a24b88d27ab79a20f2cf5b43989483bcb6e45756ff9d9879706ebab0acd67195fcbfd2b279a2d6a5c99e765fd8b5a5' | ||
); | ||
browns: 'eedbbdecca96e9b97ae4a865dc9856d18954c7784cc0673fb85536ad44339f3632', | ||
tealBlues: 'bce4d89dd3d181c3cb65b3c245a2b9368fae347da0306a932c5985', | ||
teals: 'bbdfdfa2d4d58ac9c975bcbb61b0af4da5a43799982b8b8c1e7f7f127273006667', | ||
warmGreys: 'dcd4d0cec5c1c0b8b4b3aaa7a59c9998908c8b827f7e7673726866665c5a59504e', | ||
var blueOrange = new Array(3).concat( | ||
"67a9cff7f7f7f1a340", | ||
"0571b092c5defdb863e66101", | ||
"0571b092c5def7f7f7fdb863e66101", | ||
"2166ac67a9cfd1e5f0fee0b6f1a340b35806", | ||
"2166ac67a9cfd1e5f0f7f7f7fee0b6f1a340b35806", | ||
"2166ac4393c392c5ded1e5f0fee0b6fdb863e08214b35806", | ||
"2166ac4393c392c5ded1e5f0f7f7f7fee0b6fdb863e08214b35806", | ||
"0530612166ac4393c392c5ded1e5f0fee0b6fdb863e08214b358067f3b08", | ||
"0530612166ac4393c392c5ded1e5f0f7f7f7fee0b6fdb863e08214b358067f3b08" | ||
).map(colors); | ||
goldGreen: 'f4d166d5ca60b6c35c98bb597cb25760a6564b9c533f8f4f33834a257740146c36', | ||
goldOrange: 'f4d166f8be5cf8aa4cf5983bf3852aef701be2621fd65322c54923b142239e3a26', | ||
goldRed: 'f4d166f6be59f9aa51fc964ef6834bee734ae56249db5247cf4244c43141b71d3e', | ||
var discretized = { | ||
blueorange: blueOrange | ||
lightGreyRed: 'efe9e6e1dad7d5cbc8c8bdb9bbaea9cd967ddc7b43e15f19df4011dc000b', | ||
lightGreyTeal: 'e4eaead6dcddc8ced2b7c2c7a6b4bc64b0bf22a6c32295c11f85be1876bc', | ||
lightMulti: 'e0f1f2c4e9d0b0de9fd0e181f6e072f6c053f3993ef77440ef4a3c', | ||
lightOrange: 'f2e7daf7d5baf9c499fab184fa9c73f68967ef7860e8645bde515bd43d5b', | ||
lightTealBlue: 'e3e9e0c0dccf9aceca7abfc859afc0389fb9328dad2f7ca0276b95255988', | ||
darkBlue: '3232322d46681a5c930074af008cbf05a7ce25c0dd38daed50f3faffffff', | ||
darkGold: '3c3c3c584b37725e348c7631ae8b2bcfa424ecc31ef9de30fff184ffffff', | ||
darkGreen: '3a3a3a215748006f4d048942489e4276b340a6c63dd2d836ffeb2cffffaa', | ||
darkMulti: '3737371f5287197d8c29a86995ce3fffe800ffffff', | ||
darkRed: '3434347036339e3c38cc4037e75d1eec8620eeab29f0ce32ffeb2c' | ||
}; | ||
var schemes = { | ||
// d3 categorical palettes | ||
category10: _.schemeCategory10, | ||
accent: _.schemeAccent, | ||
dark2: _.schemeDark2, | ||
paired: _.schemePaired, | ||
pastel1: _.schemePastel1, | ||
pastel2: _.schemePastel2, | ||
set1: _.schemeSet1, | ||
set2: _.schemeSet2, | ||
set3: _.schemeSet3, | ||
// additional categorical palettes | ||
category20: category20, | ||
category20b: category20b, | ||
category20c: category20c, | ||
tableau10: tableau10, | ||
tableau20: tableau20, | ||
// sequential multi-hue interpolators | ||
viridis: _.interpolateViridis, | ||
magma: _.interpolateMagma, | ||
inferno: _.interpolateInferno, | ||
plasma: _.interpolatePlasma, | ||
// cyclic interpolators | ||
rainbow: _.interpolateRainbow, | ||
sinebow: _.interpolateSinebow, | ||
// extended interpolators | ||
blueorange: $$1.interpolateRgbBasis(vegaUtil.peek(blueOrange)) | ||
const discrete = { | ||
category10: '1f77b4ff7f0e2ca02cd627289467bd8c564be377c27f7f7fbcbd2217becf', | ||
category20: '1f77b4aec7e8ff7f0effbb782ca02c98df8ad62728ff98969467bdc5b0d58c564bc49c94e377c2f7b6d27f7f7fc7c7c7bcbd22dbdb8d17becf9edae5', | ||
category20b: '393b795254a36b6ecf9c9ede6379398ca252b5cf6bcedb9c8c6d31bd9e39e7ba52e7cb94843c39ad494ad6616be7969c7b4173a55194ce6dbdde9ed6', | ||
category20c: '3182bd6baed69ecae1c6dbefe6550dfd8d3cfdae6bfdd0a231a35474c476a1d99bc7e9c0756bb19e9ac8bcbddcdadaeb636363969696bdbdbdd9d9d9', | ||
tableau10: '4c78a8f58518e4575672b7b254a24beeca3bb279a2ff9da69d755dbab0ac', | ||
tableau20: '4c78a89ecae9f58518ffbf7954a24b88d27ab79a20f2cf5b43989483bcb6e45756ff9d9879706ebab0acd67195fcbfd2b279a2d6a5c99e765fd8b5a5', | ||
accent: '7fc97fbeaed4fdc086ffff99386cb0f0027fbf5b17666666', | ||
dark2: '1b9e77d95f027570b3e7298a66a61ee6ab02a6761d666666', | ||
paired: 'a6cee31f78b4b2df8a33a02cfb9a99e31a1cfdbf6fff7f00cab2d66a3d9affff99b15928', | ||
pastel1: 'fbb4aeb3cde3ccebc5decbe4fed9a6ffffcce5d8bdfddaecf2f2f2', | ||
pastel2: 'b3e2cdfdcdaccbd5e8f4cae4e6f5c9fff2aef1e2cccccccc', | ||
set1: 'e41a1c377eb84daf4a984ea3ff7f00ffff33a65628f781bf999999', | ||
set2: '66c2a5fc8d628da0cbe78ac3a6d854ffd92fe5c494b3b3b3', | ||
set3: '8dd3c7ffffb3bebadafb807280b1d3fdb462b3de69fccde5d9d9d9bc80bdccebc5ffed6f' | ||
}; | ||
function add(name, suffix) { | ||
schemes[name] = _['interpolate' + suffix]; | ||
discretized[name] = _['scheme' + suffix]; | ||
function colors(palette) { | ||
var n = palette.length / 6 | 0, c = new Array(n), i = 0; | ||
while (i < n) c[i] = '#' + palette.slice(i * 6, ++i * 6); | ||
return c; | ||
} | ||
// sequential single-hue | ||
add('blues', 'Blues'); | ||
add('greens', 'Greens'); | ||
add('greys', 'Greys'); | ||
add('purples', 'Purples'); | ||
add('reds', 'Reds'); | ||
add('oranges', 'Oranges'); | ||
function apply(_, f) { | ||
for (let k in _) scheme(k, f(_[k])); | ||
} | ||
// diverging | ||
add('brownbluegreen', 'BrBG'); | ||
add('purplegreen', 'PRGn'); | ||
add('pinkyellowgreen', 'PiYG'); | ||
add('purpleorange', 'PuOr'); | ||
add('redblue', 'RdBu'); | ||
add('redgrey', 'RdGy'); | ||
add('redyellowblue', 'RdYlBu'); | ||
add('redyellowgreen', 'RdYlGn'); | ||
add('spectral', 'Spectral'); | ||
const schemes = {}; | ||
apply(discrete, colors); | ||
apply(continuous, _ => interpolateColors(colors(_))); | ||
// sequential multi-hue | ||
add('bluegreen', 'BuGn'); | ||
add('bluepurple', 'BuPu'); | ||
add('greenblue', 'GnBu'); | ||
add('orangered', 'OrRd'); | ||
add('purplebluegreen', 'PuBuGn'); | ||
add('purpleblue', 'PuBu'); | ||
add('purplered', 'PuRd'); | ||
add('redpurple', 'RdPu'); | ||
add('yellowgreenblue', 'YlGnBu'); | ||
add('yellowgreen', 'YlGn'); | ||
add('yelloworangebrown', 'YlOrBr'); | ||
add('yelloworangered', 'YlOrRd'); | ||
function scheme(name, scheme) { | ||
name = name && name.toLowerCase(); | ||
if (arguments.length > 1) { | ||
schemes[name] = scheme; | ||
return this; | ||
} else { | ||
return schemes[name]; | ||
} | ||
var part = name.split('-'); | ||
name = part[0]; | ||
part = +part[1] + 1; | ||
return part && discretized.hasOwnProperty(name) ? discretized[name][part-1] | ||
: !part && schemes.hasOwnProperty(name) ? schemes[name] | ||
: undefined; | ||
} | ||
function schemeDiscretized(name, schemeArray, interpolator) { | ||
if (arguments.length > 1) { | ||
discretized[name] = schemeArray; | ||
schemes[name] = interpolator || $$1.interpolateRgbBasis(vegaUtil.peek(schemeArray)); | ||
return this; | ||
} | ||
return discretized.hasOwnProperty(name) | ||
? discretized[name] | ||
: undefined; | ||
} | ||
exports.scaleImplicit = $.scaleImplicit; | ||
@@ -729,9 +703,10 @@ exports.bandSpace = bandSpace; | ||
exports.isDiscretizing = isDiscretizing; | ||
exports.scale = scale; | ||
exports.interpolate = interpolate; | ||
exports.interpolateColors = interpolateColors; | ||
exports.interpolateRange = interpolateRange; | ||
exports.scaleCopy = scaleCopy; | ||
exports.scaleFraction = scaleFraction; | ||
exports.quantizeInterpolator = quantizeInterpolator; | ||
exports.scale = scale; | ||
exports.scheme = scheme; | ||
exports.schemeDiscretized = schemeDiscretized; | ||
@@ -738,0 +713,0 @@ Object.defineProperty(exports, '__esModule', { value: true }); |
@@ -1,1 +0,1 @@ | ||
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("d3-time"),require("d3-array"),require("d3-scale"),require("vega-util"),require("d3-interpolate"),require("d3-scale-chromatic")):"function"==typeof define&&define.amd?define(["exports","d3-time","d3-array","d3-scale","vega-util","d3-interpolate","d3-scale-chromatic"],n):n((e=e||self).vega={},e.d3,e.d3,e.d3,e.vega,e.d3,e.d3)}(this,function(e,n,t,r,a,i,c){"use strict";function u(e,n,t){var r=e-n+2*t;return e?r>0?r:1:0}const o="identity",l="linear",d="log",s="pow",f="sqrt",g="symlog",b="time",p="utc",m="sequential",h="diverging",v="quantile",y="quantize",w="threshold",S="ordinal",P="point",q="band",R="bin-ordinal";function M(e){return e===R}function O(e){return e&&e.startsWith(m)}function B(e){return e&&e.startsWith(h)}var k={millisecond:n.timeMillisecond,second:n.timeSecond,minute:n.timeMinute,hour:n.timeHour,day:n.timeDay,week:n.timeWeek,month:n.timeMonth,year:n.timeYear},x={millisecond:n.utcMillisecond,second:n.utcSecond,minute:n.utcMinute,hour:n.utcHour,day:n.utcDay,week:n.utcWeek,month:n.utcMonth,year:n.utcYear};function D(){var e,n,a=r.scaleOrdinal().unknown(void 0),i=a.domain,c=a.range,o=[0,1],l=!1,d=0,s=0,f=.5;function g(){var r=i().length,a=o[1]<o[0],g=o[a-0],b=o[1-a],p=u(r,d,s);e=(b-g)/(p||1),l&&(e=Math.floor(e)),g+=(b-g-e*(r-d))*f,n=e*(1-d),l&&(g=Math.round(g),n=Math.round(n));var m=t.range(r).map(function(n){return g+e*n});return c(a?m.reverse():m)}return delete a.unknown,a.domain=function(e){return arguments.length?(i(e),g()):i()},a.range=function(e){return arguments.length?(o=[+e[0],+e[1]],g()):o.slice()},a.rangeRound=function(e){return o=[+e[0],+e[1]],l=!0,g()},a.bandwidth=function(){return n},a.step=function(){return e},a.round=function(e){return arguments.length?(l=!!e,g()):l},a.padding=function(e){return arguments.length?(s=Math.max(0,Math.min(1,e)),d=s,g()):d},a.paddingInner=function(e){return arguments.length?(d=Math.max(0,Math.min(1,e)),g()):d},a.paddingOuter=function(e){return arguments.length?(s=Math.max(0,Math.min(1,e)),g()):s},a.align=function(e){return arguments.length?(f=Math.max(0,Math.min(1,e)),g()):f},a.invertRange=function(e){if(null!=e[0]&&null!=e[1]){var r,a,u,l=+e[0],d=+e[1],s=o[1]<o[0],f=s?c().reverse():c(),g=f.length-1;if(l==l&&d==d&&(d<l&&(u=l,l=d,d=u),!(d<f[0]||l>o[1-s])))return r=Math.max(0,t.bisectRight(f,l)-1),a=l===d?r:t.bisectRight(f,d)-1,l-f[r]>n+1e-10&&++r,s&&(u=r,r=g-a,a=g-u),r>a?void 0:i().slice(r,a+1)}},a.invert=function(e){var n=a.invertRange([e,e]);return n?n[0]:n},a.copy=function(){return D().domain(i()).range(o).round(l).paddingInner(d).paddingOuter(s).align(f)},g()}var G=Array.prototype.map;var I=Array.prototype.slice;function Y(e,n){return arguments.length>1?(L[e]=function(e,n){return function(){var t=n();return t.invertRange||(t.invertRange=t.invert?function(e){return function(n){var t,r=n[0],a=n[1];return a<r&&(t=r,r=a,a=t),[e.invert(r),e.invert(a)]}}(t):t.invertExtent?function(e){return function(n){var t,r,a,i,c=e.range(),u=n[0],o=n[1],l=-1;for(o<u&&(r=u,u=o,o=r),a=0,i=c.length;a<i;++a)c[a]>=u&&c[a]<=o&&(l<0&&(l=a),t=a);if(!(l<0))return u=e.invertExtent(c[l]),o=e.invertExtent(c[t]),[void 0===u[0]?u[1]:u[0],void 0===o[1]?o[0]:o[1]]}}(t):void 0),t.type=e,t}}(e,n),this):L.hasOwnProperty(e)?L[e]:void 0}var L={[o]:r.scaleIdentity,[l]:r.scaleLinear,[d]:r.scaleLog,[s]:r.scalePow,[f]:r.scaleSqrt,[g]:r.scaleSymlog,[b]:r.scaleTime,[p]:r.scaleUtc,[m]:r.scaleSequential,[m+"-"+l]:r.scaleSequential,[m+"-"+d]:r.scaleSequentialLog,[m+"-"+s]:r.scaleSequentialPow,[m+"-"+f]:r.scaleSequentialSqrt,[m+"-"+g]:r.scaleSequentialSymlog,[h+"-"+l]:r.scaleDiverging,[h+"-"+d]:r.scaleDivergingLog,[h+"-"+s]:r.scaleDivergingPow,[h+"-"+f]:r.scaleDivergingSqrt,[h+"-"+g]:r.scaleDivergingSymlog,[v]:r.scaleQuantile,[y]:r.scaleQuantize,[w]:r.scaleThreshold,[R]:function e(){var n=[],i=[];function c(e){return null==e||e!=e?void 0:i[(t.bisect(n,e)-1)%i.length]}return c.domain=function(e){return arguments.length?(n=function(e){return G.call(e,function(e){return+e})}(e),c):n.slice()},c.range=function(e){return arguments.length?(i=I.call(e),c):i.slice()},c.tickFormat=function(e,t){return r.tickFormat(n[0],a.peek(n),null==e?10:e,t)},c.copy=function(){return e().domain(c.domain()).range(c.range())},c},[S]:r.scaleOrdinal,[q]:D,[P]:function(){return function e(n){var t=n.copy;return n.padding=n.paddingOuter,delete n.paddingInner,n.copy=function(){return e(t())},n}(D().paddingInner(1))}};for(var T in L)Y(T,L[T]);const C=["clamp","base","constant","exponent"];function z(e){for(var n=e.length/6|0,t=new Array(n),r=0;r<n;)t[r]="#"+e.slice(6*r,6*++r);return t}var A=z("1f77b4aec7e8ff7f0effbb782ca02c98df8ad62728ff98969467bdc5b0d58c564bc49c94e377c2f7b6d27f7f7fc7c7c7bcbd22dbdb8d17becf9edae5"),Q=z("393b795254a36b6ecf9c9ede6379398ca252b5cf6bcedb9c8c6d31bd9e39e7ba52e7cb94843c39ad494ad6616be7969c7b4173a55194ce6dbdde9ed6"),W=z("3182bd6baed69ecae1c6dbefe6550dfd8d3cfdae6bfdd0a231a35474c476a1d99bc7e9c0756bb19e9ac8bcbddcdadaeb636363969696bdbdbdd9d9d9"),E=z("4c78a8f58518e4575672b7b254a24beeca3bb279a2ff9da69d755dbab0ac"),F=z("4c78a89ecae9f58518ffbf7954a24b88d27ab79a20f2cf5b43989483bcb6e45756ff9d9879706ebab0acd67195fcbfd2b279a2d6a5c99e765fd8b5a5"),j=new Array(3).concat("67a9cff7f7f7f1a340","0571b092c5defdb863e66101","0571b092c5def7f7f7fdb863e66101","2166ac67a9cfd1e5f0fee0b6f1a340b35806","2166ac67a9cfd1e5f0f7f7f7fee0b6f1a340b35806","2166ac4393c392c5ded1e5f0fee0b6fdb863e08214b35806","2166ac4393c392c5ded1e5f0f7f7f7fee0b6fdb863e08214b35806","0530612166ac4393c392c5ded1e5f0fee0b6fdb863e08214b358067f3b08","0530612166ac4393c392c5ded1e5f0f7f7f7fee0b6fdb863e08214b358067f3b08").map(z),U={blueorange:j},H={category10:c.schemeCategory10,accent:c.schemeAccent,dark2:c.schemeDark2,paired:c.schemePaired,pastel1:c.schemePastel1,pastel2:c.schemePastel2,set1:c.schemeSet1,set2:c.schemeSet2,set3:c.schemeSet3,category20:A,category20b:Q,category20c:W,tableau10:E,tableau20:F,viridis:c.interpolateViridis,magma:c.interpolateMagma,inferno:c.interpolateInferno,plasma:c.interpolatePlasma,rainbow:c.interpolateRainbow,sinebow:c.interpolateSinebow,blueorange:i.interpolateRgbBasis(a.peek(j))};function V(e,n){H[e]=c["interpolate"+n],U[e]=c["scheme"+n]}V("blues","Blues"),V("greens","Greens"),V("greys","Greys"),V("purples","Purples"),V("reds","Reds"),V("oranges","Oranges"),V("brownbluegreen","BrBG"),V("purplegreen","PRGn"),V("pinkyellowgreen","PiYG"),V("purpleorange","PuOr"),V("redblue","RdBu"),V("redgrey","RdGy"),V("redyellowblue","RdYlBu"),V("redyellowgreen","RdYlGn"),V("spectral","Spectral"),V("bluegreen","BuGn"),V("bluepurple","BuPu"),V("greenblue","GnBu"),V("orangered","OrRd"),V("purplebluegreen","PuBuGn"),V("purpleblue","PuBu"),V("purplered","PuRd"),V("redpurple","RdPu"),V("yellowgreenblue","YlGnBu"),V("yellowgreen","YlGn"),V("yelloworangebrown","YlOrBr"),V("yelloworangered","YlOrRd"),e.scaleImplicit=r.scaleImplicit,e.bandSpace=u,e.timeInterval=function(e,n){const t=n===p?x:k;return t.hasOwnProperty(e)&&t[e]},e.Identity=o,e.Linear=l,e.Log=d,e.Pow=s,e.Sqrt=f,e.Symlog=g,e.Time=b,e.UTC=p,e.Sequential=m,e.Diverging=h,e.Quantile=v,e.Quantize=y,e.Threshold=w,e.BinOrdinal=R,e.Ordinal=S,e.Band=q,e.Point=P,e.isValidScaleType=function(e){switch(e){case o:case l:case d:case s:case f:case g:case b:case p:case m:case v:case y:case w:case S:case P:case q:case R:return!0}return!1},e.isTemporal=function(e){return e===b||e===p},e.isBinned=M,e.isQuantile=function(e){return e===v},e.isSequential=O,e.isDiverging=B,e.isInterpolating=function(e){return O(e)||B(e)},e.isContinuous=function(e){switch(e){case l:case d:case s:case f:case g:case b:case p:case m:return!0}return!1},e.isLogarithmic=function(e){return e===d||e.endsWith("-log")},e.isDiscrete=function(e){return M(e)||e===S||e===q||e===P},e.isDiscretizing=function(e){return M(e)||e===v||e===y||e===w},e.scale=Y,e.interpolate=function(e,n){var t=i[function(e){return"interpolate"+e.toLowerCase().split("-").map(function(e){return e[0].toUpperCase()+e.slice(1)}).join("")}(e)];return null!=n&&t&&t.gamma?t.gamma(n):t},e.interpolateRange=function(e,n){var t=n[0],r=a.peek(n)-t;return function(n){return e(t+n*r)}},e.scaleCopy=function(e){const n=e.type,t=e.copy();return t.type=n,t},e.scaleFraction=function(e,n,t){var r,i,c,u=t-n;return u&&isFinite(u)?(r=(i=e.type).indexOf("-"),i=r<0?i:i.slice(r+1),c=Y(i)().domain([n,t]).range([0,1]),C.forEach(n=>e[n]?c[n](e[n]()):0),c):a.constant(.5)},e.scheme=function(e,n){if(arguments.length>1)return H[e]=n,this;var t=e.split("-");return e=t[0],(t=+t[1]+1)&&U.hasOwnProperty(e)?U[e][t-1]:!t&&H.hasOwnProperty(e)?H[e]:void 0},e.schemeDiscretized=function(e,n,t){return arguments.length>1?(U[e]=n,H[e]=t||i.interpolateRgbBasis(a.peek(n)),this):U.hasOwnProperty(e)?U[e]:void 0},Object.defineProperty(e,"__esModule",{value:!0})}); | ||
!function(e,a){"object"==typeof exports&&"undefined"!=typeof module?a(exports,require("d3-time"),require("d3-array"),require("d3-scale"),require("vega-util"),require("d3-interpolate")):"function"==typeof define&&define.amd?define(["exports","d3-time","d3-array","d3-scale","vega-util","d3-interpolate"],a):a((e=e||self).vega={},e.d3,e.d3,e.d3,e.vega,e.d3)}(this,function(e,a,c,f,d,n){"use strict";function b(e,a,c){var f=e-a+2*c;return e?f>0?f:1:0}const t="identity",r="linear",i="log",u="pow",o="sqrt",l="symlog",s="time",g="utc",p="sequential",m="diverging",h="quantile",v="quantize",y="threshold",w="ordinal",q="point",M="band",S="bin-ordinal";function k(e){return e===S}function O(e){return e&&e.startsWith(p)}function G(e){return e&&e.startsWith(m)}var B={millisecond:a.timeMillisecond,second:a.timeSecond,minute:a.timeMinute,hour:a.timeHour,day:a.timeDay,week:a.timeWeek,month:a.timeMonth,year:a.timeYear},R={millisecond:a.utcMillisecond,second:a.utcSecond,minute:a.utcMinute,hour:a.utcHour,day:a.utcDay,week:a.utcWeek,month:a.utcMonth,year:a.utcYear};function x(){var e,a,d=f.scaleOrdinal().unknown(void 0),n=d.domain,t=d.range,r=[0,1],i=!1,u=0,o=0,l=.5;function s(){var f=n().length,d=r[1]<r[0],s=r[d-0],g=r[1-d],p=b(f,u,o);e=(g-s)/(p||1),i&&(e=Math.floor(e)),s+=(g-s-e*(f-u))*l,a=e*(1-u),i&&(s=Math.round(s),a=Math.round(a));var m=c.range(f).map(function(a){return s+e*a});return t(d?m.reverse():m)}return delete d.unknown,d.domain=function(e){return arguments.length?(n(e),s()):n()},d.range=function(e){return arguments.length?(r=[+e[0],+e[1]],s()):r.slice()},d.rangeRound=function(e){return r=[+e[0],+e[1]],i=!0,s()},d.bandwidth=function(){return a},d.step=function(){return e},d.round=function(e){return arguments.length?(i=!!e,s()):i},d.padding=function(e){return arguments.length?(o=Math.max(0,Math.min(1,e)),u=o,s()):u},d.paddingInner=function(e){return arguments.length?(u=Math.max(0,Math.min(1,e)),s()):u},d.paddingOuter=function(e){return arguments.length?(o=Math.max(0,Math.min(1,e)),s()):o},d.align=function(e){return arguments.length?(l=Math.max(0,Math.min(1,e)),s()):l},d.invertRange=function(e){if(null!=e[0]&&null!=e[1]){var f,d,b,i=+e[0],u=+e[1],o=r[1]<r[0],l=o?t().reverse():t(),s=l.length-1;if(i==i&&u==u&&(u<i&&(b=i,i=u,u=b),!(u<l[0]||i>r[1-o])))return f=Math.max(0,c.bisectRight(l,i)-1),d=i===u?f:c.bisectRight(l,u)-1,i-l[f]>a+1e-10&&++f,o&&(b=f,f=s-d,d=s-b),f>d?void 0:n().slice(f,d+1)}},d.invert=function(e){var a=d.invertRange([e,e]);return a?a[0]:a},d.copy=function(){return x().domain(n()).range(r).round(i).paddingInner(u).paddingOuter(o).align(l)},s()}var D=Array.prototype.map;var I=Array.prototype.slice;function P(e,a){return arguments.length>1?(L[e]=function(e,a){return function(){var c=a();return c.invertRange||(c.invertRange=c.invert?function(e){return function(a){var c,f=a[0],d=a[1];return d<f&&(c=f,f=d,d=c),[e.invert(f),e.invert(d)]}}(c):c.invertExtent?function(e){return function(a){var c,f,d,n,b=e.range(),t=a[0],r=a[1],i=-1;for(r<t&&(f=t,t=r,r=f),d=0,n=b.length;d<n;++d)b[d]>=t&&b[d]<=r&&(i<0&&(i=d),c=d);if(!(i<0))return t=e.invertExtent(b[i]),r=e.invertExtent(b[c]),[void 0===t[0]?t[1]:t[0],void 0===r[1]?r[0]:r[1]]}}(c):void 0),c.type=e,c}}(e,a),this):L.hasOwnProperty(e)?L[e]:void 0}var L={[t]:f.scaleIdentity,[r]:f.scaleLinear,[i]:f.scaleLog,[u]:f.scalePow,[o]:f.scaleSqrt,[l]:f.scaleSymlog,[s]:f.scaleTime,[g]:f.scaleUtc,[p]:f.scaleSequential,[p+"-"+r]:f.scaleSequential,[p+"-"+i]:f.scaleSequentialLog,[p+"-"+u]:f.scaleSequentialPow,[p+"-"+o]:f.scaleSequentialSqrt,[p+"-"+l]:f.scaleSequentialSymlog,[m+"-"+r]:f.scaleDiverging,[m+"-"+i]:f.scaleDivergingLog,[m+"-"+u]:f.scaleDivergingPow,[m+"-"+o]:f.scaleDivergingSqrt,[m+"-"+l]:f.scaleDivergingSymlog,[h]:f.scaleQuantile,[v]:f.scaleQuantize,[y]:f.scaleThreshold,[S]:function e(){var a=[],n=[];function b(e){return null==e||e!=e?void 0:n[(c.bisect(a,e)-1)%n.length]}return b.domain=function(e){return arguments.length?(a=function(e){return D.call(e,function(e){return+e})}(e),b):a.slice()},b.range=function(e){return arguments.length?(n=I.call(e),b):n.slice()},b.tickFormat=function(e,c){return f.tickFormat(a[0],d.peek(a),null==e?10:e,c)},b.copy=function(){return e().domain(b.domain()).range(b.range())},b},[w]:f.scaleOrdinal,[M]:x,[q]:function(){return function e(a){var c=a.copy;return a.padding=a.paddingOuter,delete a.paddingInner,a.copy=function(){return e(c())},a}(x().paddingInner(1))}};for(var T in L)P(T,L[T]);const C=["clamp","base","constant","exponent"];function z(e,a,c){return n.piecewise(Q(a||"rgb",c),e)}function Q(e,a){var c=n[function(e){return"interpolate"+e.toLowerCase().split("-").map(function(e){return e[0].toUpperCase()+e.slice(1)}).join("")}(e)];return null!=a&&c&&c.gamma?c.gamma(a):c}function W(e){for(var a=e.length/6|0,c=new Array(a),f=0;f<a;)c[f]="#"+e.slice(6*f,6*++f);return c}function Y(e,a){for(let c in e)E(c,a(e[c]))}const A={};function E(e,a){return e=e&&e.toLowerCase(),arguments.length>1?(A[e]=a,this):A[e]}Y({category10:"1f77b4ff7f0e2ca02cd627289467bd8c564be377c27f7f7fbcbd2217becf",category20:"1f77b4aec7e8ff7f0effbb782ca02c98df8ad62728ff98969467bdc5b0d58c564bc49c94e377c2f7b6d27f7f7fc7c7c7bcbd22dbdb8d17becf9edae5",category20b:"393b795254a36b6ecf9c9ede6379398ca252b5cf6bcedb9c8c6d31bd9e39e7ba52e7cb94843c39ad494ad6616be7969c7b4173a55194ce6dbdde9ed6",category20c:"3182bd6baed69ecae1c6dbefe6550dfd8d3cfdae6bfdd0a231a35474c476a1d99bc7e9c0756bb19e9ac8bcbddcdadaeb636363969696bdbdbdd9d9d9",tableau10:"4c78a8f58518e4575672b7b254a24beeca3bb279a2ff9da69d755dbab0ac",tableau20:"4c78a89ecae9f58518ffbf7954a24b88d27ab79a20f2cf5b43989483bcb6e45756ff9d9879706ebab0acd67195fcbfd2b279a2d6a5c99e765fd8b5a5",accent:"7fc97fbeaed4fdc086ffff99386cb0f0027fbf5b17666666",dark2:"1b9e77d95f027570b3e7298a66a61ee6ab02a6761d666666",paired:"a6cee31f78b4b2df8a33a02cfb9a99e31a1cfdbf6fff7f00cab2d66a3d9affff99b15928",pastel1:"fbb4aeb3cde3ccebc5decbe4fed9a6ffffcce5d8bdfddaecf2f2f2",pastel2:"b3e2cdfdcdaccbd5e8f4cae4e6f5c9fff2aef1e2cccccccc",set1:"e41a1c377eb84daf4a984ea3ff7f00ffff33a65628f781bf999999",set2:"66c2a5fc8d628da0cbe78ac3a6d854ffd92fe5c494b3b3b3",set3:"8dd3c7ffffb3bebadafb807280b1d3fdb462b3de69fccde5d9d9d9bc80bdccebc5ffed6f"},W),Y({blues:"cfe1f2bed8eca8cee58fc1de74b2d75ba3cf4592c63181bd206fb2125ca40a4a90",greens:"d3eecdc0e6baabdda594d3917bc77d60ba6c46ab5e329a512089430e7735036429",greys:"e2e2e2d4d4d4c4c4c4b1b1b19d9d9d8888887575756262624d4d4d3535351e1e1e",oranges:"fdd8b3fdc998fdb87bfda55efc9244f87f2cf06b18e4580bd14904b93d029f3303",purples:"e2e1efd4d4e8c4c5e0b4b3d6a3a0cc928ec3827cb97566ae684ea25c3696501f8c",reds:"fdc9b4fcb49afc9e80fc8767fa7051f6573fec3f2fdc2a25c81b1db21218970b13",blueGreen:"d5efedc1e8e0a7ddd18bd2be70c6a958ba9144ad77319c5d2089460e7736036429",bluePurple:"ccddecbad0e4a8c2dd9ab0d4919cc98d85be8b6db28a55a6873c99822287730f71",greenBlue:"d3eecec5e8c3b1e1bb9bd8bb82cec269c2ca51b2cd3c9fc7288abd1675b10b60a1",orangeRed:"fddcaffdcf9bfdc18afdad77fb9562f67d53ee6545e24932d32d1ebf130da70403",purpleBlue:"dbdaebc8cee4b1c3de97b7d87bacd15b9fc93a90c01e7fb70b70ab056199045281",purpleBlueGreen:"dbd8eac8cee4b0c3de93b7d872acd1549fc83892bb1c88a3097f8702736b016353",purpleRed:"dcc9e2d3b3d7ce9eccd186c0da6bb2e14da0e23189d91e6fc61159ab07498f023a",redPurple:"fccfccfcbec0faa9b8f98faff571a5ec539ddb3695c41b8aa908808d0179700174",yellowGreen:"e4f4acd1eca0b9e2949ed68880c97c62bb6e47aa5e3297502083440e723b036034",yellowOrangeBrown:"feeaa1fedd84fecc63feb746fca031f68921eb7215db5e0bc54c05ab3d038f3204",yellowOrangeRed:"fee087fed16ffebd59fea849fd903efc7335f9522bee3423de1b20ca0b22af0225",blueOrange:"134b852f78b35da2cb9dcae1d2e5eff2f0ebfce0bafbbf74e8932fc5690d994a07",brownBlueGreen:"704108a0651ac79548e3c78af3e6c6eef1eac9e9e48ed1c74da79e187a72025147",purpleGreen:"5b1667834792a67fb6c9aed3e6d6e8eff0efd9efd5aedda971bb75368e490e5e29",purpleOrange:"4114696647968f83b7b9b4d6dadbebf3eeeafce0bafbbf74e8932fc5690d994a07",redBlue:"8c0d25bf363adf745ef4ae91fbdbc9f2efeed2e5ef9dcae15da2cb2f78b3134b85",redGrey:"8c0d25bf363adf745ef4ae91fcdccbfaf4f1e2e2e2c0c0c0969696646464343434",yellowGreenBlue:"eff9bddbf1b4bde5b594d5b969c5be45b4c22c9ec02182b82163aa23479c1c3185",redYellowBlue:"a50026d4322cf16e43fcac64fedd90faf8c1dcf1ecabd6e875abd04a74b4313695",redYellowGreen:"a50026d4322cf16e43fcac63fedd8df9f7aed7ee8ea4d86e64bc6122964f006837",pinkYellowGreen:"8e0152c0267edd72adf0b3d6faddedf5f3efe1f2cab6de8780bb474f9125276419",spectral:"9e0142d13c4bf0704afcac63fedd8dfbf8b0e0f3a1a9dda269bda94288b55e4fa2",viridis:"440154470e61481a6c482575472f7d443a834144873d4e8a39568c35608d31688e2d708e2a788e27818e23888e21918d1f988b1fa08822a8842ab07f35b77943bf7154c56866cc5d7ad1518fd744a5db36bcdf27d2e21be9e51afde725",magma:"0000040404130b0924150e3720114b2c11603b0f704a107957157e651a80721f817f24828c29819a2e80a8327db6377ac43c75d1426fde4968e95462f1605df76f5cfa7f5efc8f65fe9f6dfeaf78febf84fece91fddea0fcedaffcfdbf",inferno:"0000040403130c0826170c3b240c4f330a5f420a68500d6c5d126e6b176e781c6d86216b932667a12b62ae305cbb3755c73e4cd24644dd513ae65c30ed6925f3771af8850ffb9506fca50afcb519fac62df6d645f2e661f3f484fcffa4",plasma:"0d088723069033059742039d5002a25d01a66a00a87801a88405a7900da49c179ea72198b12a90ba3488c33d80cb4779d35171da5a69e16462e76e5bed7953f2834cf68f44fa9a3dfca636fdb32ffec029fcce25f9dc24f5ea27f0f921",rainbow:"6e40aa883eb1a43db3bf3cafd83fa4ee4395fe4b83ff576eff6659ff7847ff8c38f3a130e2b72fcfcc36bee044aff05b8ff4576ff65b52f6673af27828ea8d1ddfa319d0b81cbecb23abd82f96e03d82e14c6edb5a5dd0664dbf6e40aa",sinebow:"ff4040fc582af47218e78d0bd5a703bfbf00a7d5038de70b72f41858fc2a40ff402afc5818f4720be78d03d5a700bfbf03a7d50b8de71872f42a58fc4040ff582afc7218f48d0be7a703d5bf00bfd503a7e70b8df41872fc2a58ff4040",browns:"eedbbdecca96e9b97ae4a865dc9856d18954c7784cc0673fb85536ad44339f3632",tealBlues:"bce4d89dd3d181c3cb65b3c245a2b9368fae347da0306a932c5985",teals:"bbdfdfa2d4d58ac9c975bcbb61b0af4da5a43799982b8b8c1e7f7f127273006667",warmGreys:"dcd4d0cec5c1c0b8b4b3aaa7a59c9998908c8b827f7e7673726866665c5a59504e",goldGreen:"f4d166d5ca60b6c35c98bb597cb25760a6564b9c533f8f4f33834a257740146c36",goldOrange:"f4d166f8be5cf8aa4cf5983bf3852aef701be2621fd65322c54923b142239e3a26",goldRed:"f4d166f6be59f9aa51fc964ef6834bee734ae56249db5247cf4244c43141b71d3e",lightGreyRed:"efe9e6e1dad7d5cbc8c8bdb9bbaea9cd967ddc7b43e15f19df4011dc000b",lightGreyTeal:"e4eaead6dcddc8ced2b7c2c7a6b4bc64b0bf22a6c32295c11f85be1876bc",lightMulti:"e0f1f2c4e9d0b0de9fd0e181f6e072f6c053f3993ef77440ef4a3c",lightOrange:"f2e7daf7d5baf9c499fab184fa9c73f68967ef7860e8645bde515bd43d5b",lightTealBlue:"e3e9e0c0dccf9aceca7abfc859afc0389fb9328dad2f7ca0276b95255988",darkBlue:"3232322d46681a5c930074af008cbf05a7ce25c0dd38daed50f3faffffff",darkGold:"3c3c3c584b37725e348c7631ae8b2bcfa424ecc31ef9de30fff184ffffff",darkGreen:"3a3a3a215748006f4d048942489e4276b340a6c63dd2d836ffeb2cffffaa",darkMulti:"3737371f5287197d8c29a86995ce3fffe800ffffff",darkRed:"3434347036339e3c38cc4037e75d1eec8620eeab29f0ce32ffeb2c"},e=>z(W(e))),e.scaleImplicit=f.scaleImplicit,e.bandSpace=b,e.timeInterval=function(e,a){const c=a===g?R:B;return c.hasOwnProperty(e)&&c[e]},e.Identity=t,e.Linear=r,e.Log=i,e.Pow=u,e.Sqrt=o,e.Symlog=l,e.Time=s,e.UTC=g,e.Sequential=p,e.Diverging=m,e.Quantile=h,e.Quantize=v,e.Threshold=y,e.BinOrdinal=S,e.Ordinal=w,e.Band=M,e.Point=q,e.isValidScaleType=function(e){switch(e){case t:case r:case i:case u:case o:case l:case s:case g:case p:case h:case v:case y:case w:case q:case M:case S:return!0}return!1},e.isTemporal=function(e){return e===s||e===g},e.isBinned=k,e.isQuantile=function(e){return e===h},e.isSequential=O,e.isDiverging=G,e.isInterpolating=function(e){return O(e)||G(e)},e.isContinuous=function(e){switch(e){case r:case i:case u:case o:case l:case s:case g:case p:return!0}return!1},e.isLogarithmic=function(e){return e===i||e.endsWith("-log")},e.isDiscrete=function(e){return k(e)||e===w||e===M||e===q},e.isDiscretizing=function(e){return k(e)||e===h||e===v||e===y},e.interpolate=Q,e.interpolateColors=z,e.interpolateRange=function(e,a){var c=a[0],f=d.peek(a)-c;return function(a){return e(c+a*f)}},e.scaleCopy=function(e){const a=e.type,c=e.copy();return c.type=a,c},e.scaleFraction=function(e,a,c){var f,n,b,t=c-a;return t&&isFinite(t)?(f=(n=e.type).indexOf("-"),n=f<0?n:n.slice(f+1),b=P(n)().domain([a,c]).range([0,1]),C.forEach(a=>e[a]?b[a](e[a]()):0),b):d.constant(.5)},e.quantizeInterpolator=function(e,a){for(var c=new Array(a),f=a+1,d=0;d<a;)c[d]=e(++d/f);return c},e.scale=P,e.scheme=E,Object.defineProperty(e,"__esModule",{value:!0})}); |
13
index.js
@@ -35,6 +35,15 @@ export {default as bandSpace} from './src/scales/bandSpace'; | ||
export { | ||
interpolate, | ||
interpolateColors, | ||
interpolateRange, | ||
scaleCopy, | ||
scaleFraction, | ||
quantizeInterpolator | ||
} from './src/interpolate'; | ||
export {default as scale} from './src/scales'; | ||
export {interpolate, interpolateRange, scaleCopy, scaleFraction} from './src/interpolate'; | ||
export {scheme, schemeDiscretized} from './src/schemes'; | ||
export {scheme} from './src/schemes'; | ||
export {scaleImplicit} from 'd3-scale'; |
{ | ||
"name": "vega-scale", | ||
"version": "3.0.0", | ||
"version": "4.0.0", | ||
"description": "Scales and color schemes for visual encoding.", | ||
@@ -17,3 +17,3 @@ "keywords": [ | ||
"scripts": { | ||
"rollup": "rollup -g d3-array:d3,d3-interpolate:d3,d3-scale:d3,d3-scale-chromatic:d3,d3-time:d3,vega-util:vega -f umd -n vega -o build/vega-scale.js -- index.js", | ||
"rollup": "rollup -g d3-array:d3,d3-interpolate:d3,d3-scale:d3:d3,d3-time:d3,vega-util:vega -f umd -n vega -o build/vega-scale.js -- index.js", | ||
"prebuild": "rimraf build && mkdir build", | ||
@@ -31,3 +31,2 @@ "build": "yarn rollup", | ||
"d3-scale": "^2.2.2", | ||
"d3-scale-chromatic": "^1.3.3", | ||
"d3-time": "^1.0.11", | ||
@@ -34,0 +33,0 @@ "vega-util": "^1.8.0" |
@@ -55,8 +55,2 @@ # vega-scale | ||
<a name="schemeDiscretized" href="#schemeDiscretized">#</a> | ||
vega.<b>schemeDiscretized</b>(<i>name</i>[, <i>schemes</i>, <i>interpolator</i>]) | ||
[<>](https://github.com/vega/vega/blob/master/packages/vega-scale/src/schemes.js "Source") | ||
Registry function for adding and accessing discretized color schemes, consisting of an array of color schemes for specific value counts. The *name* argument is a String indicating the name of the color scheme. If the *schemes* argument is not specified, this method returns the matching array of color schemes value in the registry, or `null` if not found. If the *schemes* argument is provided, it must be an array of valid color arrays, with non-null entries at indices for each supported value count. For example, the array at index 3 should be a 3-color array. The optional *interpolator* argument provides a continuous color [interpolator](https://github.com/d3/d3-scale#sequential_interpolator) to use when a specific item count is not provided or undefined. If the *interpolator* argument is not provided, an interpolator will be automatically created using basis spline interpolation in the RGB color space for the last (largest) color array in *schemes*. | ||
<a name="interpolate" href="#interpolate">#</a> | ||
@@ -73,2 +67,8 @@ vega.<b>interpolate</b>(<i>name</i>[, <i>gamma</i>]) | ||
<a name="interpolateColors" href="#interpolateColors">#</a> | ||
vega.<b>interpolateColors</b>(<i>colors</i>[, <i>type</i>, <i>gamma</i>]) | ||
[<>](https://github.com/vega/vega/blob/master/packages/vega-scale/src/interpolate.js "Source") | ||
Given an array of discrete *colors*, returns an interpolator function that maps the domain [0, 1] to a continuous spectrum of colors using piecewise linear interpolation. The optional parameters *type* and *gamma* specify an interpolation type (default `"rgb"`) and gamma correction (default `1`) supported by the [interpolate](#interpolate) method. | ||
<a name="interpolateRange" href="#interpolateRange">#</a> | ||
@@ -84,3 +84,3 @@ vega.<b>interpolateRange</b>(<i>interpolator</i>, <i>range</i>]) | ||
number(0.5); // 5 | ||
number(1); // 1 | ||
number(1); // 10 | ||
@@ -94,11 +94,11 @@ var range = vega.interpolateRange(number, [0.2, 0.8]); | ||
<a name="timeInterval" href="#timeInterval">#</a> | ||
vega.<b>timeInterval</b>(<i>unit</i>) | ||
vega.<b>timeInterval</b>(<i>unit</i>[, <i>type</i>]) | ||
[<>](https://github.com/vega/vega/blob/master/packages/vega-scale/src/timeInterval.js "Source") | ||
Given a string _unit_, return a corresponding [D3 time interval](https://github.com/d3/d3-time#_interval) function. Valid _unit_ strings are: `"millisecond"`, `"second"`, `"minute"`, `"hour"`, `"day"`, `"week"`, `"month"`, and `"year"`. | ||
Given a string _unit_, return a corresponding [D3 time interval](https://github.com/d3/d3-time#_interval) function. Valid _unit_ strings are: `"millisecond"`, `"second"`, `"minute"`, `"hour"`, `"day"`, `"week"`, `"month"`, and `"year"`. The optional _type_ indicates the time zone to use, either `"time"` (default, for local time) or `"utc"` (for [Coordinated Universal Time](https://en.wikipedia.org/wiki/Coordinated_Universal_Time)). | ||
<a name="utcInterval" href="#utcInterval">#</a> | ||
vega.<b>utcInterval</b>(<i>unit</i>) | ||
[<>](https://github.com/vega/vega/blob/master/packages/vega-scale/src/timeInterval.js "Source") | ||
<a name="quantizeInterpolator" href="#quantizeInterpolator">#</a> | ||
vega.<b>quantizeInterpolator</b>(<i>interpolator</i>, <i>count</i>]) | ||
[<>](https://github.com/vega/vega/blob/master/packages/vega-scale/src/interpolate.js "Source") | ||
Given a string _unit_, return a corresponding UTC-variant of a [D3 time interval](https://github.com/d3/d3-time#_interval) function. Valid _unit_ strings are: `"millisecond"`, `"second"`, `"minute"`, `"hour"`, `"day"`, `"week"`, `"month"`, and `"year"`. | ||
Given an *interpolator* function, returns *count* evenly-spaced samples. This method is particularly useful for generating a discrete color scheme from a continuous color interpolator. |
@@ -13,2 +13,13 @@ import getScale from './scales'; | ||
export function interpolateColors(colors, type, gamma) { | ||
return $.piecewise(interpolate(type || 'rgb', gamma), colors); | ||
} | ||
export function quantizeInterpolator(interpolator, count) { | ||
var samples = new Array(count), | ||
n = count + 1; | ||
for (var i = 0; i < count;) samples[i] = interpolator(++i / n); | ||
return samples; | ||
} | ||
export function scaleCopy(scale) { | ||
@@ -15,0 +26,0 @@ const t = scale.type, |
@@ -1,37 +0,78 @@ | ||
function colors(specifier) { | ||
var n = specifier.length / 6 | 0, colors = new Array(n), i = 0; | ||
while (i < n) colors[i] = "#" + specifier.slice(i * 6, ++i * 6); | ||
return colors; | ||
} | ||
export const continuous = { | ||
blues: 'cfe1f2bed8eca8cee58fc1de74b2d75ba3cf4592c63181bd206fb2125ca40a4a90', | ||
greens: 'd3eecdc0e6baabdda594d3917bc77d60ba6c46ab5e329a512089430e7735036429', | ||
greys: 'e2e2e2d4d4d4c4c4c4b1b1b19d9d9d8888887575756262624d4d4d3535351e1e1e', | ||
oranges: 'fdd8b3fdc998fdb87bfda55efc9244f87f2cf06b18e4580bd14904b93d029f3303', | ||
purples: 'e2e1efd4d4e8c4c5e0b4b3d6a3a0cc928ec3827cb97566ae684ea25c3696501f8c', | ||
reds: 'fdc9b4fcb49afc9e80fc8767fa7051f6573fec3f2fdc2a25c81b1db21218970b13', | ||
export var category20 = colors( | ||
'1f77b4aec7e8ff7f0effbb782ca02c98df8ad62728ff98969467bdc5b0d58c564bc49c94e377c2f7b6d27f7f7fc7c7c7bcbd22dbdb8d17becf9edae5' | ||
); | ||
blueGreen: 'd5efedc1e8e0a7ddd18bd2be70c6a958ba9144ad77319c5d2089460e7736036429', | ||
bluePurple: 'ccddecbad0e4a8c2dd9ab0d4919cc98d85be8b6db28a55a6873c99822287730f71', | ||
greenBlue: 'd3eecec5e8c3b1e1bb9bd8bb82cec269c2ca51b2cd3c9fc7288abd1675b10b60a1', | ||
orangeRed: 'fddcaffdcf9bfdc18afdad77fb9562f67d53ee6545e24932d32d1ebf130da70403', | ||
purpleBlue: 'dbdaebc8cee4b1c3de97b7d87bacd15b9fc93a90c01e7fb70b70ab056199045281', | ||
purpleBlueGreen: 'dbd8eac8cee4b0c3de93b7d872acd1549fc83892bb1c88a3097f8702736b016353', | ||
purpleRed: 'dcc9e2d3b3d7ce9eccd186c0da6bb2e14da0e23189d91e6fc61159ab07498f023a', | ||
redPurple: 'fccfccfcbec0faa9b8f98faff571a5ec539ddb3695c41b8aa908808d0179700174', | ||
yellowGreen: 'e4f4acd1eca0b9e2949ed68880c97c62bb6e47aa5e3297502083440e723b036034', | ||
yellowOrangeBrown: 'feeaa1fedd84fecc63feb746fca031f68921eb7215db5e0bc54c05ab3d038f3204', | ||
yellowOrangeRed: 'fee087fed16ffebd59fea849fd903efc7335f9522bee3423de1b20ca0b22af0225', | ||
export var category20b = colors( | ||
'393b795254a36b6ecf9c9ede6379398ca252b5cf6bcedb9c8c6d31bd9e39e7ba52e7cb94843c39ad494ad6616be7969c7b4173a55194ce6dbdde9ed6' | ||
); | ||
blueOrange: '134b852f78b35da2cb9dcae1d2e5eff2f0ebfce0bafbbf74e8932fc5690d994a07', | ||
brownBlueGreen: '704108a0651ac79548e3c78af3e6c6eef1eac9e9e48ed1c74da79e187a72025147', | ||
purpleGreen: '5b1667834792a67fb6c9aed3e6d6e8eff0efd9efd5aedda971bb75368e490e5e29', | ||
purpleOrange: '4114696647968f83b7b9b4d6dadbebf3eeeafce0bafbbf74e8932fc5690d994a07', | ||
redBlue: '8c0d25bf363adf745ef4ae91fbdbc9f2efeed2e5ef9dcae15da2cb2f78b3134b85', | ||
redGrey: '8c0d25bf363adf745ef4ae91fcdccbfaf4f1e2e2e2c0c0c0969696646464343434', | ||
yellowGreenBlue: 'eff9bddbf1b4bde5b594d5b969c5be45b4c22c9ec02182b82163aa23479c1c3185', | ||
redYellowBlue: 'a50026d4322cf16e43fcac64fedd90faf8c1dcf1ecabd6e875abd04a74b4313695', | ||
redYellowGreen: 'a50026d4322cf16e43fcac63fedd8df9f7aed7ee8ea4d86e64bc6122964f006837', | ||
pinkYellowGreen: '8e0152c0267edd72adf0b3d6faddedf5f3efe1f2cab6de8780bb474f9125276419', | ||
spectral: '9e0142d13c4bf0704afcac63fedd8dfbf8b0e0f3a1a9dda269bda94288b55e4fa2', | ||
export var category20c = colors( | ||
'3182bd6baed69ecae1c6dbefe6550dfd8d3cfdae6bfdd0a231a35474c476a1d99bc7e9c0756bb19e9ac8bcbddcdadaeb636363969696bdbdbdd9d9d9' | ||
); | ||
viridis: '440154470e61481a6c482575472f7d443a834144873d4e8a39568c35608d31688e2d708e2a788e27818e23888e21918d1f988b1fa08822a8842ab07f35b77943bf7154c56866cc5d7ad1518fd744a5db36bcdf27d2e21be9e51afde725', | ||
magma: '0000040404130b0924150e3720114b2c11603b0f704a107957157e651a80721f817f24828c29819a2e80a8327db6377ac43c75d1426fde4968e95462f1605df76f5cfa7f5efc8f65fe9f6dfeaf78febf84fece91fddea0fcedaffcfdbf', | ||
inferno: '0000040403130c0826170c3b240c4f330a5f420a68500d6c5d126e6b176e781c6d86216b932667a12b62ae305cbb3755c73e4cd24644dd513ae65c30ed6925f3771af8850ffb9506fca50afcb519fac62df6d645f2e661f3f484fcffa4', | ||
plasma: '0d088723069033059742039d5002a25d01a66a00a87801a88405a7900da49c179ea72198b12a90ba3488c33d80cb4779d35171da5a69e16462e76e5bed7953f2834cf68f44fa9a3dfca636fdb32ffec029fcce25f9dc24f5ea27f0f921', | ||
export var tableau10 = colors( | ||
'4c78a8f58518e4575672b7b254a24beeca3bb279a2ff9da69d755dbab0ac' | ||
); | ||
rainbow: '6e40aa883eb1a43db3bf3cafd83fa4ee4395fe4b83ff576eff6659ff7847ff8c38f3a130e2b72fcfcc36bee044aff05b8ff4576ff65b52f6673af27828ea8d1ddfa319d0b81cbecb23abd82f96e03d82e14c6edb5a5dd0664dbf6e40aa', | ||
sinebow: 'ff4040fc582af47218e78d0bd5a703bfbf00a7d5038de70b72f41858fc2a40ff402afc5818f4720be78d03d5a700bfbf03a7d50b8de71872f42a58fc4040ff582afc7218f48d0be7a703d5bf00bfd503a7e70b8df41872fc2a58ff4040', | ||
export var tableau20 = colors( | ||
'4c78a89ecae9f58518ffbf7954a24b88d27ab79a20f2cf5b43989483bcb6e45756ff9d9879706ebab0acd67195fcbfd2b279a2d6a5c99e765fd8b5a5' | ||
); | ||
browns: 'eedbbdecca96e9b97ae4a865dc9856d18954c7784cc0673fb85536ad44339f3632', | ||
tealBlues: 'bce4d89dd3d181c3cb65b3c245a2b9368fae347da0306a932c5985', | ||
teals: 'bbdfdfa2d4d58ac9c975bcbb61b0af4da5a43799982b8b8c1e7f7f127273006667', | ||
warmGreys: 'dcd4d0cec5c1c0b8b4b3aaa7a59c9998908c8b827f7e7673726866665c5a59504e', | ||
export var blueOrange = new Array(3).concat( | ||
"67a9cff7f7f7f1a340", | ||
"0571b092c5defdb863e66101", | ||
"0571b092c5def7f7f7fdb863e66101", | ||
"2166ac67a9cfd1e5f0fee0b6f1a340b35806", | ||
"2166ac67a9cfd1e5f0f7f7f7fee0b6f1a340b35806", | ||
"2166ac4393c392c5ded1e5f0fee0b6fdb863e08214b35806", | ||
"2166ac4393c392c5ded1e5f0f7f7f7fee0b6fdb863e08214b35806", | ||
"0530612166ac4393c392c5ded1e5f0fee0b6fdb863e08214b358067f3b08", | ||
"0530612166ac4393c392c5ded1e5f0f7f7f7fee0b6fdb863e08214b358067f3b08" | ||
).map(colors); | ||
goldGreen: 'f4d166d5ca60b6c35c98bb597cb25760a6564b9c533f8f4f33834a257740146c36', | ||
goldOrange: 'f4d166f8be5cf8aa4cf5983bf3852aef701be2621fd65322c54923b142239e3a26', | ||
goldRed: 'f4d166f6be59f9aa51fc964ef6834bee734ae56249db5247cf4244c43141b71d3e', | ||
lightGreyRed: 'efe9e6e1dad7d5cbc8c8bdb9bbaea9cd967ddc7b43e15f19df4011dc000b', | ||
lightGreyTeal: 'e4eaead6dcddc8ced2b7c2c7a6b4bc64b0bf22a6c32295c11f85be1876bc', | ||
lightMulti: 'e0f1f2c4e9d0b0de9fd0e181f6e072f6c053f3993ef77440ef4a3c', | ||
lightOrange: 'f2e7daf7d5baf9c499fab184fa9c73f68967ef7860e8645bde515bd43d5b', | ||
lightTealBlue: 'e3e9e0c0dccf9aceca7abfc859afc0389fb9328dad2f7ca0276b95255988', | ||
darkBlue: '3232322d46681a5c930074af008cbf05a7ce25c0dd38daed50f3faffffff', | ||
darkGold: '3c3c3c584b37725e348c7631ae8b2bcfa424ecc31ef9de30fff184ffffff', | ||
darkGreen: '3a3a3a215748006f4d048942489e4276b340a6c63dd2d836ffeb2cffffaa', | ||
darkMulti: '3737371f5287197d8c29a86995ce3fffe800ffffff', | ||
darkRed: '3434347036339e3c38cc4037e75d1eec8620eeab29f0ce32ffeb2c' | ||
}; | ||
export const discrete = { | ||
category10: '1f77b4ff7f0e2ca02cd627289467bd8c564be377c27f7f7fbcbd2217becf', | ||
category20: '1f77b4aec7e8ff7f0effbb782ca02c98df8ad62728ff98969467bdc5b0d58c564bc49c94e377c2f7b6d27f7f7fc7c7c7bcbd22dbdb8d17becf9edae5', | ||
category20b: '393b795254a36b6ecf9c9ede6379398ca252b5cf6bcedb9c8c6d31bd9e39e7ba52e7cb94843c39ad494ad6616be7969c7b4173a55194ce6dbdde9ed6', | ||
category20c: '3182bd6baed69ecae1c6dbefe6550dfd8d3cfdae6bfdd0a231a35474c476a1d99bc7e9c0756bb19e9ac8bcbddcdadaeb636363969696bdbdbdd9d9d9', | ||
tableau10: '4c78a8f58518e4575672b7b254a24beeca3bb279a2ff9da69d755dbab0ac', | ||
tableau20: '4c78a89ecae9f58518ffbf7954a24b88d27ab79a20f2cf5b43989483bcb6e45756ff9d9879706ebab0acd67195fcbfd2b279a2d6a5c99e765fd8b5a5', | ||
accent: '7fc97fbeaed4fdc086ffff99386cb0f0027fbf5b17666666', | ||
dark2: '1b9e77d95f027570b3e7298a66a61ee6ab02a6761d666666', | ||
paired: 'a6cee31f78b4b2df8a33a02cfb9a99e31a1cfdbf6fff7f00cab2d66a3d9affff99b15928', | ||
pastel1: 'fbb4aeb3cde3ccebc5decbe4fed9a6ffffcce5d8bdfddaecf2f2f2', | ||
pastel2: 'b3e2cdfdcdaccbd5e8f4cae4e6f5c9fff2aef1e2cccccccc', | ||
set1: 'e41a1c377eb84daf4a984ea3ff7f00ffff33a65628f781bf999999', | ||
set2: '66c2a5fc8d628da0cbe78ac3a6d854ffd92fe5c494b3b3b3', | ||
set3: '8dd3c7ffffb3bebadafb807280b1d3fdb462b3de69fccde5d9d9d9bc80bdccebc5ffed6f' | ||
}; |
@@ -1,110 +0,26 @@ | ||
import { | ||
category20, category20b, category20c, | ||
tableau10, tableau20, | ||
blueOrange | ||
} from './palettes'; | ||
import * as _ from 'd3-scale-chromatic'; | ||
import {interpolateRgbBasis} from 'd3-interpolate'; | ||
import {peek} from 'vega-util'; | ||
import {discrete, continuous} from './palettes'; | ||
import {interpolateColors} from './interpolate'; | ||
var discretized = { | ||
blueorange: blueOrange | ||
}; | ||
function colors(palette) { | ||
var n = palette.length / 6 | 0, c = new Array(n), i = 0; | ||
while (i < n) c[i] = '#' + palette.slice(i * 6, ++i * 6); | ||
return c; | ||
} | ||
var schemes = { | ||
// d3 categorical palettes | ||
category10: _.schemeCategory10, | ||
accent: _.schemeAccent, | ||
dark2: _.schemeDark2, | ||
paired: _.schemePaired, | ||
pastel1: _.schemePastel1, | ||
pastel2: _.schemePastel2, | ||
set1: _.schemeSet1, | ||
set2: _.schemeSet2, | ||
set3: _.schemeSet3, | ||
// additional categorical palettes | ||
category20: category20, | ||
category20b: category20b, | ||
category20c: category20c, | ||
tableau10: tableau10, | ||
tableau20: tableau20, | ||
// sequential multi-hue interpolators | ||
viridis: _.interpolateViridis, | ||
magma: _.interpolateMagma, | ||
inferno: _.interpolateInferno, | ||
plasma: _.interpolatePlasma, | ||
// cyclic interpolators | ||
rainbow: _.interpolateRainbow, | ||
sinebow: _.interpolateSinebow, | ||
// extended interpolators | ||
blueorange: interpolateRgbBasis(peek(blueOrange)) | ||
}; | ||
function add(name, suffix) { | ||
schemes[name] = _['interpolate' + suffix]; | ||
discretized[name] = _['scheme' + suffix]; | ||
function apply(_, f) { | ||
for (let k in _) scheme(k, f(_[k])); | ||
} | ||
// sequential single-hue | ||
add('blues', 'Blues'); | ||
add('greens', 'Greens'); | ||
add('greys', 'Greys'); | ||
add('purples', 'Purples'); | ||
add('reds', 'Reds'); | ||
add('oranges', 'Oranges'); | ||
const schemes = {}; | ||
apply(discrete, colors); | ||
apply(continuous, _ => interpolateColors(colors(_))); | ||
// diverging | ||
add('brownbluegreen', 'BrBG'); | ||
add('purplegreen', 'PRGn'); | ||
add('pinkyellowgreen', 'PiYG'); | ||
add('purpleorange', 'PuOr'); | ||
add('redblue', 'RdBu'); | ||
add('redgrey', 'RdGy'); | ||
add('redyellowblue', 'RdYlBu'); | ||
add('redyellowgreen', 'RdYlGn'); | ||
add('spectral', 'Spectral'); | ||
// sequential multi-hue | ||
add('bluegreen', 'BuGn'); | ||
add('bluepurple', 'BuPu'); | ||
add('greenblue', 'GnBu'); | ||
add('orangered', 'OrRd'); | ||
add('purplebluegreen', 'PuBuGn'); | ||
add('purpleblue', 'PuBu'); | ||
add('purplered', 'PuRd'); | ||
add('redpurple', 'RdPu'); | ||
add('yellowgreenblue', 'YlGnBu'); | ||
add('yellowgreen', 'YlGn'); | ||
add('yelloworangebrown', 'YlOrBr'); | ||
add('yelloworangered', 'YlOrRd'); | ||
export function scheme(name, scheme) { | ||
name = name && name.toLowerCase(); | ||
if (arguments.length > 1) { | ||
schemes[name] = scheme; | ||
return this; | ||
} else { | ||
return schemes[name]; | ||
} | ||
var part = name.split('-'); | ||
name = part[0]; | ||
part = +part[1] + 1; | ||
return part && discretized.hasOwnProperty(name) ? discretized[name][part-1] | ||
: !part && schemes.hasOwnProperty(name) ? schemes[name] | ||
: undefined; | ||
} | ||
export function schemeDiscretized(name, schemeArray, interpolator) { | ||
if (arguments.length > 1) { | ||
discretized[name] = schemeArray; | ||
schemes[name] = interpolator || interpolateRgbBasis(peek(schemeArray)); | ||
return this; | ||
} | ||
return discretized.hasOwnProperty(name) | ||
? discretized[name] | ||
: undefined; | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
61772
5
0
18
1215
- Removedd3-scale-chromatic@^1.3.3
- Removedd3-scale-chromatic@1.5.0(transitive)