Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
it('should make position map having only an end property, if it is not range value.', () => {
const seriesItem = {
value: 10
};
const bound = {
left: 30,
top: 20,
width: 40,
height: 50
};
const makePosition = snippet.bind(labelHelper._makePositionForBoundType, labelHelper);
const actual = labelHelper._makePositionMap(seriesItem, bound, 20, {}, makePosition);
expect(actual.end).toEqual({
left: 50,
top: 45
});
expect(actual.start).toBeUndefined();
});
* @type {{
* M: MapChartMapModel._makeCoordinate, m: MapChartMapModel._makeCoordinateFromRelativeCoordinate,
* L: MapChartMapModel._makeCoordinate, l: MapChartMapModel._makeCoordinateFromRelativeCoordinate,
* H: MapChartMapModel._makeXCoordinate, h: MapChartMapModel._makeXCoordinateFroRelativeCoordinate,
* V: MapChartMapModel._makeYCoordinate, v: MapChartMapModel._makeYCoordinateFromRelativeCoordinate
* }}
*/
this.commandFuncMap = {
M: snippet.bind(this._makeCoordinate, this),
m: snippet.bind(this._makeCoordinateFromRelativeCoordinate, this),
L: snippet.bind(this._makeCoordinate, this),
l: snippet.bind(this._makeCoordinateFromRelativeCoordinate, this),
H: snippet.bind(this._makeXCoordinate, this),
h: snippet.bind(this._makeXCoordinateFroRelativeCoordinate, this),
V: snippet.bind(this._makeYCoordinate, this),
v: snippet.bind(this._makeYCoordinateFromRelativeCoordinate, this)
};
/**
* Ignore command map.
* @type {{Z: boolean, z: boolean}}
*/
this.ignoreCommandMap = {
Z: true,
z: true
};
/**
* Map dimension
* @type {{width: number, height: number}}
*/
this.mapDimension = null;
_findSimpleTypeFormatFunctions(format) {
let funcs = [];
let len;
if (this._isDecimal(format)) {
len = this._pickMaxLenUnderPoint([format]);
funcs = [snippet.bind(this._formatToDecimal, this, len)];
} else if (this._isZeroFill(format)) {
len = format.length;
funcs = [snippet.bind(this._formatToZeroFill, this, len)];
return funcs;
}
if (this._isComma(format)) {
funcs.push(renderUtil.formatToComma);
}
return funcs;
}
_addEventListener(target, type, handler, context) {
let bindHandler;
if (context) {
bindHandler = snippet.bind(handler, context);
} else {
bindHandler = handler;
}
bindHandlerMap[type + handler] = bindHandler;
target.addEventListener(type, bindHandler);
},
/**
* Command function map.
* @type {{
* M: MapChartMapModel._makeCoordinate, m: MapChartMapModel._makeCoordinateFromRelativeCoordinate,
* L: MapChartMapModel._makeCoordinate, l: MapChartMapModel._makeCoordinateFromRelativeCoordinate,
* H: MapChartMapModel._makeXCoordinate, h: MapChartMapModel._makeXCoordinateFroRelativeCoordinate,
* V: MapChartMapModel._makeYCoordinate, v: MapChartMapModel._makeYCoordinateFromRelativeCoordinate
* }}
*/
this.commandFuncMap = {
M: snippet.bind(this._makeCoordinate, this),
m: snippet.bind(this._makeCoordinateFromRelativeCoordinate, this),
L: snippet.bind(this._makeCoordinate, this),
l: snippet.bind(this._makeCoordinateFromRelativeCoordinate, this),
H: snippet.bind(this._makeXCoordinate, this),
h: snippet.bind(this._makeXCoordinateFroRelativeCoordinate, this),
V: snippet.bind(this._makeYCoordinate, this),
v: snippet.bind(this._makeYCoordinateFromRelativeCoordinate, this)
};
/**
* Ignore command map.
* @type {{Z: boolean, z: boolean}}
*/
this.ignoreCommandMap = {
Z: true,
z: true
};
/**
* Map dimension
* @type {{width: number, height: number}}
_attachToEventBus() {
this.eventBus.on({
showWedge: this.onShowWedge,
hideTooltip: this.onHideWedge
}, this);
this.eventBus.on('beforeImageDownload', snippet.bind(this._removeLocationURLFromFillAttribute, this));
this.eventBus.on('afterImageDownload', snippet.bind(this._restoreLocationURLToFillAttribute, this));
}
* Command function map.
* @type {{
* M: MapChartMapModel._makeCoordinate, m: MapChartMapModel._makeCoordinateFromRelativeCoordinate,
* L: MapChartMapModel._makeCoordinate, l: MapChartMapModel._makeCoordinateFromRelativeCoordinate,
* H: MapChartMapModel._makeXCoordinate, h: MapChartMapModel._makeXCoordinateFroRelativeCoordinate,
* V: MapChartMapModel._makeYCoordinate, v: MapChartMapModel._makeYCoordinateFromRelativeCoordinate
* }}
*/
this.commandFuncMap = {
M: snippet.bind(this._makeCoordinate, this),
m: snippet.bind(this._makeCoordinateFromRelativeCoordinate, this),
L: snippet.bind(this._makeCoordinate, this),
l: snippet.bind(this._makeCoordinateFromRelativeCoordinate, this),
H: snippet.bind(this._makeXCoordinate, this),
h: snippet.bind(this._makeXCoordinateFroRelativeCoordinate, this),
V: snippet.bind(this._makeYCoordinate, this),
v: snippet.bind(this._makeYCoordinateFromRelativeCoordinate, this)
};
/**
* Ignore command map.
* @type {{Z: boolean, z: boolean}}
*/
this.ignoreCommandMap = {
Z: true,
z: true
};
/**
* Map dimension
* @type {{width: number, height: number}}
*/
* @type {{
* M: MapChartMapModel._makeCoordinate, m: MapChartMapModel._makeCoordinateFromRelativeCoordinate,
* L: MapChartMapModel._makeCoordinate, l: MapChartMapModel._makeCoordinateFromRelativeCoordinate,
* H: MapChartMapModel._makeXCoordinate, h: MapChartMapModel._makeXCoordinateFroRelativeCoordinate,
* V: MapChartMapModel._makeYCoordinate, v: MapChartMapModel._makeYCoordinateFromRelativeCoordinate
* }}
*/
this.commandFuncMap = {
M: snippet.bind(this._makeCoordinate, this),
m: snippet.bind(this._makeCoordinateFromRelativeCoordinate, this),
L: snippet.bind(this._makeCoordinate, this),
l: snippet.bind(this._makeCoordinateFromRelativeCoordinate, this),
H: snippet.bind(this._makeXCoordinate, this),
h: snippet.bind(this._makeXCoordinateFroRelativeCoordinate, this),
V: snippet.bind(this._makeYCoordinate, this),
v: snippet.bind(this._makeYCoordinateFromRelativeCoordinate, this)
};
/**
* Ignore command map.
* @type {{Z: boolean, z: boolean}}
*/
this.ignoreCommandMap = {
Z: true,
z: true
};
/**
* Map dimension
* @type {{width: number, height: number}}
*/
this.mapDimension = null;
TimeGrid.prototype.attachEvent = function() {
clearInterval(this.intervalID);
clearTimeout(this.timerID);
this.intervalID = this.timerID = null;
this.timerID = setTimeout(util.bind(this.onTick, this), (SIXTY_SECONDS - new TZDate().getSeconds()) * 1000);
domevent.on(this.stickyContainer, 'click', this._onClickStickyContainer, this);
};
* Tooltip container.
* @type {HTMLElement}
*/
this.tooltipContainer = null;
/**
* Tooltip suffix.
* @type {string}
*/
this.suffix = this.options.suffix ? ` ${this.options.suffix}` : '';
/**
* Tooltip template function.
* @type {function}
*/
this.templateFunc = this.options.template || snippet.bind(this._makeTooltipHtml, this);
/**
* Tooltip animation time.
* @type {number}
*/
this.animationTime = isPieChart ? chartConst.TOOLTIP_PIE_ANIMATION_TIME : chartConst.TOOLTIP_ANIMATION_TIME;
/**
* TooltipBase base data.
* @type {Array.>}
*/
this.data = [];
/**
* layout bounds information for this components
* @type {null|{dimension:{width:number, height:number}, position:{left:number, top:number}}}