@hpcc-js/api
Advanced tools
Comparing version 0.0.74 to 0.0.75
@@ -1,19 +0,1 @@ | ||
function __$styleInject(css, returnValue) { | ||
if (typeof document === 'undefined') { | ||
return returnValue; | ||
} | ||
css = css || ''; | ||
var head = document.head || document.getElementsByTagName('head')[0]; | ||
var style = document.createElement('style'); | ||
style.type = 'text/css'; | ||
head.appendChild(style); | ||
if (style.styleSheet){ | ||
style.styleSheet.cssText = css; | ||
} else { | ||
style.appendChild(document.createTextNode(css)); | ||
} | ||
return returnValue; | ||
} | ||
import { Palette, Widget, select, selection } from '@hpcc-js/common'; | ||
@@ -589,7 +571,4 @@ | ||
*/ | ||
// eslint-disable-next-line no-extra-semi | ||
// Public - contructs a new tooltip | ||
// | ||
// Returns a tip | ||
function tip() { | ||
function tip() { | ||
var direction = d3TipDirection, | ||
@@ -914,9 +893,37 @@ offset = d3TipOffset, | ||
__$styleInject(".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",undefined); | ||
function styleInject(css, ref) { | ||
if ( ref === void 0 ) ref = {}; | ||
var insertAt = ref.insertAt; | ||
// const tip = _tip.tip || _tip.default || _tip; | ||
var ITooltip$1 = /** @class */ (function (_super) { | ||
if (!css || typeof document === 'undefined') { return; } | ||
var head = document.head || document.getElementsByTagName('head')[0]; | ||
var style = document.createElement('style'); | ||
style.type = 'text/css'; | ||
if (insertAt === 'top') { | ||
if (head.firstChild) { | ||
head.insertBefore(style, head.firstChild); | ||
} else { | ||
head.appendChild(style); | ||
} | ||
} else { | ||
head.appendChild(style); | ||
} | ||
if (style.styleSheet) { | ||
style.styleSheet.cssText = css; | ||
} else { | ||
style.appendChild(document.createTextNode(css)); | ||
} | ||
} | ||
var css = ".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"; | ||
styleInject(css); | ||
var ITooltip = /** @class */ (function (_super) { | ||
__extends(ITooltip, _super); | ||
function ITooltip() { | ||
var _this = _super.call(this) || this; | ||
_this.tooltip = tip().attr("class", "d3-tip"); | ||
_this._valueFormatter = format(_this.tooltipValueFormat()); | ||
@@ -960,16 +967,14 @@ if (_this.layerEnter) { | ||
ITooltip.prototype.tooltipEnter = function (element) { | ||
var context = this; | ||
this.tooltip = tip() | ||
.attr("class", "d3-tip") | ||
.offset(function () { | ||
switch (context.tooltip.direction()()) { | ||
element.call(this.tooltip); | ||
}; | ||
ITooltip.prototype.tooltipUpdate = function () { | ||
var _this = this; | ||
this.tooltip.offset(function () { | ||
switch (_this.tooltip.direction()()) { | ||
case "e": | ||
return [0, context.tooltipOffset()]; | ||
return [0, _this.tooltipOffset()]; | ||
default: | ||
return [-context.tooltipOffset(), 0]; | ||
return [-_this.tooltipOffset(), 0]; | ||
} | ||
}); | ||
element.call(this.tooltip); | ||
}; | ||
ITooltip.prototype.tooltipUpdate = function () { | ||
var classed = this.tooltip.attr("class"); | ||
@@ -1015,11 +1020,11 @@ if (classed) { | ||
}(Widget)); | ||
ITooltip$1.prototype.publish("tooltipStyle", "default", "set", "Style", ["default", "none"], {}); | ||
ITooltip$1.prototype.publish("tooltipValueFormat", ",.2f", "string", "Value Format", null, {}); | ||
ITooltip$1.prototype.publish("tooltipSeriesColor", "#EAFFFF", "html-color", "Series Color", null, {}); | ||
ITooltip$1.prototype.publish("tooltipLabelColor", "#CCFFFF", "html-color", "Label Color", null, {}); | ||
ITooltip$1.prototype.publish("tooltipValueColor", "white", "html-color", "Value Color", null, {}); | ||
ITooltip$1.prototype.publish("tooltipTick", true, "boolean", "Show tooltip tick", null, {}); | ||
ITooltip$1.prototype.publish("tooltipOffset", 8, "number", "Offset from the cursor", null, {}); | ||
var tooltipValueFormat = ITooltip$1.prototype.tooltipValueFormat; | ||
ITooltip$1.prototype.tooltipValueFormat = function (_) { | ||
ITooltip.prototype.publish("tooltipStyle", "default", "set", "Style", ["default", "none"], {}); | ||
ITooltip.prototype.publish("tooltipValueFormat", ",.2f", "string", "Value Format", null, {}); | ||
ITooltip.prototype.publish("tooltipSeriesColor", "#EAFFFF", "html-color", "Series Color", null, {}); | ||
ITooltip.prototype.publish("tooltipLabelColor", "#CCFFFF", "html-color", "Label Color", null, {}); | ||
ITooltip.prototype.publish("tooltipValueColor", "white", "html-color", "Value Color", null, {}); | ||
ITooltip.prototype.publish("tooltipTick", true, "boolean", "Show tooltip tick", null, {}); | ||
ITooltip.prototype.publish("tooltipOffset", 8, "number", "Offset from the cursor", null, {}); | ||
var tooltipValueFormat = ITooltip.prototype.tooltipValueFormat; | ||
ITooltip.prototype.tooltipValueFormat = function (_) { | ||
var retVal = tooltipValueFormat.apply(this, arguments); | ||
@@ -1046,3 +1051,3 @@ if (arguments.length) { | ||
export { I1DChart, I2DChart, IGraph, instanceOfIHighlight, IInput, INDChart, ITooltip$1 as ITooltip, ITree }; | ||
export { I1DChart, I2DChart, IGraph, instanceOfIHighlight, IInput, INDChart, ITooltip, ITree }; | ||
//# sourceMappingURL=index.es6.js.map |
1823
dist/index.js
(function (global, factory) { | ||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@hpcc-js/common')) : | ||
typeof define === 'function' && define.amd ? define(['exports', '@hpcc-js/common'], factory) : | ||
(factory((global['@hpcc-js/api'] = {}),global['@hpcc-js/common'])); | ||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@hpcc-js/common')) : | ||
typeof define === 'function' && define.amd ? define(['exports', '@hpcc-js/common'], factory) : | ||
(factory((global['@hpcc-js/api'] = {}),global['@hpcc-js/common'])); | ||
}(this, (function (exports,common) { 'use strict'; | ||
function __$styleInject(css, returnValue) { | ||
if (typeof document === 'undefined') { | ||
return returnValue; | ||
} | ||
css = css || ''; | ||
var head = document.head || document.getElementsByTagName('head')[0]; | ||
var style = document.createElement('style'); | ||
style.type = 'text/css'; | ||
head.appendChild(style); | ||
if (style.styleSheet){ | ||
style.styleSheet.cssText = css; | ||
} else { | ||
style.appendChild(document.createTextNode(css)); | ||
} | ||
return returnValue; | ||
} | ||
function I1DChart() { | ||
} | ||
I1DChart.prototype._palette = common.Palette.rainbow("default"); | ||
// Events --- | ||
I1DChart.prototype.click = function (row, column, selected) { | ||
console.log("Click: " + JSON.stringify(row) + ", " + column + ", " + selected); | ||
}; | ||
I1DChart.prototype.dblclick = function (row, column, selected) { | ||
console.log("Double click: " + JSON.stringify(row) + ", " + column + ", " + selected); | ||
}; | ||
function I1DChart() { | ||
} | ||
I1DChart.prototype._palette = common.Palette.rainbow("default"); | ||
// Events --- | ||
I1DChart.prototype.click = function (row, column, selected) { | ||
console.log("Click: " + JSON.stringify(row) + ", " + column + ", " + selected); | ||
}; | ||
I1DChart.prototype.dblclick = function (row, column, selected) { | ||
console.log("Double click: " + JSON.stringify(row) + ", " + column + ", " + selected); | ||
}; | ||
function I2DChart() { | ||
} | ||
I2DChart.prototype._palette = common.Palette.ordinal("default"); | ||
// Events --- | ||
I2DChart.prototype.click = function (row, column, selected) { | ||
console.log("Click: " + JSON.stringify(row) + ", " + column + ", " + selected); | ||
}; | ||
I2DChart.prototype.dblclick = function (row, column, selected) { | ||
console.log("Double click: " + JSON.stringify(row) + ", " + column + ", " + selected); | ||
}; | ||
function I2DChart() { | ||
} | ||
I2DChart.prototype._palette = common.Palette.ordinal("default"); | ||
// Events --- | ||
I2DChart.prototype.click = function (row, column, selected) { | ||
console.log("Click: " + JSON.stringify(row) + ", " + column + ", " + selected); | ||
}; | ||
I2DChart.prototype.dblclick = function (row, column, selected) { | ||
console.log("Double click: " + JSON.stringify(row) + ", " + column + ", " + selected); | ||
}; | ||
function IGraph() { | ||
} | ||
// Events --- | ||
IGraph.prototype.vertex_click = function (_row, _col, _sel, more) { | ||
if (more && more.vertex) { | ||
console.log("Vertex click: " + more.vertex.id()); | ||
} | ||
}; | ||
IGraph.prototype.vertex_dblclick = function (_row, _col, _sel, more) { | ||
if (more && more.vertex) { | ||
console.log("Vertex double click: " + more.vertex.id()); | ||
} | ||
}; | ||
IGraph.prototype.edge_click = function (_row, _col, _sel, more) { | ||
if (more && more.edge) { | ||
console.log("Edge click: " + more.edge.id()); | ||
} | ||
}; | ||
IGraph.prototype.edge_dblclick = function (_row, _col, _sel, more) { | ||
if (more && more.edge) { | ||
console.log("Edge double click: " + more.edge.id()); | ||
} | ||
}; | ||
function IGraph() { | ||
} | ||
// Events --- | ||
IGraph.prototype.vertex_click = function (_row, _col, _sel, more) { | ||
if (more && more.vertex) { | ||
console.log("Vertex click: " + more.vertex.id()); | ||
function instanceOfIHighlight(w) { | ||
return typeof w.highlightColumn === "function"; | ||
} | ||
}; | ||
IGraph.prototype.vertex_dblclick = function (_row, _col, _sel, more) { | ||
if (more && more.vertex) { | ||
console.log("Vertex double click: " + more.vertex.id()); | ||
} | ||
}; | ||
IGraph.prototype.edge_click = function (_row, _col, _sel, more) { | ||
if (more && more.edge) { | ||
console.log("Edge click: " + more.edge.id()); | ||
} | ||
}; | ||
IGraph.prototype.edge_dblclick = function (_row, _col, _sel, more) { | ||
if (more && more.edge) { | ||
console.log("Edge double click: " + more.edge.id()); | ||
} | ||
}; | ||
function instanceOfIHighlight(w) { | ||
return typeof w.highlightColumn === "function"; | ||
} | ||
/*! ***************************************************************************** | ||
Copyright (c) Microsoft Corporation. All rights reserved. | ||
Licensed under the Apache License, Version 2.0 (the "License"); you may not use | ||
this file except in compliance with the License. You may obtain a copy of the | ||
License at http://www.apache.org/licenses/LICENSE-2.0 | ||
/*! ***************************************************************************** | ||
Copyright (c) Microsoft Corporation. All rights reserved. | ||
Licensed under the Apache License, Version 2.0 (the "License"); you may not use | ||
this file except in compliance with the License. You may obtain a copy of the | ||
License at http://www.apache.org/licenses/LICENSE-2.0 | ||
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED | ||
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, | ||
MERCHANTABLITY OR NON-INFRINGEMENT. | ||
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED | ||
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, | ||
MERCHANTABLITY OR NON-INFRINGEMENT. | ||
See the Apache Version 2.0 License for specific language governing permissions | ||
and limitations under the License. | ||
***************************************************************************** */ | ||
/* global Reflect, Promise */ | ||
See the Apache Version 2.0 License for specific language governing permissions | ||
and limitations under the License. | ||
***************************************************************************** */ | ||
/* global Reflect, Promise */ | ||
var extendStatics = Object.setPrototypeOf || | ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || | ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; | ||
var extendStatics = Object.setPrototypeOf || | ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || | ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; | ||
function __extends(d, b) { | ||
extendStatics(d, b); | ||
function __() { this.constructor = d; } | ||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); | ||
} | ||
function __extends(d, b) { | ||
extendStatics(d, b); | ||
function __() { this.constructor = d; } | ||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); | ||
} | ||
var IInput = /** @class */ (function (_super) { | ||
__extends(IInput, _super); | ||
function IInput() { | ||
return _super.call(this) || this; | ||
} | ||
// Implementation --- | ||
IInput.prototype.isValid = function () { | ||
if (this.validate()) { | ||
var re = new RegExp(this.validate()); | ||
if (!re.test(this.value())) { | ||
var IInput = /** @class */ (function (_super) { | ||
__extends(IInput, _super); | ||
function IInput() { | ||
return _super.call(this) || this; | ||
} | ||
// Implementation --- | ||
IInput.prototype.isValid = function () { | ||
if (this.validate()) { | ||
var re = new RegExp(this.validate()); | ||
if (!re.test(this.value())) { | ||
return false; | ||
} | ||
} | ||
return true; | ||
}; | ||
IInput.prototype.hasValue = function () { | ||
if (typeof this.type === "function") { | ||
switch (this.type()) { | ||
case "radio": | ||
/* falls through */ | ||
case "checkbox": | ||
if (this.value() && this.value() !== "false") { | ||
return true; | ||
} | ||
break; | ||
default: | ||
if (this.value()) { | ||
return true; | ||
} | ||
break; | ||
} | ||
return false; | ||
} | ||
} | ||
return true; | ||
}; | ||
IInput.prototype.hasValue = function () { | ||
if (typeof this.type === "function") { | ||
switch (this.type()) { | ||
case "radio": | ||
/* falls through */ | ||
case "checkbox": | ||
if (this.value() && this.value() !== "false") { | ||
return true; | ||
} | ||
break; | ||
default: | ||
if (this.value()) { | ||
return true; | ||
} | ||
break; | ||
return this.value() !== ""; | ||
}; | ||
// Events --- | ||
IInput.prototype.blur = function (_w) { | ||
}; | ||
IInput.prototype.click = function (_w) { | ||
}; | ||
IInput.prototype.dblclick = function (_w) { | ||
}; | ||
IInput.prototype.change = function (_w, complete) { | ||
}; | ||
IInput.prototype.resetValue = function (w) { | ||
w.value(w._inputElement[0].node().value); | ||
}; | ||
IInput.prototype.disable = function (disable) { | ||
this._inputElement.forEach(function (e, idx) { | ||
e.attr("disabled", disable ? "disabled" : null); | ||
}); | ||
}; | ||
IInput.prototype.setFocus = function () { | ||
if (this._inputElement.length) { | ||
this._inputElement[0].node().focus(); | ||
} | ||
return false; | ||
} | ||
return this.value() !== ""; | ||
}; | ||
}; | ||
return IInput; | ||
}(common.Widget)); | ||
IInput.prototype.publish("name", "", "string", "HTML name for the input"); | ||
IInput.prototype.publish("label", "", "string", "Descriptive label"); | ||
IInput.prototype.publish("value", "", "string", "Input Current Value"); | ||
IInput.prototype.publish("validate", null, "string", "Input Validation"); | ||
function INDChart() { | ||
} | ||
INDChart.prototype._palette = common.Palette.ordinal("default"); | ||
// Events --- | ||
IInput.prototype.blur = function (_w) { | ||
INDChart.prototype.click = function (row, column, selected) { | ||
console.log("Click: " + JSON.stringify(row) + ", " + column + ", " + selected); | ||
}; | ||
IInput.prototype.click = function (_w) { | ||
INDChart.prototype.dblclick = function (row, column, selected) { | ||
console.log("Double click: " + JSON.stringify(row) + ", " + column + ", " + selected); | ||
}; | ||
IInput.prototype.dblclick = function (_w) { | ||
}; | ||
IInput.prototype.change = function (_w, complete) { | ||
}; | ||
IInput.prototype.resetValue = function (w) { | ||
w.value(w._inputElement[0].node().value); | ||
}; | ||
IInput.prototype.disable = function (disable) { | ||
this._inputElement.forEach(function (e, idx) { | ||
e.attr("disabled", disable ? "disabled" : null); | ||
}); | ||
}; | ||
IInput.prototype.setFocus = function () { | ||
if (this._inputElement.length) { | ||
this._inputElement[0].node().focus(); | ||
} | ||
}; | ||
return IInput; | ||
}(common.Widget)); | ||
IInput.prototype.publish("name", "", "string", "HTML name for the input"); | ||
IInput.prototype.publish("label", "", "string", "Descriptive label"); | ||
IInput.prototype.publish("value", "", "string", "Input Current Value"); | ||
IInput.prototype.publish("validate", null, "string", "Input Validation"); | ||
function INDChart() { | ||
} | ||
INDChart.prototype._palette = common.Palette.ordinal("default"); | ||
// Events --- | ||
INDChart.prototype.click = function (row, column, selected) { | ||
console.log("Click: " + JSON.stringify(row) + ", " + column + ", " + selected); | ||
}; | ||
INDChart.prototype.dblclick = function (row, column, selected) { | ||
console.log("Double click: " + JSON.stringify(row) + ", " + column + ", " + selected); | ||
}; | ||
// Computes the decimal coefficient and exponent of the specified number x with | ||
// significant digits p, where x is positive and p is in [1, 21] or undefined. | ||
// For example, formatDecimal(1.23) returns ["123", 0]. | ||
function formatDecimal(x, p) { | ||
if ((i = (x = p ? x.toExponential(p - 1) : x.toExponential()).indexOf("e")) < 0) return null; // NaN, ±Infinity | ||
var i, coefficient = x.slice(0, i); | ||
// Computes the decimal coefficient and exponent of the specified number x with | ||
// significant digits p, where x is positive and p is in [1, 21] or undefined. | ||
// For example, formatDecimal(1.23) returns ["123", 0]. | ||
function formatDecimal(x, p) { | ||
if ((i = (x = p ? x.toExponential(p - 1) : x.toExponential()).indexOf("e")) < 0) return null; // NaN, ±Infinity | ||
var i, coefficient = x.slice(0, i); | ||
// The string returned by toExponential either has the form \d\.\d+e[-+]\d+ | ||
// (e.g., 1.2e+3) or the form \de[-+]\d+ (e.g., 1e+3). | ||
return [ | ||
coefficient.length > 1 ? coefficient[0] + coefficient.slice(2) : coefficient, | ||
+x.slice(i + 1) | ||
]; | ||
} | ||
// The string returned by toExponential either has the form \d\.\d+e[-+]\d+ | ||
// (e.g., 1.2e+3) or the form \de[-+]\d+ (e.g., 1e+3). | ||
return [ | ||
coefficient.length > 1 ? coefficient[0] + coefficient.slice(2) : coefficient, | ||
+x.slice(i + 1) | ||
]; | ||
} | ||
function exponent(x) { | ||
return x = formatDecimal(Math.abs(x)), x ? x[1] : NaN; | ||
} | ||
function exponent(x) { | ||
return x = formatDecimal(Math.abs(x)), x ? x[1] : NaN; | ||
} | ||
function formatGroup(grouping, thousands) { | ||
return function(value, width) { | ||
var i = value.length, | ||
t = [], | ||
j = 0, | ||
g = grouping[0], | ||
length = 0; | ||
function formatGroup(grouping, thousands) { | ||
return function(value, width) { | ||
var i = value.length, | ||
t = [], | ||
j = 0, | ||
g = grouping[0], | ||
length = 0; | ||
while (i > 0 && g > 0) { | ||
if (length + g + 1 > width) g = Math.max(1, width - length); | ||
t.push(value.substring(i -= g, i + g)); | ||
if ((length += g + 1) > width) break; | ||
g = grouping[j = (j + 1) % grouping.length]; | ||
} | ||
while (i > 0 && g > 0) { | ||
if (length + g + 1 > width) g = Math.max(1, width - length); | ||
t.push(value.substring(i -= g, i + g)); | ||
if ((length += g + 1) > width) break; | ||
g = grouping[j = (j + 1) % grouping.length]; | ||
return t.reverse().join(thousands); | ||
}; | ||
} | ||
return t.reverse().join(thousands); | ||
}; | ||
} | ||
function formatNumerals(numerals) { | ||
return function(value) { | ||
return value.replace(/[0-9]/g, function(i) { | ||
return numerals[+i]; | ||
}); | ||
}; | ||
} | ||
function formatNumerals(numerals) { | ||
return function(value) { | ||
return value.replace(/[0-9]/g, function(i) { | ||
return numerals[+i]; | ||
}); | ||
}; | ||
} | ||
function formatDefault(x, p) { | ||
x = x.toPrecision(p); | ||
function formatDefault(x, p) { | ||
x = x.toPrecision(p); | ||
out: for (var n = x.length, i = 1, i0 = -1, i1; i < n; ++i) { | ||
switch (x[i]) { | ||
case ".": i0 = i1 = i; break; | ||
case "0": if (i0 === 0) i0 = i; i1 = i; break; | ||
case "e": break out; | ||
default: if (i0 > 0) i0 = 0; break; | ||
} | ||
} | ||
out: for (var n = x.length, i = 1, i0 = -1, i1; i < n; ++i) { | ||
switch (x[i]) { | ||
case ".": i0 = i1 = i; break; | ||
case "0": if (i0 === 0) i0 = i; i1 = i; break; | ||
case "e": break out; | ||
default: if (i0 > 0) i0 = 0; break; | ||
return i0 > 0 ? x.slice(0, i0) + x.slice(i1 + 1) : x; | ||
} | ||
} | ||
return i0 > 0 ? x.slice(0, i0) + x.slice(i1 + 1) : x; | ||
} | ||
var prefixExponent; | ||
var prefixExponent; | ||
function formatPrefixAuto(x, p) { | ||
var d = formatDecimal(x, p); | ||
if (!d) return x + ""; | ||
var coefficient = d[0], | ||
exponent = d[1], | ||
i = exponent - (prefixExponent = Math.max(-8, Math.min(8, Math.floor(exponent / 3))) * 3) + 1, | ||
n = coefficient.length; | ||
return i === n ? coefficient | ||
: i > n ? coefficient + new Array(i - n + 1).join("0") | ||
: i > 0 ? coefficient.slice(0, i) + "." + coefficient.slice(i) | ||
: "0." + new Array(1 - i).join("0") + formatDecimal(x, Math.max(0, p + i - 1))[0]; // less than 1y! | ||
} | ||
function formatPrefixAuto(x, p) { | ||
var d = formatDecimal(x, p); | ||
if (!d) return x + ""; | ||
var coefficient = d[0], | ||
exponent = d[1], | ||
i = exponent - (prefixExponent = Math.max(-8, Math.min(8, Math.floor(exponent / 3))) * 3) + 1, | ||
n = coefficient.length; | ||
return i === n ? coefficient | ||
: i > n ? coefficient + new Array(i - n + 1).join("0") | ||
: i > 0 ? coefficient.slice(0, i) + "." + coefficient.slice(i) | ||
: "0." + new Array(1 - i).join("0") + formatDecimal(x, Math.max(0, p + i - 1))[0]; // less than 1y! | ||
} | ||
function formatRounded(x, p) { | ||
var d = formatDecimal(x, p); | ||
if (!d) return x + ""; | ||
var coefficient = d[0], | ||
exponent = d[1]; | ||
return exponent < 0 ? "0." + new Array(-exponent).join("0") + coefficient | ||
: coefficient.length > exponent + 1 ? coefficient.slice(0, exponent + 1) + "." + coefficient.slice(exponent + 1) | ||
: coefficient + new Array(exponent - coefficient.length + 2).join("0"); | ||
} | ||
function formatRounded(x, p) { | ||
var d = formatDecimal(x, p); | ||
if (!d) return x + ""; | ||
var coefficient = d[0], | ||
exponent = d[1]; | ||
return exponent < 0 ? "0." + new Array(-exponent).join("0") + coefficient | ||
: coefficient.length > exponent + 1 ? coefficient.slice(0, exponent + 1) + "." + coefficient.slice(exponent + 1) | ||
: coefficient + new Array(exponent - coefficient.length + 2).join("0"); | ||
} | ||
var formatTypes = { | ||
"": formatDefault, | ||
"%": function(x, p) { return (x * 100).toFixed(p); }, | ||
"b": function(x) { return Math.round(x).toString(2); }, | ||
"c": function(x) { return x + ""; }, | ||
"d": function(x) { return Math.round(x).toString(10); }, | ||
"e": function(x, p) { return x.toExponential(p); }, | ||
"f": function(x, p) { return x.toFixed(p); }, | ||
"g": function(x, p) { return x.toPrecision(p); }, | ||
"o": function(x) { return Math.round(x).toString(8); }, | ||
"p": function(x, p) { return formatRounded(x * 100, p); }, | ||
"r": formatRounded, | ||
"s": formatPrefixAuto, | ||
"X": function(x) { return Math.round(x).toString(16).toUpperCase(); }, | ||
"x": function(x) { return Math.round(x).toString(16); } | ||
}; | ||
var formatTypes = { | ||
"": formatDefault, | ||
"%": function(x, p) { return (x * 100).toFixed(p); }, | ||
"b": function(x) { return Math.round(x).toString(2); }, | ||
"c": function(x) { return x + ""; }, | ||
"d": function(x) { return Math.round(x).toString(10); }, | ||
"e": function(x, p) { return x.toExponential(p); }, | ||
"f": function(x, p) { return x.toFixed(p); }, | ||
"g": function(x, p) { return x.toPrecision(p); }, | ||
"o": function(x) { return Math.round(x).toString(8); }, | ||
"p": function(x, p) { return formatRounded(x * 100, p); }, | ||
"r": formatRounded, | ||
"s": formatPrefixAuto, | ||
"X": function(x) { return Math.round(x).toString(16).toUpperCase(); }, | ||
"x": function(x) { return Math.round(x).toString(16); } | ||
}; | ||
// [[fill]align][sign][symbol][0][width][,][.precision][type] | ||
var re = /^(?:(.)?([<>=^]))?([+\-\( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?([a-z%])?$/i; | ||
// [[fill]align][sign][symbol][0][width][,][.precision][type] | ||
var re = /^(?:(.)?([<>=^]))?([+\-\( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?([a-z%])?$/i; | ||
function formatSpecifier(specifier) { | ||
return new FormatSpecifier(specifier); | ||
} | ||
function formatSpecifier(specifier) { | ||
return new FormatSpecifier(specifier); | ||
} | ||
formatSpecifier.prototype = FormatSpecifier.prototype; // instanceof | ||
formatSpecifier.prototype = FormatSpecifier.prototype; // instanceof | ||
function FormatSpecifier(specifier) { | ||
if (!(match = re.exec(specifier))) throw new Error("invalid format: " + specifier); | ||
function FormatSpecifier(specifier) { | ||
if (!(match = re.exec(specifier))) throw new Error("invalid format: " + specifier); | ||
var match, | ||
fill = match[1] || " ", | ||
align = match[2] || ">", | ||
sign = match[3] || "-", | ||
symbol = match[4] || "", | ||
zero = !!match[5], | ||
width = match[6] && +match[6], | ||
comma = !!match[7], | ||
precision = match[8] && +match[8].slice(1), | ||
type = match[9] || ""; | ||
var match, | ||
fill = match[1] || " ", | ||
align = match[2] || ">", | ||
sign = match[3] || "-", | ||
symbol = match[4] || "", | ||
zero = !!match[5], | ||
width = match[6] && +match[6], | ||
comma = !!match[7], | ||
precision = match[8] && +match[8].slice(1), | ||
type = match[9] || ""; | ||
// The "n" type is an alias for ",g". | ||
if (type === "n") comma = true, type = "g"; | ||
// The "n" type is an alias for ",g". | ||
if (type === "n") comma = true, type = "g"; | ||
// Map invalid types to the default format. | ||
else if (!formatTypes[type]) type = ""; | ||
// Map invalid types to the default format. | ||
else if (!formatTypes[type]) type = ""; | ||
// If zero fill is specified, padding goes after sign and before digits. | ||
if (zero || (fill === "0" && align === "=")) zero = true, fill = "0", align = "="; | ||
// If zero fill is specified, padding goes after sign and before digits. | ||
if (zero || (fill === "0" && align === "=")) zero = true, fill = "0", align = "="; | ||
this.fill = fill; | ||
this.align = align; | ||
this.sign = sign; | ||
this.symbol = symbol; | ||
this.zero = zero; | ||
this.width = width; | ||
this.comma = comma; | ||
this.precision = precision; | ||
this.type = type; | ||
} | ||
this.fill = fill; | ||
this.align = align; | ||
this.sign = sign; | ||
this.symbol = symbol; | ||
this.zero = zero; | ||
this.width = width; | ||
this.comma = comma; | ||
this.precision = precision; | ||
this.type = type; | ||
} | ||
FormatSpecifier.prototype.toString = function() { | ||
return this.fill | ||
+ this.align | ||
+ this.sign | ||
+ this.symbol | ||
+ (this.zero ? "0" : "") | ||
+ (this.width == null ? "" : Math.max(1, this.width | 0)) | ||
+ (this.comma ? "," : "") | ||
+ (this.precision == null ? "" : "." + Math.max(0, this.precision | 0)) | ||
+ this.type; | ||
}; | ||
FormatSpecifier.prototype.toString = function() { | ||
return this.fill | ||
+ this.align | ||
+ this.sign | ||
+ this.symbol | ||
+ (this.zero ? "0" : "") | ||
+ (this.width == null ? "" : Math.max(1, this.width | 0)) | ||
+ (this.comma ? "," : "") | ||
+ (this.precision == null ? "" : "." + Math.max(0, this.precision | 0)) | ||
+ this.type; | ||
}; | ||
function identity(x) { | ||
return x; | ||
} | ||
function identity(x) { | ||
return x; | ||
} | ||
var prefixes = ["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"]; | ||
var prefixes = ["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"]; | ||
function formatLocale(locale) { | ||
var group = locale.grouping && locale.thousands ? formatGroup(locale.grouping, locale.thousands) : identity, | ||
currency = locale.currency, | ||
decimal = locale.decimal, | ||
numerals = locale.numerals ? formatNumerals(locale.numerals) : identity, | ||
percent = locale.percent || "%"; | ||
function formatLocale(locale) { | ||
var group = locale.grouping && locale.thousands ? formatGroup(locale.grouping, locale.thousands) : identity, | ||
currency = locale.currency, | ||
decimal = locale.decimal, | ||
numerals = locale.numerals ? formatNumerals(locale.numerals) : identity, | ||
percent = locale.percent || "%"; | ||
function newFormat(specifier) { | ||
specifier = formatSpecifier(specifier); | ||
function newFormat(specifier) { | ||
specifier = formatSpecifier(specifier); | ||
var fill = specifier.fill, | ||
align = specifier.align, | ||
sign = specifier.sign, | ||
symbol = specifier.symbol, | ||
zero = specifier.zero, | ||
width = specifier.width, | ||
comma = specifier.comma, | ||
precision = specifier.precision, | ||
type = specifier.type; | ||
var fill = specifier.fill, | ||
align = specifier.align, | ||
sign = specifier.sign, | ||
symbol = specifier.symbol, | ||
zero = specifier.zero, | ||
width = specifier.width, | ||
comma = specifier.comma, | ||
precision = specifier.precision, | ||
type = specifier.type; | ||
// Compute the prefix and suffix. | ||
// For SI-prefix, the suffix is lazily computed. | ||
var prefix = symbol === "$" ? currency[0] : symbol === "#" && /[boxX]/.test(type) ? "0" + type.toLowerCase() : "", | ||
suffix = symbol === "$" ? currency[1] : /[%p]/.test(type) ? percent : ""; | ||
// Compute the prefix and suffix. | ||
// For SI-prefix, the suffix is lazily computed. | ||
var prefix = symbol === "$" ? currency[0] : symbol === "#" && /[boxX]/.test(type) ? "0" + type.toLowerCase() : "", | ||
suffix = symbol === "$" ? currency[1] : /[%p]/.test(type) ? percent : ""; | ||
// What format function should we use? | ||
// Is this an integer type? | ||
// Can this type generate exponential notation? | ||
var formatType = formatTypes[type], | ||
maybeSuffix = !type || /[defgprs%]/.test(type); | ||
// What format function should we use? | ||
// Is this an integer type? | ||
// Can this type generate exponential notation? | ||
var formatType = formatTypes[type], | ||
maybeSuffix = !type || /[defgprs%]/.test(type); | ||
// Set the default precision if not specified, | ||
// or clamp the specified precision to the supported range. | ||
// For significant precision, it must be in [1, 21]. | ||
// For fixed precision, it must be in [0, 20]. | ||
precision = precision == null ? (type ? 6 : 12) | ||
: /[gprs]/.test(type) ? Math.max(1, Math.min(21, precision)) | ||
: Math.max(0, Math.min(20, precision)); | ||
// Set the default precision if not specified, | ||
// or clamp the specified precision to the supported range. | ||
// For significant precision, it must be in [1, 21]. | ||
// For fixed precision, it must be in [0, 20]. | ||
precision = precision == null ? (type ? 6 : 12) | ||
: /[gprs]/.test(type) ? Math.max(1, Math.min(21, precision)) | ||
: Math.max(0, Math.min(20, precision)); | ||
function format(value) { | ||
var valuePrefix = prefix, | ||
valueSuffix = suffix, | ||
i, n, c; | ||
function format(value) { | ||
var valuePrefix = prefix, | ||
valueSuffix = suffix, | ||
i, n, c; | ||
if (type === "c") { | ||
valueSuffix = formatType(value) + valueSuffix; | ||
value = ""; | ||
} else { | ||
value = +value; | ||
if (type === "c") { | ||
valueSuffix = formatType(value) + valueSuffix; | ||
value = ""; | ||
} else { | ||
value = +value; | ||
// Perform the initial formatting. | ||
var valueNegative = value < 0; | ||
value = formatType(Math.abs(value), precision); | ||
// Perform the initial formatting. | ||
var valueNegative = value < 0; | ||
value = formatType(Math.abs(value), precision); | ||
// If a negative value rounds to zero during formatting, treat as positive. | ||
if (valueNegative && +value === 0) valueNegative = false; | ||
// If a negative value rounds to zero during formatting, treat as positive. | ||
if (valueNegative && +value === 0) valueNegative = false; | ||
// Compute the prefix and suffix. | ||
valuePrefix = (valueNegative ? (sign === "(" ? sign : "-") : sign === "-" || sign === "(" ? "" : sign) + valuePrefix; | ||
valueSuffix = valueSuffix + (type === "s" ? prefixes[8 + prefixExponent / 3] : "") + (valueNegative && sign === "(" ? ")" : ""); | ||
// Compute the prefix and suffix. | ||
valuePrefix = (valueNegative ? (sign === "(" ? sign : "-") : sign === "-" || sign === "(" ? "" : sign) + valuePrefix; | ||
valueSuffix = valueSuffix + (type === "s" ? prefixes[8 + prefixExponent / 3] : "") + (valueNegative && sign === "(" ? ")" : ""); | ||
// Break the formatted value into the integer “value” part that can be | ||
// grouped, and fractional or exponential “suffix” part that is not. | ||
if (maybeSuffix) { | ||
i = -1, n = value.length; | ||
while (++i < n) { | ||
if (c = value.charCodeAt(i), 48 > c || c > 57) { | ||
valueSuffix = (c === 46 ? decimal + value.slice(i + 1) : value.slice(i)) + valueSuffix; | ||
value = value.slice(0, i); | ||
break; | ||
// Break the formatted value into the integer “value” part that can be | ||
// grouped, and fractional or exponential “suffix” part that is not. | ||
if (maybeSuffix) { | ||
i = -1, n = value.length; | ||
while (++i < n) { | ||
if (c = value.charCodeAt(i), 48 > c || c > 57) { | ||
valueSuffix = (c === 46 ? decimal + value.slice(i + 1) : value.slice(i)) + valueSuffix; | ||
value = value.slice(0, i); | ||
break; | ||
} | ||
} | ||
} | ||
} | ||
// If the fill character is not "0", grouping is applied before padding. | ||
if (comma && !zero) value = group(value, Infinity); | ||
// Compute the padding. | ||
var length = valuePrefix.length + value.length + valueSuffix.length, | ||
padding = length < width ? new Array(width - length + 1).join(fill) : ""; | ||
// If the fill character is "0", grouping is applied after padding. | ||
if (comma && zero) value = group(padding + value, padding.length ? width - valueSuffix.length : Infinity), padding = ""; | ||
// Reconstruct the final output based on the desired alignment. | ||
switch (align) { | ||
case "<": value = valuePrefix + value + valueSuffix + padding; break; | ||
case "=": value = valuePrefix + padding + value + valueSuffix; break; | ||
case "^": value = padding.slice(0, length = padding.length >> 1) + valuePrefix + value + valueSuffix + padding.slice(length); break; | ||
default: value = padding + valuePrefix + value + valueSuffix; break; | ||
} | ||
return numerals(value); | ||
} | ||
format.toString = function() { | ||
return specifier + ""; | ||
}; | ||
return format; | ||
} | ||
// If the fill character is not "0", grouping is applied before padding. | ||
if (comma && !zero) value = group(value, Infinity); | ||
function formatPrefix(specifier, value) { | ||
var f = newFormat((specifier = formatSpecifier(specifier), specifier.type = "f", specifier)), | ||
e = Math.max(-8, Math.min(8, Math.floor(exponent(value) / 3))) * 3, | ||
k = Math.pow(10, -e), | ||
prefix = prefixes[8 + e / 3]; | ||
return function(value) { | ||
return f(k * value) + prefix; | ||
}; | ||
} | ||
// Compute the padding. | ||
var length = valuePrefix.length + value.length + valueSuffix.length, | ||
padding = length < width ? new Array(width - length + 1).join(fill) : ""; | ||
return { | ||
format: newFormat, | ||
formatPrefix: formatPrefix | ||
}; | ||
} | ||
// If the fill character is "0", grouping is applied after padding. | ||
if (comma && zero) value = group(padding + value, padding.length ? width - valueSuffix.length : Infinity), padding = ""; | ||
var locale; | ||
var format; | ||
var formatPrefix; | ||
// Reconstruct the final output based on the desired alignment. | ||
switch (align) { | ||
case "<": value = valuePrefix + value + valueSuffix + padding; break; | ||
case "=": value = valuePrefix + padding + value + valueSuffix; break; | ||
case "^": value = padding.slice(0, length = padding.length >> 1) + valuePrefix + value + valueSuffix + padding.slice(length); break; | ||
default: value = padding + valuePrefix + value + valueSuffix; break; | ||
} | ||
defaultLocale({ | ||
decimal: ".", | ||
thousands: ",", | ||
grouping: [3], | ||
currency: ["$", ""] | ||
}); | ||
return numerals(value); | ||
function defaultLocale(definition) { | ||
locale = formatLocale(definition); | ||
format = locale.format; | ||
formatPrefix = locale.formatPrefix; | ||
return locale; | ||
} | ||
format.toString = function() { | ||
return specifier + ""; | ||
}; | ||
var prefix = "$"; | ||
return format; | ||
} | ||
function Map() {} | ||
function formatPrefix(specifier, value) { | ||
var f = newFormat((specifier = formatSpecifier(specifier), specifier.type = "f", specifier)), | ||
e = Math.max(-8, Math.min(8, Math.floor(exponent(value) / 3))) * 3, | ||
k = Math.pow(10, -e), | ||
prefix = prefixes[8 + e / 3]; | ||
return function(value) { | ||
return f(k * value) + prefix; | ||
Map.prototype = map.prototype = { | ||
constructor: Map, | ||
has: function(key) { | ||
return (prefix + key) in this; | ||
}, | ||
get: function(key) { | ||
return this[prefix + key]; | ||
}, | ||
set: function(key, value) { | ||
this[prefix + key] = value; | ||
return this; | ||
}, | ||
remove: function(key) { | ||
var property = prefix + key; | ||
return property in this && delete this[property]; | ||
}, | ||
clear: function() { | ||
for (var property in this) if (property[0] === prefix) delete this[property]; | ||
}, | ||
keys: function() { | ||
var keys = []; | ||
for (var property in this) if (property[0] === prefix) keys.push(property.slice(1)); | ||
return keys; | ||
}, | ||
values: function() { | ||
var values = []; | ||
for (var property in this) if (property[0] === prefix) values.push(this[property]); | ||
return values; | ||
}, | ||
entries: function() { | ||
var entries = []; | ||
for (var property in this) if (property[0] === prefix) entries.push({key: property.slice(1), value: this[property]}); | ||
return entries; | ||
}, | ||
size: function() { | ||
var size = 0; | ||
for (var property in this) if (property[0] === prefix) ++size; | ||
return size; | ||
}, | ||
empty: function() { | ||
for (var property in this) if (property[0] === prefix) return false; | ||
return true; | ||
}, | ||
each: function(f) { | ||
for (var property in this) if (property[0] === prefix) f(this[property], property.slice(1), this); | ||
} | ||
}; | ||
} | ||
return { | ||
format: newFormat, | ||
formatPrefix: formatPrefix | ||
}; | ||
} | ||
function map(object, f) { | ||
var map = new Map; | ||
var locale; | ||
var format; | ||
var formatPrefix; | ||
// Copy constructor. | ||
if (object instanceof Map) object.each(function(value, key) { map.set(key, value); }); | ||
defaultLocale({ | ||
decimal: ".", | ||
thousands: ",", | ||
grouping: [3], | ||
currency: ["$", ""] | ||
}); | ||
// Index array by numeric index or specified key function. | ||
else if (Array.isArray(object)) { | ||
var i = -1, | ||
n = object.length, | ||
o; | ||
function defaultLocale(definition) { | ||
locale = formatLocale(definition); | ||
format = locale.format; | ||
formatPrefix = locale.formatPrefix; | ||
return locale; | ||
} | ||
if (f == null) while (++i < n) map.set(i, object[i]); | ||
else while (++i < n) map.set(f(o = object[i], i, object), o); | ||
} | ||
var prefix = "$"; | ||
// Convert object to map. | ||
else if (object) for (var key in object) map.set(key, object[key]); | ||
function Map() {} | ||
return map; | ||
} | ||
Map.prototype = map.prototype = { | ||
constructor: Map, | ||
has: function(key) { | ||
return (prefix + key) in this; | ||
}, | ||
get: function(key) { | ||
return this[prefix + key]; | ||
}, | ||
set: function(key, value) { | ||
this[prefix + key] = value; | ||
return this; | ||
}, | ||
remove: function(key) { | ||
var property = prefix + key; | ||
return property in this && delete this[property]; | ||
}, | ||
clear: function() { | ||
for (var property in this) if (property[0] === prefix) delete this[property]; | ||
}, | ||
keys: function() { | ||
var keys = []; | ||
for (var property in this) if (property[0] === prefix) keys.push(property.slice(1)); | ||
return keys; | ||
}, | ||
values: function() { | ||
var values = []; | ||
for (var property in this) if (property[0] === prefix) values.push(this[property]); | ||
return values; | ||
}, | ||
entries: function() { | ||
var entries = []; | ||
for (var property in this) if (property[0] === prefix) entries.push({key: property.slice(1), value: this[property]}); | ||
return entries; | ||
}, | ||
size: function() { | ||
var size = 0; | ||
for (var property in this) if (property[0] === prefix) ++size; | ||
return size; | ||
}, | ||
empty: function() { | ||
for (var property in this) if (property[0] === prefix) return false; | ||
return true; | ||
}, | ||
each: function(f) { | ||
for (var property in this) if (property[0] === prefix) f(this[property], property.slice(1), this); | ||
} | ||
}; | ||
function Set() {} | ||
function map(object, f) { | ||
var map = new Map; | ||
var proto = map.prototype; | ||
// Copy constructor. | ||
if (object instanceof Map) object.each(function(value, key) { map.set(key, value); }); | ||
Set.prototype = set.prototype = { | ||
constructor: Set, | ||
has: proto.has, | ||
add: function(value) { | ||
value += ""; | ||
this[prefix + value] = value; | ||
return this; | ||
}, | ||
remove: proto.remove, | ||
clear: proto.clear, | ||
values: proto.keys, | ||
size: proto.size, | ||
empty: proto.empty, | ||
each: proto.each | ||
}; | ||
// Index array by numeric index or specified key function. | ||
else if (Array.isArray(object)) { | ||
var i = -1, | ||
n = object.length, | ||
o; | ||
function set(object, f) { | ||
var set = new Set; | ||
if (f == null) while (++i < n) map.set(i, object[i]); | ||
else while (++i < n) map.set(f(o = object[i], i, object), o); | ||
} | ||
// Copy constructor. | ||
if (object instanceof Set) object.each(function(value) { set.add(value); }); | ||
// Convert object to map. | ||
else if (object) for (var key in object) map.set(key, object[key]); | ||
// Otherwise, assume it’s an array. | ||
else if (object) { | ||
var i = -1, n = object.length; | ||
if (f == null) while (++i < n) set.add(object[i]); | ||
else while (++i < n) set.add(f(object[i], i, object)); | ||
} | ||
return map; | ||
} | ||
return set; | ||
} | ||
function Set() {} | ||
/** | ||
* d3.tip | ||
* Copyright (c) 2013-2017 Justin Palmer | ||
* | ||
* Tooltips for d3.js SVG visualizations | ||
*/ | ||
var proto = map.prototype; | ||
function tip() { | ||
var direction = d3TipDirection, | ||
offset = d3TipOffset, | ||
html = d3TipHTML, | ||
rootElement = functor(document.body), | ||
node = initNode(), | ||
svg = null, | ||
point = null, | ||
target = null; | ||
Set.prototype = set.prototype = { | ||
constructor: Set, | ||
has: proto.has, | ||
add: function(value) { | ||
value += ""; | ||
this[prefix + value] = value; | ||
return this; | ||
}, | ||
remove: proto.remove, | ||
clear: proto.clear, | ||
values: proto.keys, | ||
size: proto.size, | ||
empty: proto.empty, | ||
each: proto.each | ||
}; | ||
function tip(vis) { | ||
svg = getSVGNode(vis); | ||
if (!svg) return | ||
point = svg.createSVGPoint(); | ||
rootElement().appendChild(node); | ||
} | ||
function set(object, f) { | ||
var set = new Set; | ||
// Public - show the tooltip on the screen | ||
// | ||
// Returns a tip | ||
tip.show = function() { | ||
var args = Array.prototype.slice.call(arguments); | ||
if (args[args.length - 1] instanceof SVGElement) target = args.pop(); | ||
// Copy constructor. | ||
if (object instanceof Set) object.each(function(value) { set.add(value); }); | ||
var content = html.apply(this, args), | ||
poffset = offset.apply(this, args), | ||
dir = direction.apply(this, args), | ||
nodel = getNodeEl(), | ||
i = directions.length, | ||
coords, | ||
scrollTop = document.documentElement.scrollTop || | ||
rootElement().scrollTop, | ||
scrollLeft = document.documentElement.scrollLeft || | ||
rootElement().scrollLeft; | ||
// Otherwise, assume it’s an array. | ||
else if (object) { | ||
var i = -1, n = object.length; | ||
if (f == null) while (++i < n) set.add(object[i]); | ||
else while (++i < n) set.add(f(object[i], i, object)); | ||
} | ||
nodel.html(content) | ||
.style('opacity', 1).style('pointer-events', 'all'); | ||
return set; | ||
} | ||
while (i--) nodel.classed(directions[i], false); | ||
coords = directionCallbacks.get(dir).apply(this); | ||
nodel.classed(dir, true) | ||
.style('top', (coords.top + poffset[0]) + scrollTop + 'px') | ||
.style('left', (coords.left + poffset[1]) + scrollLeft + 'px'); | ||
/** | ||
* d3.tip | ||
* Copyright (c) 2013-2017 Justin Palmer | ||
* | ||
* Tooltips for d3.js SVG visualizations | ||
*/ | ||
// eslint-disable-next-line no-extra-semi | ||
// Public - contructs a new tooltip | ||
// | ||
// Returns a tip | ||
function tip() { | ||
var direction = d3TipDirection, | ||
offset = d3TipOffset, | ||
html = d3TipHTML, | ||
rootElement = functor(document.body), | ||
node = initNode(), | ||
svg = null, | ||
point = null, | ||
target = null; | ||
return tip | ||
}; | ||
function tip(vis) { | ||
svg = getSVGNode(vis); | ||
if (!svg) return | ||
point = svg.createSVGPoint(); | ||
rootElement().appendChild(node); | ||
} | ||
// Public - hide the tooltip | ||
// | ||
// Returns a tip | ||
tip.hide = function() { | ||
var nodel = getNodeEl(); | ||
nodel.style('opacity', 0).style('pointer-events', 'none'); | ||
return tip | ||
}; | ||
// Public - show the tooltip on the screen | ||
// | ||
// Returns a tip | ||
tip.show = function() { | ||
var args = Array.prototype.slice.call(arguments); | ||
if (args[args.length - 1] instanceof SVGElement) target = args.pop(); | ||
// Public: Proxy attr calls to the d3 tip container. | ||
// Sets or gets attribute value. | ||
// | ||
// n - name of the attribute | ||
// v - value of the attribute | ||
// | ||
// Returns tip or attribute value | ||
// eslint-disable-next-line no-unused-vars | ||
tip.attr = function(n, v) { | ||
if (arguments.length < 2 && typeof n === 'string') { | ||
return getNodeEl().attr(n) | ||
} | ||
var content = html.apply(this, args), | ||
poffset = offset.apply(this, args), | ||
dir = direction.apply(this, args), | ||
nodel = getNodeEl(), | ||
i = directions.length, | ||
coords, | ||
scrollTop = document.documentElement.scrollTop || | ||
rootElement().scrollTop, | ||
scrollLeft = document.documentElement.scrollLeft || | ||
rootElement().scrollLeft; | ||
var args = Array.prototype.slice.call(arguments); | ||
common.selection.prototype.attr.apply(getNodeEl(), args); | ||
return tip | ||
}; | ||
nodel.html(content) | ||
.style('opacity', 1).style('pointer-events', 'all'); | ||
// Public: Proxy style calls to the d3 tip container. | ||
// Sets or gets a style value. | ||
// | ||
// n - name of the property | ||
// v - value of the property | ||
// | ||
// Returns tip or style property value | ||
// eslint-disable-next-line no-unused-vars | ||
tip.style = function(n, v) { | ||
if (arguments.length < 2 && typeof n === 'string') { | ||
return getNodeEl().style(n) | ||
} | ||
while (i--) nodel.classed(directions[i], false); | ||
coords = directionCallbacks.get(dir).apply(this); | ||
nodel.classed(dir, true) | ||
.style('top', (coords.top + poffset[0]) + scrollTop + 'px') | ||
.style('left', (coords.left + poffset[1]) + scrollLeft + 'px'); | ||
var args = Array.prototype.slice.call(arguments); | ||
common.selection.prototype.style.apply(getNodeEl(), args); | ||
return tip | ||
}; | ||
return tip | ||
}; | ||
// Public: Set or get the direction of the tooltip | ||
// | ||
// v - One of n(north), s(south), e(east), or w(west), nw(northwest), | ||
// sw(southwest), ne(northeast) or se(southeast) | ||
// | ||
// Returns tip or direction | ||
tip.direction = function(v) { | ||
if (!arguments.length) return direction | ||
direction = v == null ? v : functor(v); | ||
// Public - hide the tooltip | ||
// | ||
// Returns a tip | ||
tip.hide = function() { | ||
var nodel = getNodeEl(); | ||
nodel.style('opacity', 0).style('pointer-events', 'none'); | ||
return tip | ||
}; | ||
return tip | ||
}; | ||
// Public: Proxy attr calls to the d3 tip container. | ||
// Sets or gets attribute value. | ||
// | ||
// n - name of the attribute | ||
// v - value of the attribute | ||
// | ||
// Returns tip or attribute value | ||
// eslint-disable-next-line no-unused-vars | ||
tip.attr = function(n, v) { | ||
if (arguments.length < 2 && typeof n === 'string') { | ||
return getNodeEl().attr(n) | ||
} | ||
// Public: Sets or gets the offset of the tip | ||
// | ||
// v - Array of [x, y] offset | ||
// | ||
// Returns offset or | ||
tip.offset = function(v) { | ||
if (!arguments.length) return offset | ||
offset = v == null ? v : functor(v); | ||
var args = Array.prototype.slice.call(arguments); | ||
common.selection.prototype.attr.apply(getNodeEl(), args); | ||
return tip | ||
}; | ||
return tip | ||
}; | ||
// Public: Proxy style calls to the d3 tip container. | ||
// Sets or gets a style value. | ||
// | ||
// n - name of the property | ||
// v - value of the property | ||
// | ||
// Returns tip or style property value | ||
// eslint-disable-next-line no-unused-vars | ||
tip.style = function(n, v) { | ||
if (arguments.length < 2 && typeof n === 'string') { | ||
return getNodeEl().style(n) | ||
} | ||
// Public: sets or gets the html value of the tooltip | ||
// | ||
// v - String value of the tip | ||
// | ||
// Returns html value or tip | ||
tip.html = function(v) { | ||
if (!arguments.length) return html | ||
html = v == null ? v : functor(v); | ||
var args = Array.prototype.slice.call(arguments); | ||
common.selection.prototype.style.apply(getNodeEl(), args); | ||
return tip | ||
}; | ||
return tip | ||
}; | ||
// Public: Set or get the direction of the tooltip | ||
// | ||
// v - One of n(north), s(south), e(east), or w(west), nw(northwest), | ||
// sw(southwest), ne(northeast) or se(southeast) | ||
// | ||
// Returns tip or direction | ||
tip.direction = function(v) { | ||
if (!arguments.length) return direction | ||
direction = v == null ? v : functor(v); | ||
// Public: sets or gets the root element anchor of the tooltip | ||
// | ||
// v - root element of the tooltip | ||
// | ||
// Returns root node of tip | ||
tip.rootElement = function(v) { | ||
if (!arguments.length) return rootElement | ||
rootElement = v == null ? v : functor(v); | ||
return tip | ||
}; | ||
return tip | ||
}; | ||
// Public: Sets or gets the offset of the tip | ||
// | ||
// v - Array of [x, y] offset | ||
// | ||
// Returns offset or | ||
tip.offset = function(v) { | ||
if (!arguments.length) return offset | ||
offset = v == null ? v : functor(v); | ||
// Public: destroys the tooltip and removes it from the DOM | ||
// | ||
// Returns a tip | ||
tip.destroy = function() { | ||
if (node) { | ||
getNodeEl().remove(); | ||
node = null; | ||
} | ||
return tip | ||
}; | ||
return tip | ||
}; | ||
function d3TipDirection() { return 'n' } | ||
function d3TipOffset() { return [0, 0] } | ||
function d3TipHTML() { return ' ' } | ||
// Public: sets or gets the html value of the tooltip | ||
// | ||
// v - String value of the tip | ||
// | ||
// Returns html value or tip | ||
tip.html = function(v) { | ||
if (!arguments.length) return html | ||
html = v == null ? v : functor(v); | ||
var directionCallbacks = map({ | ||
n: directionNorth, | ||
s: directionSouth, | ||
e: directionEast, | ||
w: directionWest, | ||
nw: directionNorthWest, | ||
ne: directionNorthEast, | ||
sw: directionSouthWest, | ||
se: directionSouthEast | ||
}), | ||
directions = directionCallbacks.keys(); | ||
return tip | ||
}; | ||
function directionNorth() { | ||
var bbox = getScreenBBox(); | ||
return { | ||
top: bbox.n.y - node.offsetHeight, | ||
left: bbox.n.x - node.offsetWidth / 2 | ||
} | ||
} | ||
// Public: sets or gets the root element anchor of the tooltip | ||
// | ||
// v - root element of the tooltip | ||
// | ||
// Returns root node of tip | ||
tip.rootElement = function(v) { | ||
if (!arguments.length) return rootElement | ||
rootElement = v == null ? v : functor(v); | ||
function directionSouth() { | ||
var bbox = getScreenBBox(); | ||
return { | ||
top: bbox.s.y, | ||
left: bbox.s.x - node.offsetWidth / 2 | ||
} | ||
} | ||
return tip | ||
}; | ||
function directionEast() { | ||
var bbox = getScreenBBox(); | ||
return { | ||
top: bbox.e.y - node.offsetHeight / 2, | ||
left: bbox.e.x | ||
} | ||
} | ||
// Public: destroys the tooltip and removes it from the DOM | ||
// | ||
// Returns a tip | ||
tip.destroy = function() { | ||
if (node) { | ||
getNodeEl().remove(); | ||
node = null; | ||
} | ||
return tip | ||
}; | ||
function directionWest() { | ||
var bbox = getScreenBBox(); | ||
return { | ||
top: bbox.w.y - node.offsetHeight / 2, | ||
left: bbox.w.x - node.offsetWidth | ||
} | ||
} | ||
function d3TipDirection() { return 'n' } | ||
function d3TipOffset() { return [0, 0] } | ||
function d3TipHTML() { return ' ' } | ||
function directionNorthWest() { | ||
var bbox = getScreenBBox(); | ||
return { | ||
top: bbox.nw.y - node.offsetHeight, | ||
left: bbox.nw.x - node.offsetWidth | ||
} | ||
} | ||
var directionCallbacks = map({ | ||
n: directionNorth, | ||
s: directionSouth, | ||
e: directionEast, | ||
w: directionWest, | ||
nw: directionNorthWest, | ||
ne: directionNorthEast, | ||
sw: directionSouthWest, | ||
se: directionSouthEast | ||
}), | ||
directions = directionCallbacks.keys(); | ||
function directionNorthEast() { | ||
var bbox = getScreenBBox(); | ||
return { | ||
top: bbox.ne.y - node.offsetHeight, | ||
left: bbox.ne.x | ||
} | ||
} | ||
function directionNorth() { | ||
var bbox = getScreenBBox(); | ||
return { | ||
top: bbox.n.y - node.offsetHeight, | ||
left: bbox.n.x - node.offsetWidth / 2 | ||
} | ||
} | ||
function directionSouthWest() { | ||
var bbox = getScreenBBox(); | ||
return { | ||
top: bbox.sw.y, | ||
left: bbox.sw.x - node.offsetWidth | ||
} | ||
} | ||
function directionSouth() { | ||
var bbox = getScreenBBox(); | ||
return { | ||
top: bbox.s.y, | ||
left: bbox.s.x - node.offsetWidth / 2 | ||
} | ||
} | ||
function directionSouthEast() { | ||
var bbox = getScreenBBox(); | ||
return { | ||
top: bbox.se.y, | ||
left: bbox.se.x | ||
} | ||
} | ||
function directionEast() { | ||
var bbox = getScreenBBox(); | ||
return { | ||
top: bbox.e.y - node.offsetHeight / 2, | ||
left: bbox.e.x | ||
} | ||
} | ||
function initNode() { | ||
var div = common.select(document.createElement('div')); | ||
div | ||
.style('position', 'absolute') | ||
.style('top', 0) | ||
.style('opacity', 0) | ||
.style('pointer-events', 'none') | ||
.style('box-sizing', 'border-box'); | ||
function directionWest() { | ||
var bbox = getScreenBBox(); | ||
return { | ||
top: bbox.w.y - node.offsetHeight / 2, | ||
left: bbox.w.x - node.offsetWidth | ||
} | ||
} | ||
return div.node() | ||
} | ||
function directionNorthWest() { | ||
var bbox = getScreenBBox(); | ||
return { | ||
top: bbox.nw.y - node.offsetHeight, | ||
left: bbox.nw.x - node.offsetWidth | ||
} | ||
} | ||
function getSVGNode(element) { | ||
var svgNode = element.node(); | ||
if (!svgNode) return null | ||
if (svgNode.tagName.toLowerCase() === 'svg') return svgNode | ||
return svgNode.ownerSVGElement | ||
} | ||
function directionNorthEast() { | ||
var bbox = getScreenBBox(); | ||
return { | ||
top: bbox.ne.y - node.offsetHeight, | ||
left: bbox.ne.x | ||
} | ||
} | ||
function getNodeEl() { | ||
if (node == null) { | ||
node = initNode(); | ||
// re-add node to DOM | ||
rootElement().appendChild(node); | ||
} | ||
return common.select(node) | ||
} | ||
function directionSouthWest() { | ||
var bbox = getScreenBBox(); | ||
return { | ||
top: bbox.sw.y, | ||
left: bbox.sw.x - node.offsetWidth | ||
} | ||
} | ||
// Private - gets the screen coordinates of a shape | ||
// | ||
// Given a shape on the screen, will return an SVGPoint for the directions | ||
// n(north), s(south), e(east), w(west), ne(northeast), se(southeast), | ||
// nw(northwest), sw(southwest). | ||
// | ||
// +-+-+ | ||
// | | | ||
// + + | ||
// | | | ||
// +-+-+ | ||
// | ||
// Returns an Object {n, s, e, w, nw, sw, ne, se} | ||
function getScreenBBox() { | ||
var targetel = target || event.target; | ||
function directionSouthEast() { | ||
var bbox = getScreenBBox(); | ||
return { | ||
top: bbox.se.y, | ||
left: bbox.se.x | ||
} | ||
} | ||
while (targetel.getScreenCTM == null && targetel.parentNode == null) { | ||
targetel = targetel.parentNode; | ||
} | ||
function initNode() { | ||
var div = common.select(document.createElement('div')); | ||
div | ||
.style('position', 'absolute') | ||
.style('top', 0) | ||
.style('opacity', 0) | ||
.style('pointer-events', 'none') | ||
.style('box-sizing', 'border-box'); | ||
var bbox = {}, | ||
matrix = targetel.getScreenCTM(), | ||
tbbox = targetel.getBBox(), | ||
width = tbbox.width, | ||
height = tbbox.height, | ||
x = tbbox.x, | ||
y = tbbox.y; | ||
return div.node() | ||
} | ||
point.x = x; | ||
point.y = y; | ||
bbox.nw = point.matrixTransform(matrix); | ||
point.x += width; | ||
bbox.ne = point.matrixTransform(matrix); | ||
point.y += height; | ||
bbox.se = point.matrixTransform(matrix); | ||
point.x -= width; | ||
bbox.sw = point.matrixTransform(matrix); | ||
point.y -= height / 2; | ||
bbox.w = point.matrixTransform(matrix); | ||
point.x += width; | ||
bbox.e = point.matrixTransform(matrix); | ||
point.x -= width / 2; | ||
point.y -= height / 2; | ||
bbox.n = point.matrixTransform(matrix); | ||
point.y += height; | ||
bbox.s = point.matrixTransform(matrix); | ||
function getSVGNode(element) { | ||
var svgNode = element.node(); | ||
if (!svgNode) return null | ||
if (svgNode.tagName.toLowerCase() === 'svg') return svgNode | ||
return svgNode.ownerSVGElement | ||
} | ||
return bbox | ||
} | ||
function getNodeEl() { | ||
if (node == null) { | ||
node = initNode(); | ||
// re-add node to DOM | ||
rootElement().appendChild(node); | ||
} | ||
return common.select(node) | ||
} | ||
// Private - replace D3JS 3.X d3.functor() function | ||
function functor(v) { | ||
return typeof v === 'function' ? v : function() { | ||
return v | ||
} | ||
} | ||
// Private - gets the screen coordinates of a shape | ||
// | ||
// Given a shape on the screen, will return an SVGPoint for the directions | ||
// n(north), s(south), e(east), w(west), ne(northeast), se(southeast), | ||
// nw(northwest), sw(southwest). | ||
// | ||
// +-+-+ | ||
// | | | ||
// + + | ||
// | | | ||
// +-+-+ | ||
// | ||
// Returns an Object {n, s, e, w, nw, sw, ne, se} | ||
function getScreenBBox() { | ||
var targetel = target || event.target; | ||
while (targetel.getScreenCTM == null && targetel.parentNode == null) { | ||
targetel = targetel.parentNode; | ||
return tip | ||
} | ||
var bbox = {}, | ||
matrix = targetel.getScreenCTM(), | ||
tbbox = targetel.getBBox(), | ||
width = tbbox.width, | ||
height = tbbox.height, | ||
x = tbbox.x, | ||
y = tbbox.y; | ||
function styleInject(css, ref) { | ||
if ( ref === void 0 ) ref = {}; | ||
var insertAt = ref.insertAt; | ||
point.x = x; | ||
point.y = y; | ||
bbox.nw = point.matrixTransform(matrix); | ||
point.x += width; | ||
bbox.ne = point.matrixTransform(matrix); | ||
point.y += height; | ||
bbox.se = point.matrixTransform(matrix); | ||
point.x -= width; | ||
bbox.sw = point.matrixTransform(matrix); | ||
point.y -= height / 2; | ||
bbox.w = point.matrixTransform(matrix); | ||
point.x += width; | ||
bbox.e = point.matrixTransform(matrix); | ||
point.x -= width / 2; | ||
point.y -= height / 2; | ||
bbox.n = point.matrixTransform(matrix); | ||
point.y += height; | ||
bbox.s = point.matrixTransform(matrix); | ||
if (!css || typeof document === 'undefined') { return; } | ||
return bbox | ||
} | ||
var head = document.head || document.getElementsByTagName('head')[0]; | ||
var style = document.createElement('style'); | ||
style.type = 'text/css'; | ||
// Private - replace D3JS 3.X d3.functor() function | ||
function functor(v) { | ||
return typeof v === 'function' ? v : function() { | ||
return v | ||
if (insertAt === 'top') { | ||
if (head.firstChild) { | ||
head.insertBefore(style, head.firstChild); | ||
} else { | ||
head.appendChild(style); | ||
} | ||
} else { | ||
head.appendChild(style); | ||
} | ||
if (style.styleSheet) { | ||
style.styleSheet.cssText = css; | ||
} else { | ||
style.appendChild(document.createTextNode(css)); | ||
} | ||
} | ||
return tip | ||
} | ||
var css = ".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"; | ||
styleInject(css); | ||
__$styleInject(".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",undefined); | ||
// const tip = _tip.tip || _tip.default || _tip; | ||
var ITooltip$1 = /** @class */ (function (_super) { | ||
__extends(ITooltip, _super); | ||
function ITooltip() { | ||
var _this = _super.call(this) || this; | ||
_this._valueFormatter = format(_this.tooltipValueFormat()); | ||
if (_this.layerEnter) { | ||
var layerEnter_1 = _this.layerEnter; | ||
_this.layerEnter = function (_base, svgElement, _domElement) { | ||
this.tooltipEnter(svgElement); | ||
layerEnter_1.apply(this, arguments); | ||
}; | ||
var layerUpdate_1 = _this.layerUpdate; | ||
_this.layerUpdate = function (_base) { | ||
layerUpdate_1.apply(this, arguments); | ||
this.tooltipUpdate(); | ||
}; | ||
var layerExit_1 = _this.layerExit; | ||
_this.layerExit = function (_base) { | ||
layerExit_1.apply(this, arguments); | ||
this.tooltipExit(); | ||
}; | ||
var ITooltip = /** @class */ (function (_super) { | ||
__extends(ITooltip, _super); | ||
function ITooltip() { | ||
var _this = _super.call(this) || this; | ||
_this.tooltip = tip().attr("class", "d3-tip"); | ||
_this._valueFormatter = format(_this.tooltipValueFormat()); | ||
if (_this.layerEnter) { | ||
var layerEnter_1 = _this.layerEnter; | ||
_this.layerEnter = function (_base, svgElement, _domElement) { | ||
this.tooltipEnter(svgElement); | ||
layerEnter_1.apply(this, arguments); | ||
}; | ||
var layerUpdate_1 = _this.layerUpdate; | ||
_this.layerUpdate = function (_base) { | ||
layerUpdate_1.apply(this, arguments); | ||
this.tooltipUpdate(); | ||
}; | ||
var layerExit_1 = _this.layerExit; | ||
_this.layerExit = function (_base) { | ||
layerExit_1.apply(this, arguments); | ||
this.tooltipExit(); | ||
}; | ||
} | ||
else { | ||
var enter_1 = _this.enter; | ||
_this.enter = function (_domNode, element) { | ||
this.tooltipEnter(element); | ||
enter_1.apply(this, arguments); | ||
}; | ||
var update_1 = _this.update; | ||
_this.update = function (_domNode, _element) { | ||
update_1.apply(this, arguments); | ||
this.tooltipUpdate(); | ||
}; | ||
var exit_1 = _this.exit; | ||
_this.exit = function (_domNode, _element) { | ||
exit_1.apply(this, arguments); | ||
this.tooltipExit(); | ||
}; | ||
} | ||
return _this; | ||
} | ||
else { | ||
var enter_1 = _this.enter; | ||
_this.enter = function (_domNode, element) { | ||
this.tooltipEnter(element); | ||
enter_1.apply(this, arguments); | ||
}; | ||
var update_1 = _this.update; | ||
_this.update = function (_domNode, _element) { | ||
update_1.apply(this, arguments); | ||
this.tooltipUpdate(); | ||
}; | ||
var exit_1 = _this.exit; | ||
_this.exit = function (_domNode, _element) { | ||
exit_1.apply(this, arguments); | ||
this.tooltipExit(); | ||
}; | ||
} | ||
return _this; | ||
} | ||
ITooltip.prototype.tooltipEnter = function (element) { | ||
var context = this; | ||
this.tooltip = tip() | ||
.attr("class", "d3-tip") | ||
.offset(function () { | ||
switch (context.tooltip.direction()()) { | ||
case "e": | ||
return [0, context.tooltipOffset()]; | ||
ITooltip.prototype.tooltipEnter = function (element) { | ||
element.call(this.tooltip); | ||
}; | ||
ITooltip.prototype.tooltipUpdate = function () { | ||
var _this = this; | ||
this.tooltip.offset(function () { | ||
switch (_this.tooltip.direction()()) { | ||
case "e": | ||
return [0, _this.tooltipOffset()]; | ||
default: | ||
return [-_this.tooltipOffset(), 0]; | ||
} | ||
}); | ||
var classed = this.tooltip.attr("class"); | ||
if (classed) { | ||
classed = classed.split(" notick").join("") + (this.tooltipTick() ? "" : " notick") + (this.tooltipStyle() === "none" ? " hidden" : ""); | ||
this.tooltip | ||
.attr("class", classed); | ||
} | ||
}; | ||
ITooltip.prototype.tooltipExit = function () { | ||
if (this.tooltip) { | ||
this.tooltip.destroy(); | ||
} | ||
}; | ||
ITooltip.prototype._tooltipHTML = function (d) { | ||
return d; | ||
}; | ||
ITooltip.prototype.tooltipHTML = function (_) { | ||
return this.tooltip.html(_); | ||
}; | ||
ITooltip.prototype.tooltipFormat = function (opts) { | ||
opts = opts || {}; | ||
opts.label = opts.label === undefined ? "" : opts.label; | ||
opts.series = opts.series || ""; | ||
if (opts.value instanceof Date) { | ||
opts.value = opts.value || ""; | ||
} | ||
else { | ||
opts.value = this._valueFormatter(opts.value) || ""; | ||
} | ||
switch (this.tooltipStyle()) { | ||
case "none": | ||
break; | ||
default: | ||
return [-context.tooltipOffset(), 0]; | ||
if (opts.series) { | ||
return "<span style='color:" + this.tooltipSeriesColor() + "'>" + opts.series + "</span> / <span style='color:" + this.tooltipLabelColor() + "'>" + opts.label + "</span>: <span style='color:" + this.tooltipValueColor() + "'>" + opts.value + "</span>"; | ||
} | ||
return "<span style='color:" + this.tooltipLabelColor() + "'>" + opts.label + "</span>: <span style='color:" + this.tooltipValueColor() + "'>" + opts.value + "</span>"; | ||
} | ||
}); | ||
element.call(this.tooltip); | ||
}; | ||
ITooltip.prototype.tooltipUpdate = function () { | ||
var classed = this.tooltip.attr("class"); | ||
if (classed) { | ||
classed = classed.split(" notick").join("") + (this.tooltipTick() ? "" : " notick") + (this.tooltipStyle() === "none" ? " hidden" : ""); | ||
this.tooltip | ||
.attr("class", classed); | ||
}; | ||
return ITooltip; | ||
}(common.Widget)); | ||
ITooltip.prototype.publish("tooltipStyle", "default", "set", "Style", ["default", "none"], {}); | ||
ITooltip.prototype.publish("tooltipValueFormat", ",.2f", "string", "Value Format", null, {}); | ||
ITooltip.prototype.publish("tooltipSeriesColor", "#EAFFFF", "html-color", "Series Color", null, {}); | ||
ITooltip.prototype.publish("tooltipLabelColor", "#CCFFFF", "html-color", "Label Color", null, {}); | ||
ITooltip.prototype.publish("tooltipValueColor", "white", "html-color", "Value Color", null, {}); | ||
ITooltip.prototype.publish("tooltipTick", true, "boolean", "Show tooltip tick", null, {}); | ||
ITooltip.prototype.publish("tooltipOffset", 8, "number", "Offset from the cursor", null, {}); | ||
var tooltipValueFormat = ITooltip.prototype.tooltipValueFormat; | ||
ITooltip.prototype.tooltipValueFormat = function (_) { | ||
var retVal = tooltipValueFormat.apply(this, arguments); | ||
if (arguments.length) { | ||
this._valueFormatter = format(_); | ||
} | ||
return retVal; | ||
}; | ||
ITooltip.prototype.tooltipExit = function () { | ||
if (this.tooltip) { | ||
this.tooltip.destroy(); | ||
var ITree = /** @class */ (function () { | ||
function ITree() { | ||
} | ||
}; | ||
ITooltip.prototype._tooltipHTML = function (d) { | ||
return d; | ||
}; | ||
ITooltip.prototype.tooltipHTML = function (_) { | ||
return this.tooltip.html(_); | ||
}; | ||
ITooltip.prototype.tooltipFormat = function (opts) { | ||
opts = opts || {}; | ||
opts.label = opts.label === undefined ? "" : opts.label; | ||
opts.series = opts.series || ""; | ||
if (opts.value instanceof Date) { | ||
opts.value = opts.value || ""; | ||
} | ||
else { | ||
opts.value = this._valueFormatter(opts.value) || ""; | ||
} | ||
switch (this.tooltipStyle()) { | ||
case "none": | ||
break; | ||
default: | ||
if (opts.series) { | ||
return "<span style='color:" + this.tooltipSeriesColor() + "'>" + opts.series + "</span> / <span style='color:" + this.tooltipLabelColor() + "'>" + opts.label + "</span>: <span style='color:" + this.tooltipValueColor() + "'>" + opts.value + "</span>"; | ||
} | ||
return "<span style='color:" + this.tooltipLabelColor() + "'>" + opts.label + "</span>: <span style='color:" + this.tooltipValueColor() + "'>" + opts.value + "</span>"; | ||
} | ||
}; | ||
return ITooltip; | ||
}(common.Widget)); | ||
ITooltip$1.prototype.publish("tooltipStyle", "default", "set", "Style", ["default", "none"], {}); | ||
ITooltip$1.prototype.publish("tooltipValueFormat", ",.2f", "string", "Value Format", null, {}); | ||
ITooltip$1.prototype.publish("tooltipSeriesColor", "#EAFFFF", "html-color", "Series Color", null, {}); | ||
ITooltip$1.prototype.publish("tooltipLabelColor", "#CCFFFF", "html-color", "Label Color", null, {}); | ||
ITooltip$1.prototype.publish("tooltipValueColor", "white", "html-color", "Value Color", null, {}); | ||
ITooltip$1.prototype.publish("tooltipTick", true, "boolean", "Show tooltip tick", null, {}); | ||
ITooltip$1.prototype.publish("tooltipOffset", 8, "number", "Offset from the cursor", null, {}); | ||
var tooltipValueFormat = ITooltip$1.prototype.tooltipValueFormat; | ||
ITooltip$1.prototype.tooltipValueFormat = function (_) { | ||
var retVal = tooltipValueFormat.apply(this, arguments); | ||
if (arguments.length) { | ||
this._valueFormatter = format(_); | ||
} | ||
return retVal; | ||
}; | ||
// Events --- | ||
ITree.prototype.click = function (row, column, selected) { | ||
console.log("Click: " + JSON.stringify(row) + ", " + column + ", " + selected); | ||
}; | ||
ITree.prototype.dblclick = function (row, column, selected) { | ||
console.log("Double click: " + JSON.stringify(row) + ", " + column + ", " + selected); | ||
}; | ||
return ITree; | ||
}()); | ||
ITree.prototype._palette = common.Palette.ordinal("default"); | ||
var ITree = /** @class */ (function () { | ||
function ITree() { | ||
} | ||
// Events --- | ||
ITree.prototype.click = function (row, column, selected) { | ||
console.log("Click: " + JSON.stringify(row) + ", " + column + ", " + selected); | ||
}; | ||
ITree.prototype.dblclick = function (row, column, selected) { | ||
console.log("Double click: " + JSON.stringify(row) + ", " + column + ", " + selected); | ||
}; | ||
return ITree; | ||
}()); | ||
ITree.prototype._palette = common.Palette.ordinal("default"); | ||
exports.I1DChart = I1DChart; | ||
exports.I2DChart = I2DChart; | ||
exports.IGraph = IGraph; | ||
exports.instanceOfIHighlight = instanceOfIHighlight; | ||
exports.IInput = IInput; | ||
exports.INDChart = INDChart; | ||
exports.ITooltip = ITooltip; | ||
exports.ITree = ITree; | ||
exports.I1DChart = I1DChart; | ||
exports.I2DChart = I2DChart; | ||
exports.IGraph = IGraph; | ||
exports.instanceOfIHighlight = instanceOfIHighlight; | ||
exports.IInput = IInput; | ||
exports.INDChart = INDChart; | ||
exports.ITooltip = ITooltip$1; | ||
exports.ITree = ITree; | ||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
}))); | ||
//# sourceMappingURL=index.js.map |
@@ -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(){}function i(t,e){function n(){this.constructor=t}g(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}function l(){}function a(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)]}function s(t,e){var n=a(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")}function u(t){return new c(t)}function c(t){if(!(e=b.exec(t)))throw new Error("invalid format: "+t);var e,n=e[1]||" ",o=e[2]||">",r=e[3]||"-",i=e[4]||"",l=!!e[5],a=e[6]&&+e[6],s=!!e[7],u=e[8]&&+e[8].slice(1),c=e[9]||"";"n"===c?(s=!0,c="g"):x[c]||(c=""),(l||"0"===n&&"="===o)&&(l=!0,n="0",o="="),this.fill=n,this.align=o,this.sign=r,this.symbol=i,this.zero=l,this.width=a,this.comma=s,this.precision=u,this.type=c}function p(t){return t}function f(t){function e(t){function e(t){var e,o,l,u=v,p=b;if("c"===g)p=w(t)+p,t="";else{var x=(t=+t)<0;if(t=w(Math.abs(t),d),x&&0==+t&&(x=!1),u=(x?"("===c?c:"-":"-"===c||"("===c?"":c)+u,p=p+("s"===g?E[8+m/3]:"")+(x&&"("===c?")":""),k)for(e=-1,o=t.length;++e<o;)if(48>(l=t.charCodeAt(e))||l>57){p=(46===l?r+t.slice(e+1):t.slice(e))+p,t=t.slice(0,e);break}}y&&!f&&(t=n(t,1/0));var C=u.length+t.length+p.length,S=C<h?new Array(h-C+1).join(a):"";switch(y&&f&&(t=n(S+t,S.length?h-p.length:1/0),S=""),s){case"<":t=u+t+p+S;break;case"=":t=u+S+t+p;break;case"^":t=S.slice(0,C=S.length>>1)+u+t+p+S.slice(C);break;default:t=S+u+t+p}return i(t)}var a=(t=u(t)).fill,s=t.align,c=t.sign,p=t.symbol,f=t.zero,h=t.width,y=t.comma,d=t.precision,g=t.type,v="$"===p?o[0]:"#"===p&&/[boxX]/.test(g)?"0"+g.toLowerCase():"",b="$"===p?o[1]:/[%p]/.test(g)?l:"",w=x[g],k=!g||/[defgprs%]/.test(g);return d=null==d?g?6:12:/[gprs]/.test(g)?Math.max(1,Math.min(21,d)):Math.max(0,Math.min(20,d)),e.toString=function(){return t+""},e}var n=t.grouping&&t.thousands?function(t,e){return function(n,o){for(var r=n.length,i=[],l=0,a=t[0],s=0;r>0&&a>0&&(s+a+1>o&&(a=Math.max(1,o-s)),i.push(n.substring(r-=a,r+a)),!((s+=a+1)>o));)a=t[l=(l+1)%t.length];return i.reverse().join(e)}}(t.grouping,t.thousands):p,o=t.currency,r=t.decimal,i=t.numerals?function(t){return function(e){return e.replace(/[0-9]/g,function(e){return t[+e]})}}(t.numerals):p,l=t.percent||"%";return{format:e,formatPrefix:function(t,n){var o=e((t=u(t),t.type="f",t)),r=3*Math.max(-8,Math.min(8,Math.floor(function(t){return(t=a(Math.abs(t)))?t[1]:NaN}(n)/3))),i=Math.pow(10,-r),l=E[8+r/3];return function(t){return o(i*t)+l}}}}function h(){}function y(t,e){var n=new h;if(t instanceof h)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 d(){}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 g=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])},v=function(t){function e(){return t.call(this)||this}return i(e,t),e.prototype.isValid=function(){if(this.validate()){if(!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);v.prototype.publish("name","","string","HTML name for the input"),v.prototype.publish("label","","string","Descriptive label"),v.prototype.publish("value","","string","Input Current Value"),v.prototype.publish("validate",null,"string","Input Validation"),l.prototype._palette=e.Palette.ordinal("default"),l.prototype.click=function(t,e,n){console.log("Click: "+JSON.stringify(t)+", "+e+", "+n)},l.prototype.dblclick=function(t,e,n){console.log("Double click: "+JSON.stringify(t)+", "+e+", "+n)};var m,x={"":function(t,e){t:for(var n,o=(t=t.toPrecision(e)).length,r=1,i=-1;r<o;++r)switch(t[r]){case".":i=n=r;break;case"0":0===i&&(i=r),n=r;break;case"e":break t;default:i>0&&(i=0)}return i>0?t.slice(0,i)+t.slice(n+1):t},"%":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 s(100*t,e)},r:s,s:function(t,e){var n=a(t,e);if(!n)return t+"";var o=n[0],r=n[1],i=r-(m=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")+a(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)}},b=/^(?:(.)?([<>=^]))?([+\-\( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?([a-z%])?$/i;u.prototype=c.prototype,c.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.type};var w,k,C,E=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];!function(t){w=f(t),k=w.format,C=w.formatPrefix}({decimal:".",thousands:",",grouping:[3],currency:["$",""]});h.prototype=y.prototype={constructor:h,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 S=y.prototype;d.prototype=function(t,e){var n=new d;if(t instanceof d)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:d,has:S.has,add:function(t){return t+="",this["$"+t]=t,this},remove:S.remove,clear:S.clear,values:S.keys,size:S.size,empty:S.empty,each:S.each},function(t,e){if("undefined"==typeof document)return e;t=t||"";var n=document.head||document.getElementsByTagName("head")[0],o=document.createElement("style");o.type="text/css",n.appendChild(o),o.styleSheet?o.styleSheet.cssText=t:o.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',void 0);var M=function(t){function n(){var e=t.call(this)||this;if(e._valueFormatter=k(e.tooltipValueFormat()),e.layerEnter){var n=e.layerEnter;e.layerEnter=function(t,e,o){this.tooltipEnter(e),n.apply(this,arguments)};var o=e.layerUpdate;e.layerUpdate=function(t){o.apply(this,arguments),this.tooltipUpdate()};var r=e.layerExit;e.layerExit=function(t){r.apply(this,arguments),this.tooltipExit()}}else{var i=e.enter;e.enter=function(t,e){this.tooltipEnter(e),i.apply(this,arguments)};var l=e.update;e.update=function(t,e){l.apply(this,arguments),this.tooltipUpdate()};var a=e.exit;e.exit=function(t,e){a.apply(this,arguments),this.tooltipExit()}}return e}return i(n,t),n.prototype.tooltipEnter=function(t){var n=this;this.tooltip=function(){function t(t){(p=function(e){var n=t.node();return n?"svg"===n.tagName.toLowerCase()?n:n.ownerSVGElement:null}())&&(f=p.createSVGPoint(),u().appendChild(c))}function n(){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 o(){return null==c&&(c=n(),u().appendChild(c)),e.select(c)}function r(){for(var t=h||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,a=o.y;return f.x=l,f.y=a,e.nw=f.matrixTransform(n),f.x+=r,e.ne=f.matrixTransform(n),f.y+=i,e.se=f.matrixTransform(n),f.x-=r,e.sw=f.matrixTransform(n),f.y-=i/2,e.w=f.matrixTransform(n),f.x+=r,e.e=f.matrixTransform(n),f.x-=r/2,f.y-=i/2,e.n=f.matrixTransform(n),f.y+=i,e.s=f.matrixTransform(n),e}function i(t){return"function"==typeof t?t:function(){return t}}var l=function(){return"n"},a=function(){return[0,0]},s=function(){return" "},u=i(document.body),c=n(),p=null,f=null,h=null;t.show=function(){var e=Array.prototype.slice.call(arguments);e[e.length-1]instanceof SVGElement&&(h=e.pop());var n,r=s.apply(this,e),i=a.apply(this,e),c=l.apply(this,e),p=o(),f=g.length,y=document.documentElement.scrollTop||u().scrollTop,v=document.documentElement.scrollLeft||u().scrollLeft;for(p.html(r).style("opacity",1).style("pointer-events","all");f--;)p.classed(g[f],!1);return n=d.get(c).apply(this),p.classed(c,!0).style("top",n.top+i[0]+y+"px").style("left",n.left+i[1]+v+"px"),t},t.hide=function(){return o().style("opacity",0).style("pointer-events","none"),t},t.attr=function(n,r){if(arguments.length<2&&"string"==typeof n)return o().attr(n);var i=Array.prototype.slice.call(arguments);return e.selection.prototype.attr.apply(o(),i),t},t.style=function(n,r){if(arguments.length<2&&"string"==typeof n)return o().style(n);var i=Array.prototype.slice.call(arguments);return e.selection.prototype.style.apply(o(),i),t},t.direction=function(e){return arguments.length?(l=null==e?e:i(e),t):l},t.offset=function(e){return arguments.length?(a=null==e?e:i(e),t):a},t.html=function(e){return arguments.length?(s=null==e?e:i(e),t):s},t.rootElement=function(e){return arguments.length?(u=null==e?e:i(e),t):u},t.destroy=function(){return c&&(o().remove(),c=null),t};var d=y({n:function(){var t=r();return{top:t.n.y-c.offsetHeight,left:t.n.x-c.offsetWidth/2}},s:function(){var t=r();return{top:t.s.y,left:t.s.x-c.offsetWidth/2}},e:function(){var t=r();return{top:t.e.y-c.offsetHeight/2,left:t.e.x}},w:function(){var t=r();return{top:t.w.y-c.offsetHeight/2,left:t.w.x-c.offsetWidth}},nw:function(){var t=r();return{top:t.nw.y-c.offsetHeight,left:t.nw.x-c.offsetWidth}},ne:function(){var t=r();return{top:t.ne.y-c.offsetHeight,left:t.ne.x}},sw:function(){var t=r();return{top:t.sw.y,left:t.sw.x-c.offsetWidth}},se:function(){var t=r();return{top:t.se.y,left:t.se.x}}}),g=d.keys();return t}().attr("class","d3-tip").offset(function(){switch(n.tooltip.direction()()){case"e":return[0,n.tooltipOffset()];default:return[-n.tooltipOffset(),0]}}),t.call(this.tooltip)},n.prototype.tooltipUpdate=function(){var t=this.tooltip.attr("class");t&&(t=t.split(" notick").join("")+(this.tooltipTick()?"":" notick")+("none"===this.tooltipStyle()?" hidden":""),this.tooltip.attr("class",t))},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||{},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);M.prototype.publish("tooltipStyle","default","set","Style",["default","none"],{}),M.prototype.publish("tooltipValueFormat",",.2f","string","Value Format",null,{}),M.prototype.publish("tooltipSeriesColor","#EAFFFF","html-color","Series Color",null,{}),M.prototype.publish("tooltipLabelColor","#CCFFFF","html-color","Label Color",null,{}),M.prototype.publish("tooltipValueColor","white","html-color","Value Color",null,{}),M.prototype.publish("tooltipTick",!0,"boolean","Show tooltip tick",null,{}),M.prototype.publish("tooltipOffset",8,"number","Offset from the cursor",null,{});var _=M.prototype.tooltipValueFormat;M.prototype.tooltipValueFormat=function(t){var e=_.apply(this,arguments);return arguments.length&&(this._valueFormatter=k(t)),e};var T=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}();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=v,t.INDChart=l,t.ITooltip=M,t.ITree=T,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 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,s=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 u(){}function c(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)]}function p(t,e){var n=c(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")}s.prototype.publish("name","","string","HTML name for the input"),s.prototype.publish("label","","string","Descriptive label"),s.prototype.publish("value","","string","Input Current Value"),s.prototype.publish("validate",null,"string","Input Validation"),u.prototype._palette=e.Palette.ordinal("default"),u.prototype.click=function(t,e,n){console.log("Click: "+JSON.stringify(t)+", "+e+", "+n)},u.prototype.dblclick=function(t,e,n){console.log("Double click: "+JSON.stringify(t)+", "+e+", "+n)};var f={"":function(t,e){t=t.toPrecision(e);t:for(var n,o=t.length,r=1,i=-1;r<o;++r)switch(t[r]){case".":i=n=r;break;case"0":0===i&&(i=r),n=r;break;case"e":break t;default:i>0&&(i=0)}return i>0?t.slice(0,i)+t.slice(n+1):t},"%":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 p(100*t,e)},r:p,s:function(t,e){var n=c(t,e);if(!n)return t+"";var o=n[0],r=n[1],i=r-(a=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")+c(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)}},h=/^(?:(.)?([<>=^]))?([+\-\( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?([a-z%])?$/i;function y(t){return new d(t)}function d(t){if(!(e=h.exec(t)))throw new Error("invalid format: "+t);var e,n=e[1]||" ",o=e[2]||">",r=e[3]||"-",i=e[4]||"",l=!!e[5],a=e[6]&&+e[6],s=!!e[7],u=e[8]&&+e[8].slice(1),c=e[9]||"";"n"===c?(s=!0,c="g"):f[c]||(c=""),(l||"0"===n&&"="===o)&&(l=!0,n="0",o="="),this.fill=n,this.align=o,this.sign=r,this.symbol=i,this.zero=l,this.width=a,this.comma=s,this.precision=u,this.type=c}function g(t){return t}y.prototype=d.prototype,d.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.type};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,s=t.percent||"%";function u(t){var e=(t=y(t)).fill,n=t.align,u=t.sign,c=t.symbol,p=t.zero,h=t.width,d=t.comma,g=t.precision,v=t.type,m="$"===c?r[0]:"#"===c&&/[boxX]/.test(v)?"0"+v.toLowerCase():"",b="$"===c?r[1]:/[%p]/.test(v)?s:"",w=f[v],k=!v||/[defgprs%]/.test(v);function C(t){var r,s,c,f=m,y=b;if("c"===v)y=w(t)+y,t="";else{var C=(t=+t)<0;if(t=w(Math.abs(t),g),C&&0==+t&&(C=!1),f=(C?"("===u?u:"-":"-"===u||"("===u?"":u)+f,y=y+("s"===v?x[8+a/3]:"")+(C&&"("===u?")":""),k)for(r=-1,s=t.length;++r<s;)if(48>(c=t.charCodeAt(r))||c>57){y=(46===c?i+t.slice(r+1):t.slice(r))+y,t=t.slice(0,r);break}}d&&!p&&(t=o(t,1/0));var E=f.length+t.length+y.length,S=E<h?new Array(h-E+1).join(e):"";switch(d&&p&&(t=o(S+t,S.length?h-y.length:1/0),S=""),n){case"<":t=f+t+y+S;break;case"=":t=f+S+t+y;break;case"^":t=S.slice(0,E=S.length>>1)+f+t+y+S.slice(E);break;default:t=S+f+t+y}return l(t)}return g=null==g?v?6:12:/[gprs]/.test(v)?Math.max(1,Math.min(21,g)):Math.max(0,Math.min(20,g)),C.toString=function(){return t+""},C}return{format:u,formatPrefix:function(t,e){var n,o=u(((t=y(t)).type="f",t)),r=3*Math.max(-8,Math.min(8,Math.floor((n=e,((n=c(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=s,t.INDChart=u,t.ITooltip=S,t.ITree=_,Object.defineProperty(t,"__esModule",{value:!0})}); |
{ | ||
"name": "@hpcc-js/api", | ||
"version": "0.0.74", | ||
"version": "0.0.75", | ||
"description": "hpcc-js - Viz api", | ||
@@ -28,16 +28,19 @@ "main": "dist/index.js", | ||
"dependencies": { | ||
"@hpcc-js/common": "^0.0.74" | ||
"@hpcc-js/common": "^0.0.75" | ||
}, | ||
"devDependencies": { | ||
"concurrently": "3.5.0", | ||
"concurrently": "3.5.1", | ||
"d3-format": "1.2.0", | ||
"d3-tip": "GordonSmith/d3-tip#vJSNEXT", | ||
"rimraf": "2.6.2", | ||
"rollup": "0.54.0", | ||
"rollup-plugin-postcss": "0.5.5", | ||
"tslib": "1.8.0", | ||
"tslint": "5.8.0", | ||
"rollup": "0.58.2", | ||
"rollup-plugin-alias": "1.4.0", | ||
"rollup-plugin-commonjs": "9.1.0", | ||
"rollup-plugin-node-resolve": "3.3.0", | ||
"rollup-plugin-postcss": "1.6.1", | ||
"tslib": "1.9.0", | ||
"tslint": "5.9.1", | ||
"typedoc": "0.7.1", | ||
"typescript": "2.8.1", | ||
"uglify-es": "3.2.0" | ||
"typescript": "2.8.3", | ||
"uglify-es": "3.3.9" | ||
}, | ||
@@ -44,0 +47,0 @@ "repository": { |
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
279591
2024
14
+ Added@hpcc-js/common@0.0.75(transitive)
+ Added@hpcc-js/util@0.0.73(transitive)
- Removed@hpcc-js/common@0.0.74(transitive)
- Removed@hpcc-js/util@0.0.72(transitive)
Updated@hpcc-js/common@^0.0.75