@hpcc-js/api
Advanced tools
Comparing version 0.1.3 to 0.2.0
@@ -6,2 +6,13 @@ # Change Log | ||
<a name="0.2.0"></a> | ||
# [0.2.0](https://github.com/hpcc-systems/Visualization/compare/@hpcc-js/api@0.1.3...@hpcc-js/api@0.2.0) (2018-06-15) | ||
### Features | ||
* **chart:** Support runtime colour calculations ([820ff4f](https://github.com/hpcc-systems/Visualization/commit/820ff4f)) | ||
<a name="0.1.3"></a> | ||
@@ -8,0 +19,0 @@ ## [0.1.3](https://github.com/hpcc-systems/Visualization/compare/@hpcc-js/api@0.1.2...@hpcc-js/api@0.1.3) (2018-06-14) |
@@ -14,5 +14,536 @@ import { Palette, Widget, select, selection } from '@hpcc-js/common'; | ||
function define(constructor, factory, prototype) { | ||
constructor.prototype = factory.prototype = prototype; | ||
prototype.constructor = constructor; | ||
} | ||
function extend(parent, definition) { | ||
var prototype = Object.create(parent.prototype); | ||
for (var key in definition) prototype[key] = definition[key]; | ||
return prototype; | ||
} | ||
function Color() {} | ||
var darker = 0.7; | ||
var brighter = 1 / darker; | ||
var reI = "\\s*([+-]?\\d+)\\s*", | ||
reN = "\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)\\s*", | ||
reP = "\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)%\\s*", | ||
reHex3 = /^#([0-9a-f]{3})$/, | ||
reHex6 = /^#([0-9a-f]{6})$/, | ||
reRgbInteger = new RegExp("^rgb\\(" + [reI, reI, reI] + "\\)$"), | ||
reRgbPercent = new RegExp("^rgb\\(" + [reP, reP, reP] + "\\)$"), | ||
reRgbaInteger = new RegExp("^rgba\\(" + [reI, reI, reI, reN] + "\\)$"), | ||
reRgbaPercent = new RegExp("^rgba\\(" + [reP, reP, reP, reN] + "\\)$"), | ||
reHslPercent = new RegExp("^hsl\\(" + [reN, reP, reP] + "\\)$"), | ||
reHslaPercent = new RegExp("^hsla\\(" + [reN, reP, reP, reN] + "\\)$"); | ||
var named = { | ||
aliceblue: 0xf0f8ff, | ||
antiquewhite: 0xfaebd7, | ||
aqua: 0x00ffff, | ||
aquamarine: 0x7fffd4, | ||
azure: 0xf0ffff, | ||
beige: 0xf5f5dc, | ||
bisque: 0xffe4c4, | ||
black: 0x000000, | ||
blanchedalmond: 0xffebcd, | ||
blue: 0x0000ff, | ||
blueviolet: 0x8a2be2, | ||
brown: 0xa52a2a, | ||
burlywood: 0xdeb887, | ||
cadetblue: 0x5f9ea0, | ||
chartreuse: 0x7fff00, | ||
chocolate: 0xd2691e, | ||
coral: 0xff7f50, | ||
cornflowerblue: 0x6495ed, | ||
cornsilk: 0xfff8dc, | ||
crimson: 0xdc143c, | ||
cyan: 0x00ffff, | ||
darkblue: 0x00008b, | ||
darkcyan: 0x008b8b, | ||
darkgoldenrod: 0xb8860b, | ||
darkgray: 0xa9a9a9, | ||
darkgreen: 0x006400, | ||
darkgrey: 0xa9a9a9, | ||
darkkhaki: 0xbdb76b, | ||
darkmagenta: 0x8b008b, | ||
darkolivegreen: 0x556b2f, | ||
darkorange: 0xff8c00, | ||
darkorchid: 0x9932cc, | ||
darkred: 0x8b0000, | ||
darksalmon: 0xe9967a, | ||
darkseagreen: 0x8fbc8f, | ||
darkslateblue: 0x483d8b, | ||
darkslategray: 0x2f4f4f, | ||
darkslategrey: 0x2f4f4f, | ||
darkturquoise: 0x00ced1, | ||
darkviolet: 0x9400d3, | ||
deeppink: 0xff1493, | ||
deepskyblue: 0x00bfff, | ||
dimgray: 0x696969, | ||
dimgrey: 0x696969, | ||
dodgerblue: 0x1e90ff, | ||
firebrick: 0xb22222, | ||
floralwhite: 0xfffaf0, | ||
forestgreen: 0x228b22, | ||
fuchsia: 0xff00ff, | ||
gainsboro: 0xdcdcdc, | ||
ghostwhite: 0xf8f8ff, | ||
gold: 0xffd700, | ||
goldenrod: 0xdaa520, | ||
gray: 0x808080, | ||
green: 0x008000, | ||
greenyellow: 0xadff2f, | ||
grey: 0x808080, | ||
honeydew: 0xf0fff0, | ||
hotpink: 0xff69b4, | ||
indianred: 0xcd5c5c, | ||
indigo: 0x4b0082, | ||
ivory: 0xfffff0, | ||
khaki: 0xf0e68c, | ||
lavender: 0xe6e6fa, | ||
lavenderblush: 0xfff0f5, | ||
lawngreen: 0x7cfc00, | ||
lemonchiffon: 0xfffacd, | ||
lightblue: 0xadd8e6, | ||
lightcoral: 0xf08080, | ||
lightcyan: 0xe0ffff, | ||
lightgoldenrodyellow: 0xfafad2, | ||
lightgray: 0xd3d3d3, | ||
lightgreen: 0x90ee90, | ||
lightgrey: 0xd3d3d3, | ||
lightpink: 0xffb6c1, | ||
lightsalmon: 0xffa07a, | ||
lightseagreen: 0x20b2aa, | ||
lightskyblue: 0x87cefa, | ||
lightslategray: 0x778899, | ||
lightslategrey: 0x778899, | ||
lightsteelblue: 0xb0c4de, | ||
lightyellow: 0xffffe0, | ||
lime: 0x00ff00, | ||
limegreen: 0x32cd32, | ||
linen: 0xfaf0e6, | ||
magenta: 0xff00ff, | ||
maroon: 0x800000, | ||
mediumaquamarine: 0x66cdaa, | ||
mediumblue: 0x0000cd, | ||
mediumorchid: 0xba55d3, | ||
mediumpurple: 0x9370db, | ||
mediumseagreen: 0x3cb371, | ||
mediumslateblue: 0x7b68ee, | ||
mediumspringgreen: 0x00fa9a, | ||
mediumturquoise: 0x48d1cc, | ||
mediumvioletred: 0xc71585, | ||
midnightblue: 0x191970, | ||
mintcream: 0xf5fffa, | ||
mistyrose: 0xffe4e1, | ||
moccasin: 0xffe4b5, | ||
navajowhite: 0xffdead, | ||
navy: 0x000080, | ||
oldlace: 0xfdf5e6, | ||
olive: 0x808000, | ||
olivedrab: 0x6b8e23, | ||
orange: 0xffa500, | ||
orangered: 0xff4500, | ||
orchid: 0xda70d6, | ||
palegoldenrod: 0xeee8aa, | ||
palegreen: 0x98fb98, | ||
paleturquoise: 0xafeeee, | ||
palevioletred: 0xdb7093, | ||
papayawhip: 0xffefd5, | ||
peachpuff: 0xffdab9, | ||
peru: 0xcd853f, | ||
pink: 0xffc0cb, | ||
plum: 0xdda0dd, | ||
powderblue: 0xb0e0e6, | ||
purple: 0x800080, | ||
rebeccapurple: 0x663399, | ||
red: 0xff0000, | ||
rosybrown: 0xbc8f8f, | ||
royalblue: 0x4169e1, | ||
saddlebrown: 0x8b4513, | ||
salmon: 0xfa8072, | ||
sandybrown: 0xf4a460, | ||
seagreen: 0x2e8b57, | ||
seashell: 0xfff5ee, | ||
sienna: 0xa0522d, | ||
silver: 0xc0c0c0, | ||
skyblue: 0x87ceeb, | ||
slateblue: 0x6a5acd, | ||
slategray: 0x708090, | ||
slategrey: 0x708090, | ||
snow: 0xfffafa, | ||
springgreen: 0x00ff7f, | ||
steelblue: 0x4682b4, | ||
tan: 0xd2b48c, | ||
teal: 0x008080, | ||
thistle: 0xd8bfd8, | ||
tomato: 0xff6347, | ||
turquoise: 0x40e0d0, | ||
violet: 0xee82ee, | ||
wheat: 0xf5deb3, | ||
white: 0xffffff, | ||
whitesmoke: 0xf5f5f5, | ||
yellow: 0xffff00, | ||
yellowgreen: 0x9acd32 | ||
}; | ||
define(Color, color, { | ||
displayable: function() { | ||
return this.rgb().displayable(); | ||
}, | ||
hex: function() { | ||
return this.rgb().hex(); | ||
}, | ||
toString: function() { | ||
return this.rgb() + ""; | ||
} | ||
}); | ||
function color(format) { | ||
var m; | ||
format = (format + "").trim().toLowerCase(); | ||
return (m = reHex3.exec(format)) ? (m = parseInt(m[1], 16), new Rgb((m >> 8 & 0xf) | (m >> 4 & 0x0f0), (m >> 4 & 0xf) | (m & 0xf0), ((m & 0xf) << 4) | (m & 0xf), 1)) // #f00 | ||
: (m = reHex6.exec(format)) ? rgbn(parseInt(m[1], 16)) // #ff0000 | ||
: (m = reRgbInteger.exec(format)) ? new Rgb(m[1], m[2], m[3], 1) // rgb(255, 0, 0) | ||
: (m = reRgbPercent.exec(format)) ? new Rgb(m[1] * 255 / 100, m[2] * 255 / 100, m[3] * 255 / 100, 1) // rgb(100%, 0%, 0%) | ||
: (m = reRgbaInteger.exec(format)) ? rgba(m[1], m[2], m[3], m[4]) // rgba(255, 0, 0, 1) | ||
: (m = reRgbaPercent.exec(format)) ? rgba(m[1] * 255 / 100, m[2] * 255 / 100, m[3] * 255 / 100, m[4]) // rgb(100%, 0%, 0%, 1) | ||
: (m = reHslPercent.exec(format)) ? hsla(m[1], m[2] / 100, m[3] / 100, 1) // hsl(120, 50%, 50%) | ||
: (m = reHslaPercent.exec(format)) ? hsla(m[1], m[2] / 100, m[3] / 100, m[4]) // hsla(120, 50%, 50%, 1) | ||
: named.hasOwnProperty(format) ? rgbn(named[format]) | ||
: format === "transparent" ? new Rgb(NaN, NaN, NaN, 0) | ||
: null; | ||
} | ||
function rgbn(n) { | ||
return new Rgb(n >> 16 & 0xff, n >> 8 & 0xff, n & 0xff, 1); | ||
} | ||
function rgba(r, g, b, a) { | ||
if (a <= 0) r = g = b = NaN; | ||
return new Rgb(r, g, b, a); | ||
} | ||
function rgbConvert(o) { | ||
if (!(o instanceof Color)) o = color(o); | ||
if (!o) return new Rgb; | ||
o = o.rgb(); | ||
return new Rgb(o.r, o.g, o.b, o.opacity); | ||
} | ||
function rgb(r, g, b, opacity) { | ||
return arguments.length === 1 ? rgbConvert(r) : new Rgb(r, g, b, opacity == null ? 1 : opacity); | ||
} | ||
function Rgb(r, g, b, opacity) { | ||
this.r = +r; | ||
this.g = +g; | ||
this.b = +b; | ||
this.opacity = +opacity; | ||
} | ||
define(Rgb, rgb, extend(Color, { | ||
brighter: function(k) { | ||
k = k == null ? brighter : Math.pow(brighter, k); | ||
return new Rgb(this.r * k, this.g * k, this.b * k, this.opacity); | ||
}, | ||
darker: function(k) { | ||
k = k == null ? darker : Math.pow(darker, k); | ||
return new Rgb(this.r * k, this.g * k, this.b * k, this.opacity); | ||
}, | ||
rgb: function() { | ||
return this; | ||
}, | ||
displayable: function() { | ||
return (0 <= this.r && this.r <= 255) | ||
&& (0 <= this.g && this.g <= 255) | ||
&& (0 <= this.b && this.b <= 255) | ||
&& (0 <= this.opacity && this.opacity <= 1); | ||
}, | ||
hex: function() { | ||
return "#" + hex(this.r) + hex(this.g) + hex(this.b); | ||
}, | ||
toString: function() { | ||
var a = this.opacity; a = isNaN(a) ? 1 : Math.max(0, Math.min(1, a)); | ||
return (a === 1 ? "rgb(" : "rgba(") | ||
+ Math.max(0, Math.min(255, Math.round(this.r) || 0)) + ", " | ||
+ Math.max(0, Math.min(255, Math.round(this.g) || 0)) + ", " | ||
+ Math.max(0, Math.min(255, Math.round(this.b) || 0)) | ||
+ (a === 1 ? ")" : ", " + a + ")"); | ||
} | ||
})); | ||
function hex(value) { | ||
value = Math.max(0, Math.min(255, Math.round(value) || 0)); | ||
return (value < 16 ? "0" : "") + value.toString(16); | ||
} | ||
function hsla(h, s, l, a) { | ||
if (a <= 0) h = s = l = NaN; | ||
else if (l <= 0 || l >= 1) h = s = NaN; | ||
else if (s <= 0) h = NaN; | ||
return new Hsl(h, s, l, a); | ||
} | ||
function hslConvert(o) { | ||
if (o instanceof Hsl) return new Hsl(o.h, o.s, o.l, o.opacity); | ||
if (!(o instanceof Color)) o = color(o); | ||
if (!o) return new Hsl; | ||
if (o instanceof Hsl) return o; | ||
o = o.rgb(); | ||
var r = o.r / 255, | ||
g = o.g / 255, | ||
b = o.b / 255, | ||
min = Math.min(r, g, b), | ||
max = Math.max(r, g, b), | ||
h = NaN, | ||
s = max - min, | ||
l = (max + min) / 2; | ||
if (s) { | ||
if (r === max) h = (g - b) / s + (g < b) * 6; | ||
else if (g === max) h = (b - r) / s + 2; | ||
else h = (r - g) / s + 4; | ||
s /= l < 0.5 ? max + min : 2 - max - min; | ||
h *= 60; | ||
} else { | ||
s = l > 0 && l < 1 ? 0 : h; | ||
} | ||
return new Hsl(h, s, l, o.opacity); | ||
} | ||
function hsl(h, s, l, opacity) { | ||
return arguments.length === 1 ? hslConvert(h) : new Hsl(h, s, l, opacity == null ? 1 : opacity); | ||
} | ||
function Hsl(h, s, l, opacity) { | ||
this.h = +h; | ||
this.s = +s; | ||
this.l = +l; | ||
this.opacity = +opacity; | ||
} | ||
define(Hsl, hsl, extend(Color, { | ||
brighter: function(k) { | ||
k = k == null ? brighter : Math.pow(brighter, k); | ||
return new Hsl(this.h, this.s, this.l * k, this.opacity); | ||
}, | ||
darker: function(k) { | ||
k = k == null ? darker : Math.pow(darker, k); | ||
return new Hsl(this.h, this.s, this.l * k, this.opacity); | ||
}, | ||
rgb: function() { | ||
var h = this.h % 360 + (this.h < 0) * 360, | ||
s = isNaN(h) || isNaN(this.s) ? 0 : this.s, | ||
l = this.l, | ||
m2 = l + (l < 0.5 ? l : 1 - l) * s, | ||
m1 = 2 * l - m2; | ||
return new Rgb( | ||
hsl2rgb(h >= 240 ? h - 240 : h + 120, m1, m2), | ||
hsl2rgb(h, m1, m2), | ||
hsl2rgb(h < 120 ? h + 240 : h - 120, m1, m2), | ||
this.opacity | ||
); | ||
}, | ||
displayable: function() { | ||
return (0 <= this.s && this.s <= 1 || isNaN(this.s)) | ||
&& (0 <= this.l && this.l <= 1) | ||
&& (0 <= this.opacity && this.opacity <= 1); | ||
} | ||
})); | ||
/* From FvD 13.37, CSS Color Module Level 3 */ | ||
function hsl2rgb(h, m1, m2) { | ||
return (h < 60 ? m1 + (m2 - m1) * h / 60 | ||
: h < 180 ? m2 | ||
: h < 240 ? m1 + (m2 - m1) * (240 - h) / 60 | ||
: m1) * 255; | ||
} | ||
var deg2rad = Math.PI / 180; | ||
var rad2deg = 180 / Math.PI; | ||
// https://beta.observablehq.com/@mbostock/lab-and-rgb | ||
var K = 18, | ||
Xn = 0.96422, | ||
Yn = 1, | ||
Zn = 0.82521, | ||
t0 = 4 / 29, | ||
t1 = 6 / 29, | ||
t2 = 3 * t1 * t1, | ||
t3 = t1 * t1 * t1; | ||
function labConvert(o) { | ||
if (o instanceof Lab) return new Lab(o.l, o.a, o.b, o.opacity); | ||
if (o instanceof Hcl) { | ||
if (isNaN(o.h)) return new Lab(o.l, 0, 0, o.opacity); | ||
var h = o.h * deg2rad; | ||
return new Lab(o.l, Math.cos(h) * o.c, Math.sin(h) * o.c, o.opacity); | ||
} | ||
if (!(o instanceof Rgb)) o = rgbConvert(o); | ||
var r = rgb2lrgb(o.r), | ||
g = rgb2lrgb(o.g), | ||
b = rgb2lrgb(o.b), | ||
y = xyz2lab((0.2225045 * r + 0.7168786 * g + 0.0606169 * b) / Yn), x, z; | ||
if (r === g && g === b) x = z = y; else { | ||
x = xyz2lab((0.4360747 * r + 0.3850649 * g + 0.1430804 * b) / Xn); | ||
z = xyz2lab((0.0139322 * r + 0.0971045 * g + 0.7141733 * b) / Zn); | ||
} | ||
return new Lab(116 * y - 16, 500 * (x - y), 200 * (y - z), o.opacity); | ||
} | ||
function lab(l, a, b, opacity) { | ||
return arguments.length === 1 ? labConvert(l) : new Lab(l, a, b, opacity == null ? 1 : opacity); | ||
} | ||
function Lab(l, a, b, opacity) { | ||
this.l = +l; | ||
this.a = +a; | ||
this.b = +b; | ||
this.opacity = +opacity; | ||
} | ||
define(Lab, lab, extend(Color, { | ||
brighter: function(k) { | ||
return new Lab(this.l + K * (k == null ? 1 : k), this.a, this.b, this.opacity); | ||
}, | ||
darker: function(k) { | ||
return new Lab(this.l - K * (k == null ? 1 : k), this.a, this.b, this.opacity); | ||
}, | ||
rgb: function() { | ||
var y = (this.l + 16) / 116, | ||
x = isNaN(this.a) ? y : y + this.a / 500, | ||
z = isNaN(this.b) ? y : y - this.b / 200; | ||
x = Xn * lab2xyz(x); | ||
y = Yn * lab2xyz(y); | ||
z = Zn * lab2xyz(z); | ||
return new Rgb( | ||
lrgb2rgb( 3.1338561 * x - 1.6168667 * y - 0.4906146 * z), | ||
lrgb2rgb(-0.9787684 * x + 1.9161415 * y + 0.0334540 * z), | ||
lrgb2rgb( 0.0719453 * x - 0.2289914 * y + 1.4052427 * z), | ||
this.opacity | ||
); | ||
} | ||
})); | ||
function xyz2lab(t) { | ||
return t > t3 ? Math.pow(t, 1 / 3) : t / t2 + t0; | ||
} | ||
function lab2xyz(t) { | ||
return t > t1 ? t * t * t : t2 * (t - t0); | ||
} | ||
function lrgb2rgb(x) { | ||
return 255 * (x <= 0.0031308 ? 12.92 * x : 1.055 * Math.pow(x, 1 / 2.4) - 0.055); | ||
} | ||
function rgb2lrgb(x) { | ||
return (x /= 255) <= 0.04045 ? x / 12.92 : Math.pow((x + 0.055) / 1.055, 2.4); | ||
} | ||
function hclConvert(o) { | ||
if (o instanceof Hcl) return new Hcl(o.h, o.c, o.l, o.opacity); | ||
if (!(o instanceof Lab)) o = labConvert(o); | ||
if (o.a === 0 && o.b === 0) return new Hcl(NaN, 0, o.l, o.opacity); | ||
var h = Math.atan2(o.b, o.a) * rad2deg; | ||
return new Hcl(h < 0 ? h + 360 : h, Math.sqrt(o.a * o.a + o.b * o.b), o.l, o.opacity); | ||
} | ||
function hcl(h, c, l, opacity) { | ||
return arguments.length === 1 ? hclConvert(h) : new Hcl(h, c, l, opacity == null ? 1 : opacity); | ||
} | ||
function Hcl(h, c, l, opacity) { | ||
this.h = +h; | ||
this.c = +c; | ||
this.l = +l; | ||
this.opacity = +opacity; | ||
} | ||
define(Hcl, hcl, extend(Color, { | ||
brighter: function(k) { | ||
return new Hcl(this.h, this.c, this.l + K * (k == null ? 1 : k), this.opacity); | ||
}, | ||
darker: function(k) { | ||
return new Hcl(this.h, this.c, this.l - K * (k == null ? 1 : k), this.opacity); | ||
}, | ||
rgb: function() { | ||
return labConvert(this).rgb(); | ||
} | ||
})); | ||
var A = -0.14861, | ||
B = +1.78277, | ||
C = -0.29227, | ||
D = -0.90649, | ||
E = +1.97294, | ||
ED = E * D, | ||
EB = E * B, | ||
BC_DA = B * C - D * A; | ||
function cubehelixConvert(o) { | ||
if (o instanceof Cubehelix) return new Cubehelix(o.h, o.s, o.l, o.opacity); | ||
if (!(o instanceof Rgb)) o = rgbConvert(o); | ||
var r = o.r / 255, | ||
g = o.g / 255, | ||
b = o.b / 255, | ||
l = (BC_DA * b + ED * r - EB * g) / (BC_DA + ED - EB), | ||
bl = b - l, | ||
k = (E * (g - l) - C * bl) / D, | ||
s = Math.sqrt(k * k + bl * bl) / (E * l * (1 - l)), // NaN if l=0 or l=1 | ||
h = s ? Math.atan2(k, bl) * rad2deg - 120 : NaN; | ||
return new Cubehelix(h < 0 ? h + 360 : h, s, l, o.opacity); | ||
} | ||
function cubehelix(h, s, l, opacity) { | ||
return arguments.length === 1 ? cubehelixConvert(h) : new Cubehelix(h, s, l, opacity == null ? 1 : opacity); | ||
} | ||
function Cubehelix(h, s, l, opacity) { | ||
this.h = +h; | ||
this.s = +s; | ||
this.l = +l; | ||
this.opacity = +opacity; | ||
} | ||
define(Cubehelix, cubehelix, extend(Color, { | ||
brighter: function(k) { | ||
k = k == null ? brighter : Math.pow(brighter, k); | ||
return new Cubehelix(this.h, this.s, this.l * k, this.opacity); | ||
}, | ||
darker: function(k) { | ||
k = k == null ? darker : Math.pow(darker, k); | ||
return new Cubehelix(this.h, this.s, this.l * k, this.opacity); | ||
}, | ||
rgb: function() { | ||
var h = isNaN(this.h) ? 0 : (this.h + 120) * deg2rad, | ||
l = +this.l, | ||
a = isNaN(this.s) ? 0 : this.s * l * (1 - l), | ||
cosh = Math.cos(h), | ||
sinh = Math.sin(h); | ||
return new Rgb( | ||
255 * (l + a * (A * cosh + B * sinh)), | ||
255 * (l + a * (C * cosh + D * sinh)), | ||
255 * (l + a * (E * cosh)), | ||
this.opacity | ||
); | ||
} | ||
})); | ||
function I2DChart() { | ||
} | ||
I2DChart.prototype._palette = Palette.ordinal("default"); | ||
I2DChart.prototype.fillColor = function (row, column, value) { | ||
return this._palette(row[0]); | ||
}; | ||
I2DChart.prototype.strokeColor = function (row, column, value) { | ||
return hsl(this.fillColor(row, column, value)).darker().toString(); | ||
}; | ||
I2DChart.prototype.textColor = function (row, column, value) { | ||
return Palette.textColor(this.fillColor(row, column, value)); | ||
}; | ||
// Events --- | ||
@@ -147,2 +678,11 @@ I2DChart.prototype.click = function (row, column, selected) { | ||
INDChart.prototype._palette = Palette.ordinal("default"); | ||
INDChart.prototype.fillColor = function (row, column, value) { | ||
return this._palette(column); | ||
}; | ||
INDChart.prototype.strokeColor = function (row, column, value) { | ||
return hsl(this.fillColor(row, column, value)).darker().toString(); | ||
}; | ||
INDChart.prototype.textColor = function (row, column, value) { | ||
return Palette.textColor(this.fillColor(row, column, value)); | ||
}; | ||
// Events --- | ||
@@ -149,0 +689,0 @@ INDChart.prototype.click = function (row, column, selected) { |
@@ -18,5 +18,536 @@ (function (global, factory) { | ||
function define(constructor, factory, prototype) { | ||
constructor.prototype = factory.prototype = prototype; | ||
prototype.constructor = constructor; | ||
} | ||
function extend(parent, definition) { | ||
var prototype = Object.create(parent.prototype); | ||
for (var key in definition) prototype[key] = definition[key]; | ||
return prototype; | ||
} | ||
function Color() {} | ||
var darker = 0.7; | ||
var brighter = 1 / darker; | ||
var reI = "\\s*([+-]?\\d+)\\s*", | ||
reN = "\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)\\s*", | ||
reP = "\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)%\\s*", | ||
reHex3 = /^#([0-9a-f]{3})$/, | ||
reHex6 = /^#([0-9a-f]{6})$/, | ||
reRgbInteger = new RegExp("^rgb\\(" + [reI, reI, reI] + "\\)$"), | ||
reRgbPercent = new RegExp("^rgb\\(" + [reP, reP, reP] + "\\)$"), | ||
reRgbaInteger = new RegExp("^rgba\\(" + [reI, reI, reI, reN] + "\\)$"), | ||
reRgbaPercent = new RegExp("^rgba\\(" + [reP, reP, reP, reN] + "\\)$"), | ||
reHslPercent = new RegExp("^hsl\\(" + [reN, reP, reP] + "\\)$"), | ||
reHslaPercent = new RegExp("^hsla\\(" + [reN, reP, reP, reN] + "\\)$"); | ||
var named = { | ||
aliceblue: 0xf0f8ff, | ||
antiquewhite: 0xfaebd7, | ||
aqua: 0x00ffff, | ||
aquamarine: 0x7fffd4, | ||
azure: 0xf0ffff, | ||
beige: 0xf5f5dc, | ||
bisque: 0xffe4c4, | ||
black: 0x000000, | ||
blanchedalmond: 0xffebcd, | ||
blue: 0x0000ff, | ||
blueviolet: 0x8a2be2, | ||
brown: 0xa52a2a, | ||
burlywood: 0xdeb887, | ||
cadetblue: 0x5f9ea0, | ||
chartreuse: 0x7fff00, | ||
chocolate: 0xd2691e, | ||
coral: 0xff7f50, | ||
cornflowerblue: 0x6495ed, | ||
cornsilk: 0xfff8dc, | ||
crimson: 0xdc143c, | ||
cyan: 0x00ffff, | ||
darkblue: 0x00008b, | ||
darkcyan: 0x008b8b, | ||
darkgoldenrod: 0xb8860b, | ||
darkgray: 0xa9a9a9, | ||
darkgreen: 0x006400, | ||
darkgrey: 0xa9a9a9, | ||
darkkhaki: 0xbdb76b, | ||
darkmagenta: 0x8b008b, | ||
darkolivegreen: 0x556b2f, | ||
darkorange: 0xff8c00, | ||
darkorchid: 0x9932cc, | ||
darkred: 0x8b0000, | ||
darksalmon: 0xe9967a, | ||
darkseagreen: 0x8fbc8f, | ||
darkslateblue: 0x483d8b, | ||
darkslategray: 0x2f4f4f, | ||
darkslategrey: 0x2f4f4f, | ||
darkturquoise: 0x00ced1, | ||
darkviolet: 0x9400d3, | ||
deeppink: 0xff1493, | ||
deepskyblue: 0x00bfff, | ||
dimgray: 0x696969, | ||
dimgrey: 0x696969, | ||
dodgerblue: 0x1e90ff, | ||
firebrick: 0xb22222, | ||
floralwhite: 0xfffaf0, | ||
forestgreen: 0x228b22, | ||
fuchsia: 0xff00ff, | ||
gainsboro: 0xdcdcdc, | ||
ghostwhite: 0xf8f8ff, | ||
gold: 0xffd700, | ||
goldenrod: 0xdaa520, | ||
gray: 0x808080, | ||
green: 0x008000, | ||
greenyellow: 0xadff2f, | ||
grey: 0x808080, | ||
honeydew: 0xf0fff0, | ||
hotpink: 0xff69b4, | ||
indianred: 0xcd5c5c, | ||
indigo: 0x4b0082, | ||
ivory: 0xfffff0, | ||
khaki: 0xf0e68c, | ||
lavender: 0xe6e6fa, | ||
lavenderblush: 0xfff0f5, | ||
lawngreen: 0x7cfc00, | ||
lemonchiffon: 0xfffacd, | ||
lightblue: 0xadd8e6, | ||
lightcoral: 0xf08080, | ||
lightcyan: 0xe0ffff, | ||
lightgoldenrodyellow: 0xfafad2, | ||
lightgray: 0xd3d3d3, | ||
lightgreen: 0x90ee90, | ||
lightgrey: 0xd3d3d3, | ||
lightpink: 0xffb6c1, | ||
lightsalmon: 0xffa07a, | ||
lightseagreen: 0x20b2aa, | ||
lightskyblue: 0x87cefa, | ||
lightslategray: 0x778899, | ||
lightslategrey: 0x778899, | ||
lightsteelblue: 0xb0c4de, | ||
lightyellow: 0xffffe0, | ||
lime: 0x00ff00, | ||
limegreen: 0x32cd32, | ||
linen: 0xfaf0e6, | ||
magenta: 0xff00ff, | ||
maroon: 0x800000, | ||
mediumaquamarine: 0x66cdaa, | ||
mediumblue: 0x0000cd, | ||
mediumorchid: 0xba55d3, | ||
mediumpurple: 0x9370db, | ||
mediumseagreen: 0x3cb371, | ||
mediumslateblue: 0x7b68ee, | ||
mediumspringgreen: 0x00fa9a, | ||
mediumturquoise: 0x48d1cc, | ||
mediumvioletred: 0xc71585, | ||
midnightblue: 0x191970, | ||
mintcream: 0xf5fffa, | ||
mistyrose: 0xffe4e1, | ||
moccasin: 0xffe4b5, | ||
navajowhite: 0xffdead, | ||
navy: 0x000080, | ||
oldlace: 0xfdf5e6, | ||
olive: 0x808000, | ||
olivedrab: 0x6b8e23, | ||
orange: 0xffa500, | ||
orangered: 0xff4500, | ||
orchid: 0xda70d6, | ||
palegoldenrod: 0xeee8aa, | ||
palegreen: 0x98fb98, | ||
paleturquoise: 0xafeeee, | ||
palevioletred: 0xdb7093, | ||
papayawhip: 0xffefd5, | ||
peachpuff: 0xffdab9, | ||
peru: 0xcd853f, | ||
pink: 0xffc0cb, | ||
plum: 0xdda0dd, | ||
powderblue: 0xb0e0e6, | ||
purple: 0x800080, | ||
rebeccapurple: 0x663399, | ||
red: 0xff0000, | ||
rosybrown: 0xbc8f8f, | ||
royalblue: 0x4169e1, | ||
saddlebrown: 0x8b4513, | ||
salmon: 0xfa8072, | ||
sandybrown: 0xf4a460, | ||
seagreen: 0x2e8b57, | ||
seashell: 0xfff5ee, | ||
sienna: 0xa0522d, | ||
silver: 0xc0c0c0, | ||
skyblue: 0x87ceeb, | ||
slateblue: 0x6a5acd, | ||
slategray: 0x708090, | ||
slategrey: 0x708090, | ||
snow: 0xfffafa, | ||
springgreen: 0x00ff7f, | ||
steelblue: 0x4682b4, | ||
tan: 0xd2b48c, | ||
teal: 0x008080, | ||
thistle: 0xd8bfd8, | ||
tomato: 0xff6347, | ||
turquoise: 0x40e0d0, | ||
violet: 0xee82ee, | ||
wheat: 0xf5deb3, | ||
white: 0xffffff, | ||
whitesmoke: 0xf5f5f5, | ||
yellow: 0xffff00, | ||
yellowgreen: 0x9acd32 | ||
}; | ||
define(Color, color, { | ||
displayable: function() { | ||
return this.rgb().displayable(); | ||
}, | ||
hex: function() { | ||
return this.rgb().hex(); | ||
}, | ||
toString: function() { | ||
return this.rgb() + ""; | ||
} | ||
}); | ||
function color(format) { | ||
var m; | ||
format = (format + "").trim().toLowerCase(); | ||
return (m = reHex3.exec(format)) ? (m = parseInt(m[1], 16), new Rgb((m >> 8 & 0xf) | (m >> 4 & 0x0f0), (m >> 4 & 0xf) | (m & 0xf0), ((m & 0xf) << 4) | (m & 0xf), 1)) // #f00 | ||
: (m = reHex6.exec(format)) ? rgbn(parseInt(m[1], 16)) // #ff0000 | ||
: (m = reRgbInteger.exec(format)) ? new Rgb(m[1], m[2], m[3], 1) // rgb(255, 0, 0) | ||
: (m = reRgbPercent.exec(format)) ? new Rgb(m[1] * 255 / 100, m[2] * 255 / 100, m[3] * 255 / 100, 1) // rgb(100%, 0%, 0%) | ||
: (m = reRgbaInteger.exec(format)) ? rgba(m[1], m[2], m[3], m[4]) // rgba(255, 0, 0, 1) | ||
: (m = reRgbaPercent.exec(format)) ? rgba(m[1] * 255 / 100, m[2] * 255 / 100, m[3] * 255 / 100, m[4]) // rgb(100%, 0%, 0%, 1) | ||
: (m = reHslPercent.exec(format)) ? hsla(m[1], m[2] / 100, m[3] / 100, 1) // hsl(120, 50%, 50%) | ||
: (m = reHslaPercent.exec(format)) ? hsla(m[1], m[2] / 100, m[3] / 100, m[4]) // hsla(120, 50%, 50%, 1) | ||
: named.hasOwnProperty(format) ? rgbn(named[format]) | ||
: format === "transparent" ? new Rgb(NaN, NaN, NaN, 0) | ||
: null; | ||
} | ||
function rgbn(n) { | ||
return new Rgb(n >> 16 & 0xff, n >> 8 & 0xff, n & 0xff, 1); | ||
} | ||
function rgba(r, g, b, a) { | ||
if (a <= 0) r = g = b = NaN; | ||
return new Rgb(r, g, b, a); | ||
} | ||
function rgbConvert(o) { | ||
if (!(o instanceof Color)) o = color(o); | ||
if (!o) return new Rgb; | ||
o = o.rgb(); | ||
return new Rgb(o.r, o.g, o.b, o.opacity); | ||
} | ||
function rgb(r, g, b, opacity) { | ||
return arguments.length === 1 ? rgbConvert(r) : new Rgb(r, g, b, opacity == null ? 1 : opacity); | ||
} | ||
function Rgb(r, g, b, opacity) { | ||
this.r = +r; | ||
this.g = +g; | ||
this.b = +b; | ||
this.opacity = +opacity; | ||
} | ||
define(Rgb, rgb, extend(Color, { | ||
brighter: function(k) { | ||
k = k == null ? brighter : Math.pow(brighter, k); | ||
return new Rgb(this.r * k, this.g * k, this.b * k, this.opacity); | ||
}, | ||
darker: function(k) { | ||
k = k == null ? darker : Math.pow(darker, k); | ||
return new Rgb(this.r * k, this.g * k, this.b * k, this.opacity); | ||
}, | ||
rgb: function() { | ||
return this; | ||
}, | ||
displayable: function() { | ||
return (0 <= this.r && this.r <= 255) | ||
&& (0 <= this.g && this.g <= 255) | ||
&& (0 <= this.b && this.b <= 255) | ||
&& (0 <= this.opacity && this.opacity <= 1); | ||
}, | ||
hex: function() { | ||
return "#" + hex(this.r) + hex(this.g) + hex(this.b); | ||
}, | ||
toString: function() { | ||
var a = this.opacity; a = isNaN(a) ? 1 : Math.max(0, Math.min(1, a)); | ||
return (a === 1 ? "rgb(" : "rgba(") | ||
+ Math.max(0, Math.min(255, Math.round(this.r) || 0)) + ", " | ||
+ Math.max(0, Math.min(255, Math.round(this.g) || 0)) + ", " | ||
+ Math.max(0, Math.min(255, Math.round(this.b) || 0)) | ||
+ (a === 1 ? ")" : ", " + a + ")"); | ||
} | ||
})); | ||
function hex(value) { | ||
value = Math.max(0, Math.min(255, Math.round(value) || 0)); | ||
return (value < 16 ? "0" : "") + value.toString(16); | ||
} | ||
function hsla(h, s, l, a) { | ||
if (a <= 0) h = s = l = NaN; | ||
else if (l <= 0 || l >= 1) h = s = NaN; | ||
else if (s <= 0) h = NaN; | ||
return new Hsl(h, s, l, a); | ||
} | ||
function hslConvert(o) { | ||
if (o instanceof Hsl) return new Hsl(o.h, o.s, o.l, o.opacity); | ||
if (!(o instanceof Color)) o = color(o); | ||
if (!o) return new Hsl; | ||
if (o instanceof Hsl) return o; | ||
o = o.rgb(); | ||
var r = o.r / 255, | ||
g = o.g / 255, | ||
b = o.b / 255, | ||
min = Math.min(r, g, b), | ||
max = Math.max(r, g, b), | ||
h = NaN, | ||
s = max - min, | ||
l = (max + min) / 2; | ||
if (s) { | ||
if (r === max) h = (g - b) / s + (g < b) * 6; | ||
else if (g === max) h = (b - r) / s + 2; | ||
else h = (r - g) / s + 4; | ||
s /= l < 0.5 ? max + min : 2 - max - min; | ||
h *= 60; | ||
} else { | ||
s = l > 0 && l < 1 ? 0 : h; | ||
} | ||
return new Hsl(h, s, l, o.opacity); | ||
} | ||
function hsl(h, s, l, opacity) { | ||
return arguments.length === 1 ? hslConvert(h) : new Hsl(h, s, l, opacity == null ? 1 : opacity); | ||
} | ||
function Hsl(h, s, l, opacity) { | ||
this.h = +h; | ||
this.s = +s; | ||
this.l = +l; | ||
this.opacity = +opacity; | ||
} | ||
define(Hsl, hsl, extend(Color, { | ||
brighter: function(k) { | ||
k = k == null ? brighter : Math.pow(brighter, k); | ||
return new Hsl(this.h, this.s, this.l * k, this.opacity); | ||
}, | ||
darker: function(k) { | ||
k = k == null ? darker : Math.pow(darker, k); | ||
return new Hsl(this.h, this.s, this.l * k, this.opacity); | ||
}, | ||
rgb: function() { | ||
var h = this.h % 360 + (this.h < 0) * 360, | ||
s = isNaN(h) || isNaN(this.s) ? 0 : this.s, | ||
l = this.l, | ||
m2 = l + (l < 0.5 ? l : 1 - l) * s, | ||
m1 = 2 * l - m2; | ||
return new Rgb( | ||
hsl2rgb(h >= 240 ? h - 240 : h + 120, m1, m2), | ||
hsl2rgb(h, m1, m2), | ||
hsl2rgb(h < 120 ? h + 240 : h - 120, m1, m2), | ||
this.opacity | ||
); | ||
}, | ||
displayable: function() { | ||
return (0 <= this.s && this.s <= 1 || isNaN(this.s)) | ||
&& (0 <= this.l && this.l <= 1) | ||
&& (0 <= this.opacity && this.opacity <= 1); | ||
} | ||
})); | ||
/* From FvD 13.37, CSS Color Module Level 3 */ | ||
function hsl2rgb(h, m1, m2) { | ||
return (h < 60 ? m1 + (m2 - m1) * h / 60 | ||
: h < 180 ? m2 | ||
: h < 240 ? m1 + (m2 - m1) * (240 - h) / 60 | ||
: m1) * 255; | ||
} | ||
var deg2rad = Math.PI / 180; | ||
var rad2deg = 180 / Math.PI; | ||
// https://beta.observablehq.com/@mbostock/lab-and-rgb | ||
var K = 18, | ||
Xn = 0.96422, | ||
Yn = 1, | ||
Zn = 0.82521, | ||
t0 = 4 / 29, | ||
t1 = 6 / 29, | ||
t2 = 3 * t1 * t1, | ||
t3 = t1 * t1 * t1; | ||
function labConvert(o) { | ||
if (o instanceof Lab) return new Lab(o.l, o.a, o.b, o.opacity); | ||
if (o instanceof Hcl) { | ||
if (isNaN(o.h)) return new Lab(o.l, 0, 0, o.opacity); | ||
var h = o.h * deg2rad; | ||
return new Lab(o.l, Math.cos(h) * o.c, Math.sin(h) * o.c, o.opacity); | ||
} | ||
if (!(o instanceof Rgb)) o = rgbConvert(o); | ||
var r = rgb2lrgb(o.r), | ||
g = rgb2lrgb(o.g), | ||
b = rgb2lrgb(o.b), | ||
y = xyz2lab((0.2225045 * r + 0.7168786 * g + 0.0606169 * b) / Yn), x, z; | ||
if (r === g && g === b) x = z = y; else { | ||
x = xyz2lab((0.4360747 * r + 0.3850649 * g + 0.1430804 * b) / Xn); | ||
z = xyz2lab((0.0139322 * r + 0.0971045 * g + 0.7141733 * b) / Zn); | ||
} | ||
return new Lab(116 * y - 16, 500 * (x - y), 200 * (y - z), o.opacity); | ||
} | ||
function lab(l, a, b, opacity) { | ||
return arguments.length === 1 ? labConvert(l) : new Lab(l, a, b, opacity == null ? 1 : opacity); | ||
} | ||
function Lab(l, a, b, opacity) { | ||
this.l = +l; | ||
this.a = +a; | ||
this.b = +b; | ||
this.opacity = +opacity; | ||
} | ||
define(Lab, lab, extend(Color, { | ||
brighter: function(k) { | ||
return new Lab(this.l + K * (k == null ? 1 : k), this.a, this.b, this.opacity); | ||
}, | ||
darker: function(k) { | ||
return new Lab(this.l - K * (k == null ? 1 : k), this.a, this.b, this.opacity); | ||
}, | ||
rgb: function() { | ||
var y = (this.l + 16) / 116, | ||
x = isNaN(this.a) ? y : y + this.a / 500, | ||
z = isNaN(this.b) ? y : y - this.b / 200; | ||
x = Xn * lab2xyz(x); | ||
y = Yn * lab2xyz(y); | ||
z = Zn * lab2xyz(z); | ||
return new Rgb( | ||
lrgb2rgb( 3.1338561 * x - 1.6168667 * y - 0.4906146 * z), | ||
lrgb2rgb(-0.9787684 * x + 1.9161415 * y + 0.0334540 * z), | ||
lrgb2rgb( 0.0719453 * x - 0.2289914 * y + 1.4052427 * z), | ||
this.opacity | ||
); | ||
} | ||
})); | ||
function xyz2lab(t) { | ||
return t > t3 ? Math.pow(t, 1 / 3) : t / t2 + t0; | ||
} | ||
function lab2xyz(t) { | ||
return t > t1 ? t * t * t : t2 * (t - t0); | ||
} | ||
function lrgb2rgb(x) { | ||
return 255 * (x <= 0.0031308 ? 12.92 * x : 1.055 * Math.pow(x, 1 / 2.4) - 0.055); | ||
} | ||
function rgb2lrgb(x) { | ||
return (x /= 255) <= 0.04045 ? x / 12.92 : Math.pow((x + 0.055) / 1.055, 2.4); | ||
} | ||
function hclConvert(o) { | ||
if (o instanceof Hcl) return new Hcl(o.h, o.c, o.l, o.opacity); | ||
if (!(o instanceof Lab)) o = labConvert(o); | ||
if (o.a === 0 && o.b === 0) return new Hcl(NaN, 0, o.l, o.opacity); | ||
var h = Math.atan2(o.b, o.a) * rad2deg; | ||
return new Hcl(h < 0 ? h + 360 : h, Math.sqrt(o.a * o.a + o.b * o.b), o.l, o.opacity); | ||
} | ||
function hcl(h, c, l, opacity) { | ||
return arguments.length === 1 ? hclConvert(h) : new Hcl(h, c, l, opacity == null ? 1 : opacity); | ||
} | ||
function Hcl(h, c, l, opacity) { | ||
this.h = +h; | ||
this.c = +c; | ||
this.l = +l; | ||
this.opacity = +opacity; | ||
} | ||
define(Hcl, hcl, extend(Color, { | ||
brighter: function(k) { | ||
return new Hcl(this.h, this.c, this.l + K * (k == null ? 1 : k), this.opacity); | ||
}, | ||
darker: function(k) { | ||
return new Hcl(this.h, this.c, this.l - K * (k == null ? 1 : k), this.opacity); | ||
}, | ||
rgb: function() { | ||
return labConvert(this).rgb(); | ||
} | ||
})); | ||
var A = -0.14861, | ||
B = +1.78277, | ||
C = -0.29227, | ||
D = -0.90649, | ||
E = +1.97294, | ||
ED = E * D, | ||
EB = E * B, | ||
BC_DA = B * C - D * A; | ||
function cubehelixConvert(o) { | ||
if (o instanceof Cubehelix) return new Cubehelix(o.h, o.s, o.l, o.opacity); | ||
if (!(o instanceof Rgb)) o = rgbConvert(o); | ||
var r = o.r / 255, | ||
g = o.g / 255, | ||
b = o.b / 255, | ||
l = (BC_DA * b + ED * r - EB * g) / (BC_DA + ED - EB), | ||
bl = b - l, | ||
k = (E * (g - l) - C * bl) / D, | ||
s = Math.sqrt(k * k + bl * bl) / (E * l * (1 - l)), // NaN if l=0 or l=1 | ||
h = s ? Math.atan2(k, bl) * rad2deg - 120 : NaN; | ||
return new Cubehelix(h < 0 ? h + 360 : h, s, l, o.opacity); | ||
} | ||
function cubehelix(h, s, l, opacity) { | ||
return arguments.length === 1 ? cubehelixConvert(h) : new Cubehelix(h, s, l, opacity == null ? 1 : opacity); | ||
} | ||
function Cubehelix(h, s, l, opacity) { | ||
this.h = +h; | ||
this.s = +s; | ||
this.l = +l; | ||
this.opacity = +opacity; | ||
} | ||
define(Cubehelix, cubehelix, extend(Color, { | ||
brighter: function(k) { | ||
k = k == null ? brighter : Math.pow(brighter, k); | ||
return new Cubehelix(this.h, this.s, this.l * k, this.opacity); | ||
}, | ||
darker: function(k) { | ||
k = k == null ? darker : Math.pow(darker, k); | ||
return new Cubehelix(this.h, this.s, this.l * k, this.opacity); | ||
}, | ||
rgb: function() { | ||
var h = isNaN(this.h) ? 0 : (this.h + 120) * deg2rad, | ||
l = +this.l, | ||
a = isNaN(this.s) ? 0 : this.s * l * (1 - l), | ||
cosh = Math.cos(h), | ||
sinh = Math.sin(h); | ||
return new Rgb( | ||
255 * (l + a * (A * cosh + B * sinh)), | ||
255 * (l + a * (C * cosh + D * sinh)), | ||
255 * (l + a * (E * cosh)), | ||
this.opacity | ||
); | ||
} | ||
})); | ||
function I2DChart() { | ||
} | ||
I2DChart.prototype._palette = common.Palette.ordinal("default"); | ||
I2DChart.prototype.fillColor = function (row, column, value) { | ||
return this._palette(row[0]); | ||
}; | ||
I2DChart.prototype.strokeColor = function (row, column, value) { | ||
return hsl(this.fillColor(row, column, value)).darker().toString(); | ||
}; | ||
I2DChart.prototype.textColor = function (row, column, value) { | ||
return common.Palette.textColor(this.fillColor(row, column, value)); | ||
}; | ||
// Events --- | ||
@@ -151,2 +682,11 @@ I2DChart.prototype.click = function (row, column, selected) { | ||
INDChart.prototype._palette = common.Palette.ordinal("default"); | ||
INDChart.prototype.fillColor = function (row, column, value) { | ||
return this._palette(column); | ||
}; | ||
INDChart.prototype.strokeColor = function (row, column, value) { | ||
return hsl(this.fillColor(row, column, value)).darker().toString(); | ||
}; | ||
INDChart.prototype.textColor = function (row, column, value) { | ||
return common.Palette.textColor(this.fillColor(row, column, value)); | ||
}; | ||
// Events --- | ||
@@ -153,0 +693,0 @@ INDChart.prototype.click = function (row, column, selected) { |
@@ -1,1 +0,1 @@ | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@hpcc-js/common")):"function"==typeof define&&define.amd?define(["exports","@hpcc-js/common"],e):e(t["@hpcc-js/api"]={},t["@hpcc-js/common"])}(this,function(t,e){"use strict";function n(){}function o(){}function r(){}n.prototype._palette=e.Palette.rainbow("default"),n.prototype.click=function(t,e,n){console.log("Click: "+JSON.stringify(t)+", "+e+", "+n)},n.prototype.dblclick=function(t,e,n){console.log("Double click: "+JSON.stringify(t)+", "+e+", "+n)},o.prototype._palette=e.Palette.ordinal("default"),o.prototype.click=function(t,e,n){console.log("Click: "+JSON.stringify(t)+", "+e+", "+n)},o.prototype.dblclick=function(t,e,n){console.log("Double click: "+JSON.stringify(t)+", "+e+", "+n)},r.prototype.vertex_click=function(t,e,n,o){o&&o.vertex&&console.log("Vertex click: "+o.vertex.id())},r.prototype.vertex_dblclick=function(t,e,n,o){o&&o.vertex&&console.log("Vertex double click: "+o.vertex.id())},r.prototype.edge_click=function(t,e,n,o){o&&o.edge&&console.log("Edge click: "+o.edge.id())},r.prototype.edge_dblclick=function(t,e,n,o){o&&o.edge&&console.log("Edge double click: "+o.edge.id())};var i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])};function l(t,e){function n(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}var a=function(t){function e(){return t.call(this)||this}return l(e,t),e.prototype.isValid=function(){if(this.validate()&&!new RegExp(this.validate()).test(this.value()))return!1;return!0},e.prototype.hasValue=function(){if("function"==typeof this.type){switch(this.type()){case"radio":case"checkbox":if(this.value()&&"false"!==this.value())return!0;break;default:if(this.value())return!0}return!1}return""!==this.value()},e.prototype.blur=function(t){},e.prototype.click=function(t){},e.prototype.dblclick=function(t){},e.prototype.change=function(t,e){},e.prototype.resetValue=function(t){t.value(t._inputElement[0].node().value)},e.prototype.disable=function(t){this._inputElement.forEach(function(e,n){e.attr("disabled",t?"disabled":null)})},e.prototype.setFocus=function(){this._inputElement.length&&this._inputElement[0].node().focus()},e}(e.Widget);function s(){}function u(t,e){if((n=(t=e?t.toExponential(e-1):t.toExponential()).indexOf("e"))<0)return null;var n,o=t.slice(0,n);return[o.length>1?o[0]+o.slice(2):o,+t.slice(n+1)]}a.prototype.publish("name","","string","HTML name for the input"),a.prototype.publish("label","","string","Descriptive label"),a.prototype.publish("value","","string","Input Current Value"),a.prototype.publish("validate",null,"string","Input Validation"),s.prototype._palette=e.Palette.ordinal("default"),s.prototype.click=function(t,e,n){console.log("Click: "+JSON.stringify(t)+", "+e+", "+n)},s.prototype.dblclick=function(t,e,n){console.log("Double click: "+JSON.stringify(t)+", "+e+", "+n)};var c,p=/^(?:(.)?([<>=^]))?([+\-\( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function f(t){return new h(t)}function h(t){if(!(e=p.exec(t)))throw new Error("invalid format: "+t);var e;this.fill=e[1]||" ",this.align=e[2]||">",this.sign=e[3]||"-",this.symbol=e[4]||"",this.zero=!!e[5],this.width=e[6]&&+e[6],this.comma=!!e[7],this.precision=e[8]&&+e[8].slice(1),this.trim=!!e[9],this.type=e[10]||""}function y(t,e){var n=u(t,e);if(!n)return t+"";var o=n[0],r=n[1];return r<0?"0."+new Array(-r).join("0")+o:o.length>r+1?o.slice(0,r+1)+"."+o.slice(r+1):o+new Array(r-o.length+2).join("0")}f.prototype=h.prototype,h.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(null==this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(null==this.precision?"":"."+Math.max(0,0|this.precision))+(this.trim?"~":"")+this.type};var d={"%":function(t,e){return(100*t).toFixed(e)},b:function(t){return Math.round(t).toString(2)},c:function(t){return t+""},d:function(t){return Math.round(t).toString(10)},e:function(t,e){return t.toExponential(e)},f:function(t,e){return t.toFixed(e)},g:function(t,e){return t.toPrecision(e)},o:function(t){return Math.round(t).toString(8)},p:function(t,e){return y(100*t,e)},r:y,s:function(t,e){var n=u(t,e);if(!n)return t+"";var o=n[0],r=n[1],i=r-(c=3*Math.max(-8,Math.min(8,Math.floor(r/3))))+1,l=o.length;return i===l?o:i>l?o+new Array(i-l+1).join("0"):i>0?o.slice(0,i)+"."+o.slice(i):"0."+new Array(1-i).join("0")+u(t,Math.max(0,e+i-1))[0]},X:function(t){return Math.round(t).toString(16).toUpperCase()},x:function(t){return Math.round(t).toString(16)}};function g(t){return t}var v,m,x=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function b(t){var e,n,o=t.grouping&&t.thousands?(e=t.grouping,n=t.thousands,function(t,o){for(var r=t.length,i=[],l=0,a=e[0],s=0;r>0&&a>0&&(s+a+1>o&&(a=Math.max(1,o-s)),i.push(t.substring(r-=a,r+a)),!((s+=a+1)>o));)a=e[l=(l+1)%e.length];return i.reverse().join(n)}):g,r=t.currency,i=t.decimal,l=t.numerals?function(t){return function(e){return e.replace(/[0-9]/g,function(e){return t[+e]})}}(t.numerals):g,a=t.percent||"%";function s(t){var e=(t=f(t)).fill,n=t.align,s=t.sign,u=t.symbol,p=t.zero,h=t.width,y=t.comma,g=t.precision,v=t.trim,m=t.type;"n"===m?(y=!0,m="g"):d[m]||(null==g&&(g=12),v=!0,m="g"),(p||"0"===e&&"="===n)&&(p=!0,e="0",n="=");var b="$"===u?r[0]:"#"===u&&/[boxX]/.test(m)?"0"+m.toLowerCase():"",w="$"===u?r[1]:/[%p]/.test(m)?a:"",k=d[m],C=/[defgprs%]/.test(m);function E(t){var r,a,u,f=b,d=w;if("c"===m)d=k(t)+d,t="";else{var E=(t=+t)<0;if(t=k(Math.abs(t),g),v&&(t=function(t){t:for(var e,n=t.length,o=1,r=-1;o<n;++o)switch(t[o]){case".":r=e=o;break;case"0":0===r&&(r=o),e=o;break;default:if(r>0){if(!+t[o])break t;r=0}}return r>0?t.slice(0,r)+t.slice(e+1):t}(t)),E&&0==+t&&(E=!1),f=(E?"("===s?s:"-":"-"===s||"("===s?"":s)+f,d=("s"===m?x[8+c/3]:"")+d+(E&&"("===s?")":""),C)for(r=-1,a=t.length;++r<a;)if(48>(u=t.charCodeAt(r))||u>57){d=(46===u?i+t.slice(r+1):t.slice(r))+d,t=t.slice(0,r);break}}y&&!p&&(t=o(t,1/0));var S=f.length+t.length+d.length,M=S<h?new Array(h-S+1).join(e):"";switch(y&&p&&(t=o(M+t,M.length?h-d.length:1/0),M=""),n){case"<":t=f+t+d+M;break;case"=":t=f+M+t+d;break;case"^":t=M.slice(0,S=M.length>>1)+f+t+d+M.slice(S);break;default:t=M+f+t+d}return l(t)}return g=null==g?6:/[gprs]/.test(m)?Math.max(1,Math.min(21,g)):Math.max(0,Math.min(20,g)),E.toString=function(){return t+""},E}return{format:s,formatPrefix:function(t,e){var n,o=s(((t=f(t)).type="f",t)),r=3*Math.max(-8,Math.min(8,Math.floor((n=e,((n=u(Math.abs(n)))?n[1]:NaN)/3)))),i=Math.pow(10,-r),l=x[8+r/3];return function(t){return o(i*t)+l}}}}v=b({decimal:".",thousands:",",grouping:[3],currency:["$",""]}),m=v.format,v.formatPrefix;function w(){}function k(t,e){var n=new w;if(t instanceof w)t.each(function(t,e){n.set(e,t)});else if(Array.isArray(t)){var o,r=-1,i=t.length;if(null==e)for(;++r<i;)n.set(r,t[r]);else for(;++r<i;)n.set(e(o=t[r],r,t),o)}else if(t)for(var l in t)n.set(l,t[l]);return n}function C(){}w.prototype=k.prototype={constructor:w,has:function(t){return"$"+t in this},get:function(t){return this["$"+t]},set:function(t,e){return this["$"+t]=e,this},remove:function(t){var e="$"+t;return e in this&&delete this[e]},clear:function(){for(var t in this)"$"===t[0]&&delete this[t]},keys:function(){var t=[];for(var e in this)"$"===e[0]&&t.push(e.slice(1));return t},values:function(){var t=[];for(var e in this)"$"===e[0]&&t.push(this[e]);return t},entries:function(){var t=[];for(var e in this)"$"===e[0]&&t.push({key:e.slice(1),value:this[e]});return t},size:function(){var t=0;for(var e in this)"$"===e[0]&&++t;return t},empty:function(){for(var t in this)if("$"===t[0])return!1;return!0},each:function(t){for(var e in this)"$"===e[0]&&t(this[e],e.slice(1),this)}};var E=k.prototype;C.prototype=function(t,e){var n=new C;if(t instanceof C)t.each(function(t){n.add(t)});else if(t){var o=-1,r=t.length;if(null==e)for(;++o<r;)n.add(t[o]);else for(;++o<r;)n.add(e(t[o],o,t))}return n}.prototype={constructor:C,has:E.has,add:function(t){return this["$"+(t+="")]=t,this},remove:E.remove,clear:E.clear,values:E.keys,size:E.size,empty:E.empty,each:E.each};!function(t,e){void 0===e&&(e={});var n=e.insertAt;if(t&&"undefined"!=typeof document){var o=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css","top"===n&&o.firstChild?o.insertBefore(r,o.firstChild):o.appendChild(r),r.styleSheet?r.styleSheet.cssText=t:r.appendChild(document.createTextNode(t))}}('.d3-tip {\r\n line-height: 1;\r\n font-weight: bold;\r\n padding: 12px;\r\n background: rgba(0, 0, 0, 0.66);\r\n color: #fff;\r\n border-radius: 2px;\r\n pointer-events: none !important;\r\n z-index:10;\r\n}\r\n\r\n.d3-tip.hidden {\r\n visibility:hidden;\r\n}\r\n\r\n/* Creates a small triangle extender for the tooltip */\r\n.d3-tip:after {\r\n box-sizing: border-box;\r\n display: inline;\r\n font-size: 10px;\r\n width: 100%;\r\n line-height: 1;\r\n color: rgba(0, 0, 0, 0.66);\r\n position: absolute;\r\n pointer-events: none !important;\r\n}\r\n\r\n/* Northward tooltips */\r\n.d3-tip.n:after {\r\n content: "\\25BC";\r\n margin: -1px 0 0 0;\r\n top: 100%;\r\n left: 0;\r\n text-align: center;\r\n}\r\n\r\n/* Eastward tooltips */\r\n.d3-tip.e:after {\r\n content: "\\25C0";\r\n margin: -4px 0 0 0;\r\n top: 50%;\r\n left: -8px;\r\n}\r\n\r\n/* Southward tooltips */\r\n.d3-tip.s:after {\r\n content: "\\25B2";\r\n margin: 0 0 1px 0;\r\n top: -8px;\r\n left: 0;\r\n text-align: center;\r\n}\r\n\r\n/* Westward tooltips */\r\n.d3-tip.w:after {\r\n content: "\\25B6";\r\n margin: -4px 0 0 -1px;\r\n top: 50%;\r\n left: 100%;\r\n}\r\n\r\n.d3-tip.notick:after {\r\n content: "" !important;\r\n}\r\n\r\n.common_Widget .over {\r\n stroke: rgba(0, 0, 0, 0.66);\r\n opacity: 0.66;\r\n}\r\n');var S=function(t){function n(){var n=t.call(this)||this;if(n.tooltip=function(){var t=function(){return"n"},n=function(){return[0,0]},o=function(){return" "},r=d(document.body),i=f(),l=null,a=null,s=null;function u(t){var e;e=t.node(),(l=e?"svg"===e.tagName.toLowerCase()?e:e.ownerSVGElement:null)&&(a=l.createSVGPoint(),r().appendChild(i))}u.show=function(){var e=Array.prototype.slice.call(arguments);e[e.length-1]instanceof SVGElement&&(s=e.pop());var i,l=o.apply(this,e),a=n.apply(this,e),f=t.apply(this,e),y=h(),d=p.length,g=document.documentElement.scrollTop||r().scrollTop,v=document.documentElement.scrollLeft||r().scrollLeft;for(y.html(l).style("opacity",1).style("pointer-events","all");d--;)y.classed(p[d],!1);return i=c.get(f).apply(this),y.classed(f,!0).style("top",i.top+a[0]+g+"px").style("left",i.left+a[1]+v+"px"),u},u.hide=function(){return h().style("opacity",0).style("pointer-events","none"),u},u.attr=function(t,n){if(arguments.length<2&&"string"==typeof t)return h().attr(t);var o=Array.prototype.slice.call(arguments);return e.selection.prototype.attr.apply(h(),o),u},u.style=function(t,n){if(arguments.length<2&&"string"==typeof t)return h().style(t);var o=Array.prototype.slice.call(arguments);return e.selection.prototype.style.apply(h(),o),u},u.direction=function(e){return arguments.length?(t=null==e?e:d(e),u):t},u.offset=function(t){return arguments.length?(n=null==t?t:d(t),u):n},u.html=function(t){return arguments.length?(o=null==t?t:d(t),u):o},u.rootElement=function(t){return arguments.length?(r=null==t?t:d(t),u):r},u.destroy=function(){return i&&(h().remove(),i=null),u};var c=k({n:function(){var t=y();return{top:t.n.y-i.offsetHeight,left:t.n.x-i.offsetWidth/2}},s:function(){var t=y();return{top:t.s.y,left:t.s.x-i.offsetWidth/2}},e:function(){var t=y();return{top:t.e.y-i.offsetHeight/2,left:t.e.x}},w:function(){var t=y();return{top:t.w.y-i.offsetHeight/2,left:t.w.x-i.offsetWidth}},nw:function(){var t=y();return{top:t.nw.y-i.offsetHeight,left:t.nw.x-i.offsetWidth}},ne:function(){var t=y();return{top:t.ne.y-i.offsetHeight,left:t.ne.x}},sw:function(){var t=y();return{top:t.sw.y,left:t.sw.x-i.offsetWidth}},se:function(){var t=y();return{top:t.se.y,left:t.se.x}}}),p=c.keys();function f(){var t=e.select(document.createElement("div"));return t.style("position","absolute").style("top",0).style("opacity",0).style("pointer-events","none").style("box-sizing","border-box"),t.node()}function h(){return null==i&&(i=f(),r().appendChild(i)),e.select(i)}function y(){for(var t=s||event.target;null==t.getScreenCTM&&null==t.parentNode;)t=t.parentNode;var e={},n=t.getScreenCTM(),o=t.getBBox(),r=o.width,i=o.height,l=o.x,u=o.y;return a.x=l,a.y=u,e.nw=a.matrixTransform(n),a.x+=r,e.ne=a.matrixTransform(n),a.y+=i,e.se=a.matrixTransform(n),a.x-=r,e.sw=a.matrixTransform(n),a.y-=i/2,e.w=a.matrixTransform(n),a.x+=r,e.e=a.matrixTransform(n),a.x-=r/2,a.y-=i/2,e.n=a.matrixTransform(n),a.y+=i,e.s=a.matrixTransform(n),e}function d(t){return"function"==typeof t?t:function(){return t}}return u}().attr("class","d3-tip"),n._valueFormatter=m(n.tooltipValueFormat()),n.layerEnter){var o=n.layerEnter;n.layerEnter=function(t,e,n){this.tooltipEnter(e),o.apply(this,arguments)};var r=n.layerUpdate;n.layerUpdate=function(t){r.apply(this,arguments),this.tooltipUpdate()};var i=n.layerExit;n.layerExit=function(t){i.apply(this,arguments),this.tooltipExit()}}else{var l=n.enter;n.enter=function(t,e){this.tooltipEnter(e),l.apply(this,arguments)};var a=n.update;n.update=function(t,e){a.apply(this,arguments),this.tooltipUpdate()};var s=n.exit;n.exit=function(t,e){s.apply(this,arguments),this.tooltipExit()}}return n}return l(n,t),n.prototype.tooltipEnter=function(t){t.call(this.tooltip)},n.prototype.tooltipUpdate=function(){var t=this;this.tooltip.offset(function(){switch(t.tooltip.direction()()){case"e":return[0,t.tooltipOffset()];default:return[-t.tooltipOffset(),0]}});var e=this.tooltip.attr("class");e&&(e=e.split(" notick").join("")+(this.tooltipTick()?"":" notick")+("none"===this.tooltipStyle()?" hidden":""),this.tooltip.attr("class",e))},n.prototype.tooltipExit=function(){this.tooltip&&this.tooltip.destroy()},n.prototype._tooltipHTML=function(t){return t},n.prototype.tooltipHTML=function(t){return this.tooltip.html(t)},n.prototype.tooltipFormat=function(t){switch((t=t||{}).label=void 0===t.label?"":t.label,t.series=t.series||"",t.value instanceof Date?t.value=t.value||"":t.value=this._valueFormatter(t.value)||"",this.tooltipStyle()){case"none":break;default:return t.series?"<span style='color:"+this.tooltipSeriesColor()+"'>"+t.series+"</span> / <span style='color:"+this.tooltipLabelColor()+"'>"+t.label+"</span>: <span style='color:"+this.tooltipValueColor()+"'>"+t.value+"</span>":"<span style='color:"+this.tooltipLabelColor()+"'>"+t.label+"</span>: <span style='color:"+this.tooltipValueColor()+"'>"+t.value+"</span>"}},n}(e.Widget);S.prototype.publish("tooltipStyle","default","set","Style",["default","none"],{}),S.prototype.publish("tooltipValueFormat",",.2f","string","Value Format",null,{}),S.prototype.publish("tooltipSeriesColor","#EAFFFF","html-color","Series Color",null,{}),S.prototype.publish("tooltipLabelColor","#CCFFFF","html-color","Label Color",null,{}),S.prototype.publish("tooltipValueColor","white","html-color","Value Color",null,{}),S.prototype.publish("tooltipTick",!0,"boolean","Show tooltip tick",null,{}),S.prototype.publish("tooltipOffset",8,"number","Offset from the cursor",null,{});var M=S.prototype.tooltipValueFormat;S.prototype.tooltipValueFormat=function(t){var e=M.apply(this,arguments);return arguments.length&&(this._valueFormatter=m(t)),e};var _=function(){function t(){}return t.prototype.click=function(t,e,n){console.log("Click: "+JSON.stringify(t)+", "+e+", "+n)},t.prototype.dblclick=function(t,e,n){console.log("Double click: "+JSON.stringify(t)+", "+e+", "+n)},t}();_.prototype._palette=e.Palette.ordinal("default"),t.I1DChart=n,t.I2DChart=o,t.IGraph=r,t.instanceOfIHighlight=function(t){return"function"==typeof t.highlightColumn},t.IInput=a,t.INDChart=s,t.ITooltip=S,t.ITree=_,Object.defineProperty(t,"__esModule",{value:!0})}); | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@hpcc-js/common")):"function"==typeof define&&define.amd?define(["exports","@hpcc-js/common"],e):e(t["@hpcc-js/api"]={},t["@hpcc-js/common"])}(this,function(t,e){"use strict";function n(){}function r(t,e,n){t.prototype=e.prototype=n,n.constructor=t}function i(t,e){var n=Object.create(t.prototype);for(var r in e)n[r]=e[r];return n}function o(){}n.prototype._palette=e.Palette.rainbow("default"),n.prototype.click=function(t,e,n){console.log("Click: "+JSON.stringify(t)+", "+e+", "+n)},n.prototype.dblclick=function(t,e,n){console.log("Double click: "+JSON.stringify(t)+", "+e+", "+n)};var l="\\s*([+-]?\\d+)\\s*",a="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)\\s*",s="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)%\\s*",u=/^#([0-9a-f]{3})$/,c=/^#([0-9a-f]{6})$/,h=new RegExp("^rgb\\("+[l,l,l]+"\\)$"),p=new RegExp("^rgb\\("+[s,s,s]+"\\)$"),f=new RegExp("^rgba\\("+[l,l,l,a]+"\\)$"),d=new RegExp("^rgba\\("+[s,s,s,a]+"\\)$"),y=new RegExp("^hsl\\("+[a,s,s]+"\\)$"),g=new RegExp("^hsla\\("+[a,s,s,a]+"\\)$"),m={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};function b(t){var e;return t=(t+"").trim().toLowerCase(),(e=u.exec(t))?new k((e=parseInt(e[1],16))>>8&15|e>>4&240,e>>4&15|240&e,(15&e)<<4|15&e,1):(e=c.exec(t))?v(parseInt(e[1],16)):(e=h.exec(t))?new k(e[1],e[2],e[3],1):(e=p.exec(t))?new k(255*e[1]/100,255*e[2]/100,255*e[3]/100,1):(e=f.exec(t))?w(e[1],e[2],e[3],e[4]):(e=d.exec(t))?w(255*e[1]/100,255*e[2]/100,255*e[3]/100,e[4]):(e=y.exec(t))?N(e[1],e[2]/100,e[3]/100,1):(e=g.exec(t))?N(e[1],e[2]/100,e[3]/100,e[4]):m.hasOwnProperty(t)?v(m[t]):"transparent"===t?new k(NaN,NaN,NaN,0):null}function v(t){return new k(t>>16&255,t>>8&255,255&t,1)}function w(t,e,n,r){return r<=0&&(t=e=n=NaN),new k(t,e,n,r)}function x(t){return t instanceof o||(t=b(t)),t?new k((t=t.rgb()).r,t.g,t.b,t.opacity):new k}function k(t,e,n,r){this.r=+t,this.g=+e,this.b=+n,this.opacity=+r}function M(t){return((t=Math.max(0,Math.min(255,Math.round(t)||0)))<16?"0":"")+t.toString(16)}function N(t,e,n,r){return r<=0?t=e=n=NaN:n<=0||n>=1?t=e=NaN:e<=0&&(t=NaN),new E(t,e,n,r)}function C(t,e,n,r){return 1===arguments.length?function(t){if(t instanceof E)return new E(t.h,t.s,t.l,t.opacity);if(t instanceof o||(t=b(t)),!t)return new E;if(t instanceof E)return t;var e=(t=t.rgb()).r/255,n=t.g/255,r=t.b/255,i=Math.min(e,n,r),l=Math.max(e,n,r),a=NaN,s=l-i,u=(l+i)/2;return s?(a=e===l?(n-r)/s+6*(n<r):n===l?(r-e)/s+2:(e-n)/s+4,s/=u<.5?l+i:2-l-i,a*=60):s=u>0&&u<1?0:a,new E(a,s,u,t.opacity)}(t):new E(t,e,n,null==r?1:r)}function E(t,e,n,r){this.h=+t,this.s=+e,this.l=+n,this.opacity=+r}function S(t,e,n){return 255*(t<60?e+(n-e)*t/60:t<180?n:t<240?e+(n-e)*(240-t)/60:e)}r(o,b,{displayable:function(){return this.rgb().displayable()},hex:function(){return this.rgb().hex()},toString:function(){return this.rgb()+""}}),r(k,function(t,e,n,r){return 1===arguments.length?x(t):new k(t,e,n,null==r?1:r)},i(o,{brighter:function(t){return t=null==t?1/.7:Math.pow(1/.7,t),new k(this.r*t,this.g*t,this.b*t,this.opacity)},darker:function(t){return t=null==t?.7:Math.pow(.7,t),new k(this.r*t,this.g*t,this.b*t,this.opacity)},rgb:function(){return this},displayable:function(){return 0<=this.r&&this.r<=255&&0<=this.g&&this.g<=255&&0<=this.b&&this.b<=255&&0<=this.opacity&&this.opacity<=1},hex:function(){return"#"+M(this.r)+M(this.g)+M(this.b)},toString:function(){var t=this.opacity;return(1===(t=isNaN(t)?1:Math.max(0,Math.min(1,t)))?"rgb(":"rgba(")+Math.max(0,Math.min(255,Math.round(this.r)||0))+", "+Math.max(0,Math.min(255,Math.round(this.g)||0))+", "+Math.max(0,Math.min(255,Math.round(this.b)||0))+(1===t?")":", "+t+")")}})),r(E,C,i(o,{brighter:function(t){return t=null==t?1/.7:Math.pow(1/.7,t),new E(this.h,this.s,this.l*t,this.opacity)},darker:function(t){return t=null==t?.7:Math.pow(.7,t),new E(this.h,this.s,this.l*t,this.opacity)},rgb:function(){var t=this.h%360+360*(this.h<0),e=isNaN(t)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*e,i=2*n-r;return new k(S(t>=240?t-240:t+120,i,r),S(t,i,r),S(t<120?t+240:t-120,i,r),this.opacity)},displayable:function(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1}}));var _=Math.PI/180,$=180/Math.PI,T=.96422,O=1,F=.82521,V=4/29,j=6/29,P=3*j*j,I=j*j*j;function A(t){if(t instanceof z)return new z(t.l,t.a,t.b,t.opacity);if(t instanceof W){if(isNaN(t.h))return new z(t.l,0,0,t.opacity);var e=t.h*_;return new z(t.l,Math.cos(e)*t.c,Math.sin(e)*t.c,t.opacity)}t instanceof k||(t=x(t));var n,r,i=H(t.r),o=H(t.g),l=H(t.b),a=q((.2225045*i+.7168786*o+.0606169*l)/O);return i===o&&o===l?n=r=a:(n=q((.4360747*i+.3850649*o+.1430804*l)/T),r=q((.0139322*i+.0971045*o+.7141733*l)/F)),new z(116*a-16,500*(n-a),200*(a-r),t.opacity)}function z(t,e,n,r){this.l=+t,this.a=+e,this.b=+n,this.opacity=+r}function q(t){return t>I?Math.pow(t,1/3):t/P+V}function L(t){return t>j?t*t*t:P*(t-V)}function D(t){return 255*(t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055)}function H(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function W(t,e,n,r){this.h=+t,this.c=+e,this.l=+n,this.opacity=+r}r(z,function(t,e,n,r){return 1===arguments.length?A(t):new z(t,e,n,null==r?1:r)},i(o,{brighter:function(t){return new z(this.l+18*(null==t?1:t),this.a,this.b,this.opacity)},darker:function(t){return new z(this.l-18*(null==t?1:t),this.a,this.b,this.opacity)},rgb:function(){var t=(this.l+16)/116,e=isNaN(this.a)?t:t+this.a/500,n=isNaN(this.b)?t:t-this.b/200;return new k(D(3.1338561*(e=T*L(e))-1.6168667*(t=O*L(t))-.4906146*(n=F*L(n))),D(-.9787684*e+1.9161415*t+.033454*n),D(.0719453*e-.2289914*t+1.4052427*n),this.opacity)}})),r(W,function(t,e,n,r){return 1===arguments.length?function(t){if(t instanceof W)return new W(t.h,t.c,t.l,t.opacity);if(t instanceof z||(t=A(t)),0===t.a&&0===t.b)return new W(NaN,0,t.l,t.opacity);var e=Math.atan2(t.b,t.a)*$;return new W(e<0?e+360:e,Math.sqrt(t.a*t.a+t.b*t.b),t.l,t.opacity)}(t):new W(t,e,n,null==r?1:r)},i(o,{brighter:function(t){return new W(this.h,this.c,this.l+18*(null==t?1:t),this.opacity)},darker:function(t){return new W(this.h,this.c,this.l-18*(null==t?1:t),this.opacity)},rgb:function(){return A(this).rgb()}}));var J=-.14861,B=1.78277,R=-.29227,U=-.90649,G=1.97294,X=G*U,Y=G*B,Z=B*R-U*J;function K(t,e,n,r){this.h=+t,this.s=+e,this.l=+n,this.opacity=+r}function Q(){}function tt(){}r(K,function(t,e,n,r){return 1===arguments.length?function(t){if(t instanceof K)return new K(t.h,t.s,t.l,t.opacity);t instanceof k||(t=x(t));var e=t.r/255,n=t.g/255,r=t.b/255,i=(Z*r+X*e-Y*n)/(Z+X-Y),o=r-i,l=(G*(n-i)-R*o)/U,a=Math.sqrt(l*l+o*o)/(G*i*(1-i)),s=a?Math.atan2(l,o)*$-120:NaN;return new K(s<0?s+360:s,a,i,t.opacity)}(t):new K(t,e,n,null==r?1:r)},i(o,{brighter:function(t){return t=null==t?1/.7:Math.pow(1/.7,t),new K(this.h,this.s,this.l*t,this.opacity)},darker:function(t){return t=null==t?.7:Math.pow(.7,t),new K(this.h,this.s,this.l*t,this.opacity)},rgb:function(){var t=isNaN(this.h)?0:(this.h+120)*_,e=+this.l,n=isNaN(this.s)?0:this.s*e*(1-e),r=Math.cos(t),i=Math.sin(t);return new k(255*(e+n*(J*r+B*i)),255*(e+n*(R*r+U*i)),255*(e+n*(G*r)),this.opacity)}})),Q.prototype._palette=e.Palette.ordinal("default"),Q.prototype.fillColor=function(t,e,n){return this._palette(t[0])},Q.prototype.strokeColor=function(t,e,n){return C(this.fillColor(t,e,n)).darker().toString()},Q.prototype.textColor=function(t,n,r){return e.Palette.textColor(this.fillColor(t,n,r))},Q.prototype.click=function(t,e,n){console.log("Click: "+JSON.stringify(t)+", "+e+", "+n)},Q.prototype.dblclick=function(t,e,n){console.log("Double click: "+JSON.stringify(t)+", "+e+", "+n)},tt.prototype.vertex_click=function(t,e,n,r){r&&r.vertex&&console.log("Vertex click: "+r.vertex.id())},tt.prototype.vertex_dblclick=function(t,e,n,r){r&&r.vertex&&console.log("Vertex double click: "+r.vertex.id())},tt.prototype.edge_click=function(t,e,n,r){r&&r.edge&&console.log("Edge click: "+r.edge.id())},tt.prototype.edge_dblclick=function(t,e,n,r){r&&r.edge&&console.log("Edge double click: "+r.edge.id())};var et=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])};function nt(t,e){function n(){this.constructor=t}et(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}var rt=function(t){function e(){return t.call(this)||this}return nt(e,t),e.prototype.isValid=function(){if(this.validate()&&!new RegExp(this.validate()).test(this.value()))return!1;return!0},e.prototype.hasValue=function(){if("function"==typeof this.type){switch(this.type()){case"radio":case"checkbox":if(this.value()&&"false"!==this.value())return!0;break;default:if(this.value())return!0}return!1}return""!==this.value()},e.prototype.blur=function(t){},e.prototype.click=function(t){},e.prototype.dblclick=function(t){},e.prototype.change=function(t,e){},e.prototype.resetValue=function(t){t.value(t._inputElement[0].node().value)},e.prototype.disable=function(t){this._inputElement.forEach(function(e,n){e.attr("disabled",t?"disabled":null)})},e.prototype.setFocus=function(){this._inputElement.length&&this._inputElement[0].node().focus()},e}(e.Widget);function it(){}function ot(t,e){if((n=(t=e?t.toExponential(e-1):t.toExponential()).indexOf("e"))<0)return null;var n,r=t.slice(0,n);return[r.length>1?r[0]+r.slice(2):r,+t.slice(n+1)]}rt.prototype.publish("name","","string","HTML name for the input"),rt.prototype.publish("label","","string","Descriptive label"),rt.prototype.publish("value","","string","Input Current Value"),rt.prototype.publish("validate",null,"string","Input Validation"),it.prototype._palette=e.Palette.ordinal("default"),it.prototype.fillColor=function(t,e,n){return this._palette(e)},it.prototype.strokeColor=function(t,e,n){return C(this.fillColor(t,e,n)).darker().toString()},it.prototype.textColor=function(t,n,r){return e.Palette.textColor(this.fillColor(t,n,r))},it.prototype.click=function(t,e,n){console.log("Click: "+JSON.stringify(t)+", "+e+", "+n)},it.prototype.dblclick=function(t,e,n){console.log("Double click: "+JSON.stringify(t)+", "+e+", "+n)};var lt,at=/^(?:(.)?([<>=^]))?([+\-\( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function st(t){return new ut(t)}function ut(t){if(!(e=at.exec(t)))throw new Error("invalid format: "+t);var e;this.fill=e[1]||" ",this.align=e[2]||">",this.sign=e[3]||"-",this.symbol=e[4]||"",this.zero=!!e[5],this.width=e[6]&&+e[6],this.comma=!!e[7],this.precision=e[8]&&+e[8].slice(1),this.trim=!!e[9],this.type=e[10]||""}function ct(t,e){var n=ot(t,e);if(!n)return t+"";var r=n[0],i=n[1];return i<0?"0."+new Array(-i).join("0")+r:r.length>i+1?r.slice(0,i+1)+"."+r.slice(i+1):r+new Array(i-r.length+2).join("0")}st.prototype=ut.prototype,ut.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(null==this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(null==this.precision?"":"."+Math.max(0,0|this.precision))+(this.trim?"~":"")+this.type};var ht={"%":function(t,e){return(100*t).toFixed(e)},b:function(t){return Math.round(t).toString(2)},c:function(t){return t+""},d:function(t){return Math.round(t).toString(10)},e:function(t,e){return t.toExponential(e)},f:function(t,e){return t.toFixed(e)},g:function(t,e){return t.toPrecision(e)},o:function(t){return Math.round(t).toString(8)},p:function(t,e){return ct(100*t,e)},r:ct,s:function(t,e){var n=ot(t,e);if(!n)return t+"";var r=n[0],i=n[1],o=i-(lt=3*Math.max(-8,Math.min(8,Math.floor(i/3))))+1,l=r.length;return o===l?r:o>l?r+new Array(o-l+1).join("0"):o>0?r.slice(0,o)+"."+r.slice(o):"0."+new Array(1-o).join("0")+ot(t,Math.max(0,e+o-1))[0]},X:function(t){return Math.round(t).toString(16).toUpperCase()},x:function(t){return Math.round(t).toString(16)}};function pt(t){return t}var ft,dt,yt=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function gt(t){var e,n,r=t.grouping&&t.thousands?(e=t.grouping,n=t.thousands,function(t,r){for(var i=t.length,o=[],l=0,a=e[0],s=0;i>0&&a>0&&(s+a+1>r&&(a=Math.max(1,r-s)),o.push(t.substring(i-=a,i+a)),!((s+=a+1)>r));)a=e[l=(l+1)%e.length];return o.reverse().join(n)}):pt,i=t.currency,o=t.decimal,l=t.numerals?function(t){return function(e){return e.replace(/[0-9]/g,function(e){return t[+e]})}}(t.numerals):pt,a=t.percent||"%";function s(t){var e=(t=st(t)).fill,n=t.align,s=t.sign,u=t.symbol,c=t.zero,h=t.width,p=t.comma,f=t.precision,d=t.trim,y=t.type;"n"===y?(p=!0,y="g"):ht[y]||(null==f&&(f=12),d=!0,y="g"),(c||"0"===e&&"="===n)&&(c=!0,e="0",n="=");var g="$"===u?i[0]:"#"===u&&/[boxX]/.test(y)?"0"+y.toLowerCase():"",m="$"===u?i[1]:/[%p]/.test(y)?a:"",b=ht[y],v=/[defgprs%]/.test(y);function w(t){var i,a,u,w=g,x=m;if("c"===y)x=b(t)+x,t="";else{var k=(t=+t)<0;if(t=b(Math.abs(t),f),d&&(t=function(t){t:for(var e,n=t.length,r=1,i=-1;r<n;++r)switch(t[r]){case".":i=e=r;break;case"0":0===i&&(i=r),e=r;break;default:if(i>0){if(!+t[r])break t;i=0}}return i>0?t.slice(0,i)+t.slice(e+1):t}(t)),k&&0==+t&&(k=!1),w=(k?"("===s?s:"-":"-"===s||"("===s?"":s)+w,x=("s"===y?yt[8+lt/3]:"")+x+(k&&"("===s?")":""),v)for(i=-1,a=t.length;++i<a;)if(48>(u=t.charCodeAt(i))||u>57){x=(46===u?o+t.slice(i+1):t.slice(i))+x,t=t.slice(0,i);break}}p&&!c&&(t=r(t,1/0));var M=w.length+t.length+x.length,N=M<h?new Array(h-M+1).join(e):"";switch(p&&c&&(t=r(N+t,N.length?h-x.length:1/0),N=""),n){case"<":t=w+t+x+N;break;case"=":t=w+N+t+x;break;case"^":t=N.slice(0,M=N.length>>1)+w+t+x+N.slice(M);break;default:t=N+w+t+x}return l(t)}return f=null==f?6:/[gprs]/.test(y)?Math.max(1,Math.min(21,f)):Math.max(0,Math.min(20,f)),w.toString=function(){return t+""},w}return{format:s,formatPrefix:function(t,e){var n,r=s(((t=st(t)).type="f",t)),i=3*Math.max(-8,Math.min(8,Math.floor((n=e,((n=ot(Math.abs(n)))?n[1]:NaN)/3)))),o=Math.pow(10,-i),l=yt[8+i/3];return function(t){return r(o*t)+l}}}}ft=gt({decimal:".",thousands:",",grouping:[3],currency:["$",""]}),dt=ft.format,ft.formatPrefix;function mt(){}function bt(t,e){var n=new mt;if(t instanceof mt)t.each(function(t,e){n.set(e,t)});else if(Array.isArray(t)){var r,i=-1,o=t.length;if(null==e)for(;++i<o;)n.set(i,t[i]);else for(;++i<o;)n.set(e(r=t[i],i,t),r)}else if(t)for(var l in t)n.set(l,t[l]);return n}function vt(){}mt.prototype=bt.prototype={constructor:mt,has:function(t){return"$"+t in this},get:function(t){return this["$"+t]},set:function(t,e){return this["$"+t]=e,this},remove:function(t){var e="$"+t;return e in this&&delete this[e]},clear:function(){for(var t in this)"$"===t[0]&&delete this[t]},keys:function(){var t=[];for(var e in this)"$"===e[0]&&t.push(e.slice(1));return t},values:function(){var t=[];for(var e in this)"$"===e[0]&&t.push(this[e]);return t},entries:function(){var t=[];for(var e in this)"$"===e[0]&&t.push({key:e.slice(1),value:this[e]});return t},size:function(){var t=0;for(var e in this)"$"===e[0]&&++t;return t},empty:function(){for(var t in this)if("$"===t[0])return!1;return!0},each:function(t){for(var e in this)"$"===e[0]&&t(this[e],e.slice(1),this)}};var wt=bt.prototype;vt.prototype=function(t,e){var n=new vt;if(t instanceof vt)t.each(function(t){n.add(t)});else if(t){var r=-1,i=t.length;if(null==e)for(;++r<i;)n.add(t[r]);else for(;++r<i;)n.add(e(t[r],r,t))}return n}.prototype={constructor:vt,has:wt.has,add:function(t){return this["$"+(t+="")]=t,this},remove:wt.remove,clear:wt.clear,values:wt.keys,size:wt.size,empty:wt.empty,each:wt.each};!function(t,e){void 0===e&&(e={});var n=e.insertAt;if(t&&"undefined"!=typeof document){var r=document.head||document.getElementsByTagName("head")[0],i=document.createElement("style");i.type="text/css","top"===n&&r.firstChild?r.insertBefore(i,r.firstChild):r.appendChild(i),i.styleSheet?i.styleSheet.cssText=t:i.appendChild(document.createTextNode(t))}}('.d3-tip {\r\n line-height: 1;\r\n font-weight: bold;\r\n padding: 12px;\r\n background: rgba(0, 0, 0, 0.66);\r\n color: #fff;\r\n border-radius: 2px;\r\n pointer-events: none !important;\r\n z-index:10;\r\n}\r\n\r\n.d3-tip.hidden {\r\n visibility:hidden;\r\n}\r\n\r\n/* Creates a small triangle extender for the tooltip */\r\n.d3-tip:after {\r\n box-sizing: border-box;\r\n display: inline;\r\n font-size: 10px;\r\n width: 100%;\r\n line-height: 1;\r\n color: rgba(0, 0, 0, 0.66);\r\n position: absolute;\r\n pointer-events: none !important;\r\n}\r\n\r\n/* Northward tooltips */\r\n.d3-tip.n:after {\r\n content: "\\25BC";\r\n margin: -1px 0 0 0;\r\n top: 100%;\r\n left: 0;\r\n text-align: center;\r\n}\r\n\r\n/* Eastward tooltips */\r\n.d3-tip.e:after {\r\n content: "\\25C0";\r\n margin: -4px 0 0 0;\r\n top: 50%;\r\n left: -8px;\r\n}\r\n\r\n/* Southward tooltips */\r\n.d3-tip.s:after {\r\n content: "\\25B2";\r\n margin: 0 0 1px 0;\r\n top: -8px;\r\n left: 0;\r\n text-align: center;\r\n}\r\n\r\n/* Westward tooltips */\r\n.d3-tip.w:after {\r\n content: "\\25B6";\r\n margin: -4px 0 0 -1px;\r\n top: 50%;\r\n left: 100%;\r\n}\r\n\r\n.d3-tip.notick:after {\r\n content: "" !important;\r\n}\r\n\r\n.common_Widget .over {\r\n stroke: rgba(0, 0, 0, 0.66);\r\n opacity: 0.66;\r\n}\r\n');var xt=function(t){function n(){var n=t.call(this)||this;if(n.tooltip=function(){var t=function(){return"n"},n=function(){return[0,0]},r=function(){return" "},i=y(document.body),o=p(),l=null,a=null,s=null;function u(t){var e;e=t.node(),(l=e?"svg"===e.tagName.toLowerCase()?e:e.ownerSVGElement:null)&&(a=l.createSVGPoint(),i().appendChild(o))}u.show=function(){var e=Array.prototype.slice.call(arguments);e[e.length-1]instanceof SVGElement&&(s=e.pop());var o,l=r.apply(this,e),a=n.apply(this,e),p=t.apply(this,e),d=f(),y=h.length,g=document.documentElement.scrollTop||i().scrollTop,m=document.documentElement.scrollLeft||i().scrollLeft;for(d.html(l).style("opacity",1).style("pointer-events","all");y--;)d.classed(h[y],!1);return o=c.get(p).apply(this),d.classed(p,!0).style("top",o.top+a[0]+g+"px").style("left",o.left+a[1]+m+"px"),u},u.hide=function(){return f().style("opacity",0).style("pointer-events","none"),u},u.attr=function(t,n){if(arguments.length<2&&"string"==typeof t)return f().attr(t);var r=Array.prototype.slice.call(arguments);return e.selection.prototype.attr.apply(f(),r),u},u.style=function(t,n){if(arguments.length<2&&"string"==typeof t)return f().style(t);var r=Array.prototype.slice.call(arguments);return e.selection.prototype.style.apply(f(),r),u},u.direction=function(e){return arguments.length?(t=null==e?e:y(e),u):t},u.offset=function(t){return arguments.length?(n=null==t?t:y(t),u):n},u.html=function(t){return arguments.length?(r=null==t?t:y(t),u):r},u.rootElement=function(t){return arguments.length?(i=null==t?t:y(t),u):i},u.destroy=function(){return o&&(f().remove(),o=null),u};var c=bt({n:function(){var t=d();return{top:t.n.y-o.offsetHeight,left:t.n.x-o.offsetWidth/2}},s:function(){var t=d();return{top:t.s.y,left:t.s.x-o.offsetWidth/2}},e:function(){var t=d();return{top:t.e.y-o.offsetHeight/2,left:t.e.x}},w:function(){var t=d();return{top:t.w.y-o.offsetHeight/2,left:t.w.x-o.offsetWidth}},nw:function(){var t=d();return{top:t.nw.y-o.offsetHeight,left:t.nw.x-o.offsetWidth}},ne:function(){var t=d();return{top:t.ne.y-o.offsetHeight,left:t.ne.x}},sw:function(){var t=d();return{top:t.sw.y,left:t.sw.x-o.offsetWidth}},se:function(){var t=d();return{top:t.se.y,left:t.se.x}}}),h=c.keys();function p(){var t=e.select(document.createElement("div"));return t.style("position","absolute").style("top",0).style("opacity",0).style("pointer-events","none").style("box-sizing","border-box"),t.node()}function f(){return null==o&&(o=p(),i().appendChild(o)),e.select(o)}function d(){for(var t=s||event.target;null==t.getScreenCTM&&null==t.parentNode;)t=t.parentNode;var e={},n=t.getScreenCTM(),r=t.getBBox(),i=r.width,o=r.height,l=r.x,u=r.y;return a.x=l,a.y=u,e.nw=a.matrixTransform(n),a.x+=i,e.ne=a.matrixTransform(n),a.y+=o,e.se=a.matrixTransform(n),a.x-=i,e.sw=a.matrixTransform(n),a.y-=o/2,e.w=a.matrixTransform(n),a.x+=i,e.e=a.matrixTransform(n),a.x-=i/2,a.y-=o/2,e.n=a.matrixTransform(n),a.y+=o,e.s=a.matrixTransform(n),e}function y(t){return"function"==typeof t?t:function(){return t}}return u}().attr("class","d3-tip"),n._valueFormatter=dt(n.tooltipValueFormat()),n.layerEnter){var r=n.layerEnter;n.layerEnter=function(t,e,n){this.tooltipEnter(e),r.apply(this,arguments)};var i=n.layerUpdate;n.layerUpdate=function(t){i.apply(this,arguments),this.tooltipUpdate()};var o=n.layerExit;n.layerExit=function(t){o.apply(this,arguments),this.tooltipExit()}}else{var l=n.enter;n.enter=function(t,e){this.tooltipEnter(e),l.apply(this,arguments)};var a=n.update;n.update=function(t,e){a.apply(this,arguments),this.tooltipUpdate()};var s=n.exit;n.exit=function(t,e){s.apply(this,arguments),this.tooltipExit()}}return n}return nt(n,t),n.prototype.tooltipEnter=function(t){t.call(this.tooltip)},n.prototype.tooltipUpdate=function(){var t=this;this.tooltip.offset(function(){switch(t.tooltip.direction()()){case"e":return[0,t.tooltipOffset()];default:return[-t.tooltipOffset(),0]}});var e=this.tooltip.attr("class");e&&(e=e.split(" notick").join("")+(this.tooltipTick()?"":" notick")+("none"===this.tooltipStyle()?" hidden":""),this.tooltip.attr("class",e))},n.prototype.tooltipExit=function(){this.tooltip&&this.tooltip.destroy()},n.prototype._tooltipHTML=function(t){return t},n.prototype.tooltipHTML=function(t){return this.tooltip.html(t)},n.prototype.tooltipFormat=function(t){switch((t=t||{}).label=void 0===t.label?"":t.label,t.series=t.series||"",t.value instanceof Date?t.value=t.value||"":t.value=this._valueFormatter(t.value)||"",this.tooltipStyle()){case"none":break;default:return t.series?"<span style='color:"+this.tooltipSeriesColor()+"'>"+t.series+"</span> / <span style='color:"+this.tooltipLabelColor()+"'>"+t.label+"</span>: <span style='color:"+this.tooltipValueColor()+"'>"+t.value+"</span>":"<span style='color:"+this.tooltipLabelColor()+"'>"+t.label+"</span>: <span style='color:"+this.tooltipValueColor()+"'>"+t.value+"</span>"}},n}(e.Widget);xt.prototype.publish("tooltipStyle","default","set","Style",["default","none"],{}),xt.prototype.publish("tooltipValueFormat",",.2f","string","Value Format",null,{}),xt.prototype.publish("tooltipSeriesColor","#EAFFFF","html-color","Series Color",null,{}),xt.prototype.publish("tooltipLabelColor","#CCFFFF","html-color","Label Color",null,{}),xt.prototype.publish("tooltipValueColor","white","html-color","Value Color",null,{}),xt.prototype.publish("tooltipTick",!0,"boolean","Show tooltip tick",null,{}),xt.prototype.publish("tooltipOffset",8,"number","Offset from the cursor",null,{});var kt=xt.prototype.tooltipValueFormat;xt.prototype.tooltipValueFormat=function(t){var e=kt.apply(this,arguments);return arguments.length&&(this._valueFormatter=dt(t)),e};var Mt=function(){function t(){}return t.prototype.click=function(t,e,n){console.log("Click: "+JSON.stringify(t)+", "+e+", "+n)},t.prototype.dblclick=function(t,e,n){console.log("Double click: "+JSON.stringify(t)+", "+e+", "+n)},t}();Mt.prototype._palette=e.Palette.ordinal("default"),t.I1DChart=n,t.I2DChart=Q,t.IGraph=tt,t.instanceOfIHighlight=function(t){return"function"==typeof t.highlightColumn},t.IInput=rt,t.INDChart=it,t.ITooltip=xt,t.ITree=Mt,Object.defineProperty(t,"__esModule",{value:!0})}); |
{ | ||
"name": "@hpcc-js/api", | ||
"version": "0.1.3", | ||
"version": "0.2.0", | ||
"description": "hpcc-js - Viz api", | ||
@@ -28,6 +28,7 @@ "main": "dist/index.js", | ||
"dependencies": { | ||
"@hpcc-js/common": "^0.4.0" | ||
"@hpcc-js/common": "^0.5.0" | ||
}, | ||
"devDependencies": { | ||
"concurrently": "3.5.1", | ||
"d3-color": "1.2.0", | ||
"d3-format": "1.3.0", | ||
@@ -34,0 +35,0 @@ "d3-tip": "GordonSmith/d3-tip#vJSNEXT", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
422444
3012
15
+ Added@hpcc-js/common@0.5.0(transitive)
- Removed@hpcc-js/common@0.4.0(transitive)
Updated@hpcc-js/common@^0.5.0