Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
hideLater: function (time) {
if (this._show && !(this._inContent && this._enterable)) {
if (time) {
this._hideDelay = time; // Set show false to avoid invoke hideLater mutiple times
this._show = false;
this._hideTimeout = setTimeout(zrUtil.bind(this.hide, this), time);
} else {
this.hide();
}
}
},
isShow: function () {
return {
coordSys: {
type: 'geo',
x: rect.x,
y: rect.y,
width: rect.width,
height: rect.height
},
api: {
coord: function (data) {
// do not provide "out" and noRoam param,
// Compatible with this usage:
// echarts.util.map(item.points, api.coord)
return coordSys.dataToPoint(data);
},
size: zrUtil.bind(dataToCoordSize, coordSys)
}
};
}
export default function (coordSys) {
var rect = coordSys.grid.getRect();
return {
coordSys: {
// The name exposed to user is always 'cartesian2d' but not 'grid'.
type: 'cartesian2d',
x: rect.x,
y: rect.y,
width: rect.width,
height: rect.height
},
api: {
coord: zrUtil.bind(coordSys.dataToPoint, coordSys),
size: zrUtil.bind(dataToCoordSize, coordSys)
}
};
}
coordSys: {
type: 'geo',
x: rect.x,
y: rect.y,
width: rect.width,
height: rect.height,
zoom: coordSys.getZoom()
},
api: {
coord: function (data) {
// do not provide "out" and noRoam param,
// Compatible with this usage:
// echarts.util.map(item.points, api.coord)
return coordSys.dataToPoint(data);
},
size: zrUtil.bind(dataToCoordSize, coordSys)
}
};
}
_showOrMove: function (tooltipModel, cb) {
// showDelay is used in this case: tooltip.enterable is set
// as true. User intent to move mouse into tooltip and click
// something. `showDelay` makes it easyer to enter the content
// but tooltip do not move immediately.
var delay = tooltipModel.get('showDelay');
cb = zrUtil.bind(cb, this);
clearTimeout(this._showTimout);
delay > 0
? (this._showTimout = setTimeout(cb, delay))
: cb();
},
function createExtensionAPI(ecInstance) {
var coordSysMgr = ecInstance._coordSysMgr;
return zrUtil.extend(new ExtensionAPI(ecInstance), {
// Inject methods
getCoordinateSystems: zrUtil.bind(coordSysMgr.getCoordinateSystems, coordSysMgr),
getComponentByElement: function (el) {
while (el) {
var modelInfo = el.__ecComponentInfo;
if (modelInfo != null) {
return ecInstance._model.getComponent(modelInfo.mainType, modelInfo.index);
}
el = el.parent;
}
}
});
}
/**
*/
this._scheduler = new Scheduler(this, api, dataProcessorFuncs, visualFuncs);
Eventful.call(this, this._ecEventProcessor = new EventProcessor());
/**
* @type {module:echarts~MessageCenter}
* @private
*/
this._messageCenter = new MessageCenter();
// Init mouse events
this._initEvents();
// In case some people write `window.onresize = chart.resize`
this.resize = zrUtil.bind(this.resize, this);
// Can't dispatch action during rendering procedure
this._pendingActions = [];
zr.animation.on('frame', this._onframe, this);
bindRenderedEvent(zr, this);
// ECharts instance can be used as value.
zrUtil.setAsPrimitive(this);
}
init: function (ecModel, api) {
AxisView.superApply(this, 'init', arguments);
/**
* @type {module:echarts/component/helper/BrushController}
*/
(this._brushController = new BrushController(api.getZr()))
.on('brush', zrUtil.bind(this._onBrush, this));
},
function renderItem(item) {
var piece = item.piece;
var itemGroup = new graphic.Group();
itemGroup.onclick = zrUtil.bind(this._onItemClick, this, piece);
this._enableHoverLink(itemGroup, item.indexInModelPieceList);
var representValue = visualMapModel.getRepresentValue(piece);
this._createItemSymbol(
itemGroup, representValue, [0, 0, itemSize[0], itemSize[1]]
);
if (showLabel) {
var visualState = this.visualMapModel.getValueState(representValue);
itemGroup.add(new graphic.Text({
style: {
x: itemAlign === 'right' ? -textGap : itemSize[0] + textGap,
y: itemSize[1] / 2,
zrUtil.each(handlers, function (handler, eventName) {
api.getZr().on(eventName, this._handlers[eventName] = zrUtil.bind(handler, this));
}, this);
}