code
stringlengths 10
343k
| docstring
stringlengths 36
21.9k
| func_name
stringlengths 1
3.35k
| language
stringclasses 1
value | repo
stringlengths 7
58
| path
stringlengths 4
131
| url
stringlengths 44
195
| license
stringclasses 5
values |
---|---|---|---|---|---|---|---|
var Animator = function (target, loop, getter, setter) {
this._tracks = {};
this._target = target;
this._loop = loop || false;
this._getter = getter || defaultGetter;
this._setter = setter || defaultSetter;
this._clipCount = 0;
this._delay = 0;
this._doneList = [];
this._onframeList = [];
this._clipList = [];
}; | @alias module:zrender/animation/Animator
@constructor
@param {Object} target
@param {boolean} loop
@param {Function} getter
@param {Function} setter | Animator ( target , loop , getter , setter ) | javascript | SuperMap/iClient-JavaScript | libs/echarts/echarts.common.js | https://github.com/SuperMap/iClient-JavaScript/blob/master/libs/echarts/echarts.common.js | Apache-2.0 |
during: function (callback) {
this._onframeList.push(callback);
return this;
}, | 添加动画每一帧的回调函数
@param {Function} callback
@return {module:zrender/animation/Animator} | during ( callback ) | javascript | SuperMap/iClient-JavaScript | libs/echarts/echarts.common.js | https://github.com/SuperMap/iClient-JavaScript/blob/master/libs/echarts/echarts.common.js | Apache-2.0 |
start: function (easing, forceAnimate) {
var self = this;
var clipCount = 0;
var oneTrackDone = function () {
clipCount--;
if (!clipCount) {
self._doneCallback();
}
};
var lastClip;
for (var propName in this._tracks) {
if (!this._tracks.hasOwnProperty(propName)) {
continue;
}
var clip = createTrackClip(
this, easing, oneTrackDone,
this._tracks[propName], propName, forceAnimate
);
if (clip) {
this._clipList.push(clip);
clipCount++;
// If start after added to animation
if (this.animation) {
this.animation.addClip(clip);
}
lastClip = clip;
}
}
// Add during callback on the last clip
if (lastClip) {
var oldOnFrame = lastClip.onframe;
lastClip.onframe = function (target, percent) {
oldOnFrame(target, percent);
for (var i = 0; i < self._onframeList.length; i++) {
self._onframeList[i](target, percent);
}
};
}
// This optimization will help the case that in the upper application
// the view may be refreshed frequently, where animation will be
// called repeatly but nothing changed.
if (!clipCount) {
this._doneCallback();
}
return this;
}, | Start the animation
@param {string|Function} [easing]
动画缓动函数,详见{@link module:zrender/animation/easing}
@param {boolean} forceAnimate
@return {module:zrender/animation/Animator} | start ( easing , forceAnimate ) | javascript | SuperMap/iClient-JavaScript | libs/echarts/echarts.common.js | https://github.com/SuperMap/iClient-JavaScript/blob/master/libs/echarts/echarts.common.js | Apache-2.0 |
stop: function (forwardToLast) {
var clipList = this._clipList;
var animation = this.animation;
for (var i = 0; i < clipList.length; i++) {
var clip = clipList[i];
if (forwardToLast) {
// Move to last frame before stop
clip.onframe(this._target, 1);
}
animation && animation.removeClip(clip);
}
clipList.length = 0;
}, | Stop animation
@param {boolean} forwardToLast If move to last frame before stop | stop ( forwardToLast ) | javascript | SuperMap/iClient-JavaScript | libs/echarts/echarts.common.js | https://github.com/SuperMap/iClient-JavaScript/blob/master/libs/echarts/echarts.common.js | Apache-2.0 |
delay: function (time) {
this._delay = time;
return this;
}, | Set when animation delay starts
@param {number} time 单位ms
@return {module:zrender/animation/Animator} | delay ( time ) | javascript | SuperMap/iClient-JavaScript | libs/echarts/echarts.common.js | https://github.com/SuperMap/iClient-JavaScript/blob/master/libs/echarts/echarts.common.js | Apache-2.0 |
done: function (cb) {
if (cb) {
this._doneList.push(cb);
}
return this;
}, | Add callback for animation end
@param {Function} cb
@return {module:zrender/animation/Animator} | done ( cb ) | javascript | SuperMap/iClient-JavaScript | libs/echarts/echarts.common.js | https://github.com/SuperMap/iClient-JavaScript/blob/master/libs/echarts/echarts.common.js | Apache-2.0 |
getClips: function () {
return this._clipList;
} | @return {Array.<module:zrender/animation/Clip>} | getClips ( ) | javascript | SuperMap/iClient-JavaScript | libs/echarts/echarts.common.js | https://github.com/SuperMap/iClient-JavaScript/blob/master/libs/echarts/echarts.common.js | Apache-2.0 |
var Animatable = function () {
/**
* @type {Array.<module:zrender/animation/Animator>}
* @readOnly
*/
this.animators = [];
}; | @alias module:zrender/mixin/Animatable
@constructor | Animatable ( ) | javascript | SuperMap/iClient-JavaScript | libs/echarts/echarts.common.js | https://github.com/SuperMap/iClient-JavaScript/blob/master/libs/echarts/echarts.common.js | Apache-2.0 |
animate: function (path, loop) {
var target;
var animatingShape = false;
var el = this;
var zr = this.__zr;
if (path) {
var pathSplitted = path.split('.');
var prop = el;
// If animating shape
animatingShape = pathSplitted[0] === 'shape';
for (var i = 0, l = pathSplitted.length; i < l; i++) {
if (!prop) {
continue;
}
prop = prop[pathSplitted[i]];
}
if (prop) {
target = prop;
}
}
else {
target = el;
}
if (!target) {
logError$1(
'Property "'
+ path
+ '" is not existed in element '
+ el.id
);
return;
}
var animators = el.animators;
var animator = new Animator(target, loop);
animator.during(function (target) {
el.dirty(animatingShape);
})
.done(function () {
// FIXME Animator will not be removed if use `Animator#stop` to stop animation
animators.splice(indexOf(animators, animator), 1);
});
animators.push(animator);
// If animate after added to the zrender
if (zr) {
zr.animation.addAnimator(animator);
}
return animator;
}, | 动画
@param {string} path The path to fetch value from object, like 'a.b.c'.
@param {boolean} [loop] Whether to loop animation.
@return {module:zrender/animation/Animator}
@example:
el.animate('style', false)
.when(1000, {x: 10} )
.done(function(){ // Animation done })
.start() | animate ( path , loop ) | javascript | SuperMap/iClient-JavaScript | libs/echarts/echarts.common.js | https://github.com/SuperMap/iClient-JavaScript/blob/master/libs/echarts/echarts.common.js | Apache-2.0 |
stopAnimation: function (forwardToLast) {
var animators = this.animators;
var len = animators.length;
for (var i = 0; i < len; i++) {
animators[i].stop(forwardToLast);
}
animators.length = 0;
return this;
}, | 停止动画
@param {boolean} forwardToLast If move to last frame before stop | stopAnimation ( forwardToLast ) | javascript | SuperMap/iClient-JavaScript | libs/echarts/echarts.common.js | https://github.com/SuperMap/iClient-JavaScript/blob/master/libs/echarts/echarts.common.js | Apache-2.0 |
animateFrom: function (target, time, delay, easing, callback, forceAnimate) {
animateTo(this, target, time, delay, easing, callback, forceAnimate, true);
} | Animate from the target state to current state.
The params and the return value are the same as `this.animateTo`. | animateFrom ( target , time , delay , easing , callback , forceAnimate ) | javascript | SuperMap/iClient-JavaScript | libs/echarts/echarts.common.js | https://github.com/SuperMap/iClient-JavaScript/blob/master/libs/echarts/echarts.common.js | Apache-2.0 |
var Element = function (opts) { // jshint ignore:line
Transformable.call(this, opts);
Eventful.call(this, opts);
Animatable.call(this, opts);
/**
* 画布元素ID
* @type {string}
*/
this.id = opts.id || guid();
}; | @alias module:zrender/Element
@constructor
@extends {module:zrender/mixin/Animatable}
@extends {module:zrender/mixin/Transformable}
@extends {module:zrender/mixin/Eventful} | Element ( opts ) | javascript | SuperMap/iClient-JavaScript | libs/echarts/echarts.common.js | https://github.com/SuperMap/iClient-JavaScript/blob/master/libs/echarts/echarts.common.js | Apache-2.0 |
drift: function (dx, dy) {
switch (this.draggable) {
case 'horizontal':
dy = 0;
break;
case 'vertical':
dx = 0;
break;
}
var m = this.transform;
if (!m) {
m = this.transform = [1, 0, 0, 1, 0, 0];
}
m[4] += dx;
m[5] += dy;
this.decomposeTransform();
this.dirty(false);
}, | Drift element
@param {number} dx dx on the global space
@param {number} dy dy on the global space | drift ( dx , dy ) | javascript | SuperMap/iClient-JavaScript | libs/echarts/echarts.common.js | https://github.com/SuperMap/iClient-JavaScript/blob/master/libs/echarts/echarts.common.js | Apache-2.0 |
traverse: function (cb, context) {}, | @param {Function} cb
@param {} context | traverse ( cb , context ) | javascript | SuperMap/iClient-JavaScript | libs/echarts/echarts.common.js | https://github.com/SuperMap/iClient-JavaScript/blob/master/libs/echarts/echarts.common.js | Apache-2.0 |
attr: function (key, value) {
if (typeof key === 'string') {
this.attrKV(key, value);
}
else if (isObject$1(key)) {
for (var name in key) {
if (key.hasOwnProperty(name)) {
this.attrKV(name, key[name]);
}
}
}
this.dirty(false);
return this;
}, | @param {string|Object} key
@param {*} value | attr ( key , value ) | javascript | SuperMap/iClient-JavaScript | libs/echarts/echarts.common.js | https://github.com/SuperMap/iClient-JavaScript/blob/master/libs/echarts/echarts.common.js | Apache-2.0 |
setClipPath: function (clipPath) {
var zr = this.__zr;
if (zr) {
clipPath.addSelfToZr(zr);
}
// Remove previous clip path
if (this.clipPath && this.clipPath !== clipPath) {
this.removeClipPath();
}
this.clipPath = clipPath;
clipPath.__zr = zr;
clipPath.__clipTarget = this;
this.dirty(false);
}, | @param {module:zrender/graphic/Path} clipPath | setClipPath ( clipPath ) | javascript | SuperMap/iClient-JavaScript | libs/echarts/echarts.common.js | https://github.com/SuperMap/iClient-JavaScript/blob/master/libs/echarts/echarts.common.js | Apache-2.0 |
addSelfToZr: function (zr) {
this.__zr = zr;
// 添加动画
var animators = this.animators;
if (animators) {
for (var i = 0; i < animators.length; i++) {
zr.animation.addAnimator(animators[i]);
}
}
if (this.clipPath) {
this.clipPath.addSelfToZr(zr);
}
}, | Add self from zrender instance.
Not recursively because it will be invoked when element added to storage.
@param {module:zrender/ZRender} zr | addSelfToZr ( zr ) | javascript | SuperMap/iClient-JavaScript | libs/echarts/echarts.common.js | https://github.com/SuperMap/iClient-JavaScript/blob/master/libs/echarts/echarts.common.js | Apache-2.0 |
removeSelfFromZr: function (zr) {
this.__zr = null;
// 移除动画
var animators = this.animators;
if (animators) {
for (var i = 0; i < animators.length; i++) {
zr.animation.removeAnimator(animators[i]);
}
}
if (this.clipPath) {
this.clipPath.removeSelfFromZr(zr);
}
} | Remove self from zrender instance.
Not recursively because it will be invoked when element added to storage.
@param {module:zrender/ZRender} zr | removeSelfFromZr ( zr ) | javascript | SuperMap/iClient-JavaScript | libs/echarts/echarts.common.js | https://github.com/SuperMap/iClient-JavaScript/blob/master/libs/echarts/echarts.common.js | Apache-2.0 |
function BoundingRect(x, y, width, height) {
if (width < 0) {
x = x + width;
width = -width;
}
if (height < 0) {
y = y + height;
height = -height;
}
/**
* @type {number}
*/
this.x = x;
/**
* @type {number}
*/
this.y = y;
/**
* @type {number}
*/
this.width = width;
/**
* @type {number}
*/
this.height = height;
} | @alias module:echarts/core/BoundingRect | BoundingRect ( x , y , width , height ) | javascript | SuperMap/iClient-JavaScript | libs/echarts/echarts.common.js | https://github.com/SuperMap/iClient-JavaScript/blob/master/libs/echarts/echarts.common.js | Apache-2.0 |
union: function (other) {
var x = mathMin(other.x, this.x);
var y = mathMin(other.y, this.y);
this.width = mathMax(
other.x + other.width,
this.x + this.width
) - x;
this.height = mathMax(
other.y + other.height,
this.y + this.height
) - y;
this.x = x;
this.y = y;
}, | @param {module:echarts/core/BoundingRect} other | union ( other ) | javascript | SuperMap/iClient-JavaScript | libs/echarts/echarts.common.js | https://github.com/SuperMap/iClient-JavaScript/blob/master/libs/echarts/echarts.common.js | Apache-2.0 |
BoundingRect.create = function (rect) {
return new BoundingRect(rect.x, rect.y, rect.width, rect.height);
}; | @param {Object|module:zrender/core/BoundingRect} rect
@param {number} rect.x
@param {number} rect.y
@param {number} rect.width
@param {number} rect.height
@return {module:zrender/core/BoundingRect} | BoundingRect.create ( rect ) | javascript | SuperMap/iClient-JavaScript | libs/echarts/echarts.common.js | https://github.com/SuperMap/iClient-JavaScript/blob/master/libs/echarts/echarts.common.js | Apache-2.0 |
var Group = function (opts) {
opts = opts || {};
Element.call(this, opts);
for (var key in opts) {
if (opts.hasOwnProperty(key)) {
this[key] = opts[key];
}
}
this._children = [];
this.__storage = null;
this.__dirty = true;
}; | @alias module:zrender/graphic/Group
@constructor
@extends module:zrender/mixin/Transformable
@extends module:zrender/mixin/Eventful | Group ( opts ) | javascript | SuperMap/iClient-JavaScript | libs/echarts/echarts.common.js | https://github.com/SuperMap/iClient-JavaScript/blob/master/libs/echarts/echarts.common.js | Apache-2.0 |
children: function () {
return this._children.slice();
}, | @return {Array.<module:zrender/Element>} | children ( ) | javascript | SuperMap/iClient-JavaScript | libs/echarts/echarts.common.js | https://github.com/SuperMap/iClient-JavaScript/blob/master/libs/echarts/echarts.common.js | Apache-2.0 |
childAt: function (idx) {
return this._children[idx];
}, | 获取指定 index 的儿子节点
@param {number} idx
@return {module:zrender/Element} | childAt ( idx ) | javascript | SuperMap/iClient-JavaScript | libs/echarts/echarts.common.js | https://github.com/SuperMap/iClient-JavaScript/blob/master/libs/echarts/echarts.common.js | Apache-2.0 |
childOfName: function (name) {
var children = this._children;
for (var i = 0; i < children.length; i++) {
if (children[i].name === name) {
return children[i];
}
}
}, | 获取指定名字的儿子节点
@param {string} name
@return {module:zrender/Element} | childOfName ( name ) | javascript | SuperMap/iClient-JavaScript | libs/echarts/echarts.common.js | https://github.com/SuperMap/iClient-JavaScript/blob/master/libs/echarts/echarts.common.js | Apache-2.0 |
add: function (child) {
if (child && child !== this && child.parent !== this) {
this._children.push(child);
this._doAdd(child);
}
return this;
}, | 添加子节点到最后
@param {module:zrender/Element} child | add ( child ) | javascript | SuperMap/iClient-JavaScript | libs/echarts/echarts.common.js | https://github.com/SuperMap/iClient-JavaScript/blob/master/libs/echarts/echarts.common.js | Apache-2.0 |
addBefore: function (child, nextSibling) {
if (child && child !== this && child.parent !== this
&& nextSibling && nextSibling.parent === this) {
var children = this._children;
var idx = children.indexOf(nextSibling);
if (idx >= 0) {
children.splice(idx, 0, child);
this._doAdd(child);
}
}
return this;
}, | 添加子节点在 nextSibling 之前
@param {module:zrender/Element} child
@param {module:zrender/Element} nextSibling | addBefore ( child , nextSibling ) | javascript | SuperMap/iClient-JavaScript | libs/echarts/echarts.common.js | https://github.com/SuperMap/iClient-JavaScript/blob/master/libs/echarts/echarts.common.js | Apache-2.0 |
remove: function (child) {
var zr = this.__zr;
var storage = this.__storage;
var children = this._children;
var idx = indexOf(children, child);
if (idx < 0) {
return this;
}
children.splice(idx, 1);
child.parent = null;
if (storage) {
storage.delFromStorage(child);
if (child instanceof Group) {
child.delChildrenFromStorage(storage);
}
}
zr && zr.refresh();
return this;
}, | 移除子节点
@param {module:zrender/Element} child | remove ( child ) | javascript | SuperMap/iClient-JavaScript | libs/echarts/echarts.common.js | https://github.com/SuperMap/iClient-JavaScript/blob/master/libs/echarts/echarts.common.js | Apache-2.0 |
eachChild: function (cb, context) {
var children = this._children;
for (var i = 0; i < children.length; i++) {
var child = children[i];
cb.call(context, child, i);
}
return this;
}, | 遍历所有子节点
@param {Function} cb
@param {} context | eachChild ( cb , context ) | javascript | SuperMap/iClient-JavaScript | libs/echarts/echarts.common.js | https://github.com/SuperMap/iClient-JavaScript/blob/master/libs/echarts/echarts.common.js | Apache-2.0 |
traverse: function (cb, context) {
for (var i = 0; i < this._children.length; i++) {
var child = this._children[i];
cb.call(context, child);
if (child.type === 'group') {
child.traverse(cb, context);
}
}
return this;
}, | 深度优先遍历所有子孙节点
@param {Function} cb
@param {} context | traverse ( cb , context ) | javascript | SuperMap/iClient-JavaScript | libs/echarts/echarts.common.js | https://github.com/SuperMap/iClient-JavaScript/blob/master/libs/echarts/echarts.common.js | Apache-2.0 |
getBoundingRect: function (includeChildren) {
// TODO Caching
var rect = null;
var tmpRect = new BoundingRect(0, 0, 0, 0);
var children = includeChildren || this._children;
var tmpMat = [];
for (var i = 0; i < children.length; i++) {
var child = children[i];
if (child.ignore || child.invisible) {
continue;
}
var childRect = child.getBoundingRect();
var transform = child.getLocalTransform(tmpMat);
// TODO
// The boundingRect cacluated by transforming original
// rect may be bigger than the actual bundingRect when rotation
// is used. (Consider a circle rotated aginst its center, where
// the actual boundingRect should be the same as that not be
// rotated.) But we can not find better approach to calculate
// actual boundingRect yet, considering performance.
if (transform) {
tmpRect.copy(childRect);
tmpRect.applyTransform(transform);
rect = rect || tmpRect.clone();
rect.union(tmpRect);
}
else {
rect = rect || childRect.clone();
rect.union(childRect);
}
}
return rect || tmpRect;
} | @return {module:zrender/core/BoundingRect} | getBoundingRect ( includeChildren ) | javascript | SuperMap/iClient-JavaScript | libs/echarts/echarts.common.js | https://github.com/SuperMap/iClient-JavaScript/blob/master/libs/echarts/echarts.common.js | Apache-2.0 |
var Storage = function () { // jshint ignore:line
this._roots = [];
this._displayList = [];
this._displayListLen = 0;
}; | 内容仓库 (M)
@alias module:zrender/Storage
@constructor | Storage ( ) | javascript | SuperMap/iClient-JavaScript | libs/echarts/echarts.common.js | https://github.com/SuperMap/iClient-JavaScript/blob/master/libs/echarts/echarts.common.js | Apache-2.0 |
getDisplayList: function (update, includeIgnore) {
includeIgnore = includeIgnore || false;
if (update) {
this.updateDisplayList(includeIgnore);
}
return this._displayList;
}, | 返回所有图形的绘制队列
@param {boolean} [update=false] 是否在返回前更新该数组
@param {boolean} [includeIgnore=false] 是否包含 ignore 的数组, 在 update 为 true 的时候有效
详见{@link module:zrender/graphic/Displayable.prototype.updateDisplayList}
@return {Array.<module:zrender/graphic/Displayable>} | getDisplayList ( update , includeIgnore ) | javascript | SuperMap/iClient-JavaScript | libs/echarts/echarts.common.js | https://github.com/SuperMap/iClient-JavaScript/blob/master/libs/echarts/echarts.common.js | Apache-2.0 |
updateDisplayList: function (includeIgnore) {
this._displayListLen = 0;
var roots = this._roots;
var displayList = this._displayList;
for (var i = 0, len = roots.length; i < len; i++) {
this._updateAndAddDisplayable(roots[i], null, includeIgnore);
}
displayList.length = this._displayListLen;
env$1.canvasSupported && sort(displayList, shapeCompareFunc);
}, | 更新图形的绘制队列。
每次绘制前都会调用,该方法会先深度优先遍历整个树,更新所有Group和Shape的变换并且把所有可见的Shape保存到数组中,
最后根据绘制的优先级(zlevel > z > 插入顺序)排序得到绘制队列
@param {boolean} [includeIgnore=false] 是否包含 ignore 的数组 | updateDisplayList ( includeIgnore ) | javascript | SuperMap/iClient-JavaScript | libs/echarts/echarts.common.js | https://github.com/SuperMap/iClient-JavaScript/blob/master/libs/echarts/echarts.common.js | Apache-2.0 |
addRoot: function (el) {
if (el.__storage === this) {
return;
}
if (el instanceof Group) {
el.addChildrenToStorage(this);
}
this.addToStorage(el);
this._roots.push(el);
}, | 添加图形(Shape)或者组(Group)到根节点
@param {module:zrender/Element} el | addRoot ( el ) | javascript | SuperMap/iClient-JavaScript | libs/echarts/echarts.common.js | https://github.com/SuperMap/iClient-JavaScript/blob/master/libs/echarts/echarts.common.js | Apache-2.0 |
delRoot: function (el) {
if (el == null) {
// 不指定el清空
for (var i = 0; i < this._roots.length; i++) {
var root = this._roots[i];
if (root instanceof Group) {
root.delChildrenFromStorage(this);
}
}
this._roots = [];
this._displayList = [];
this._displayListLen = 0;
return;
}
if (el instanceof Array) {
for (var i = 0, l = el.length; i < l; i++) {
this.delRoot(el[i]);
}
return;
}
var idx = indexOf(this._roots, el);
if (idx >= 0) {
this.delFromStorage(el);
this._roots.splice(idx, 1);
if (el instanceof Group) {
el.delChildrenFromStorage(this);
}
}
}, | 删除指定的图形(Shape)或者组(Group)
@param {string|Array.<string>} [el] 如果为空清空整个Storage | delRoot ( el ) | javascript | SuperMap/iClient-JavaScript | libs/echarts/echarts.common.js | https://github.com/SuperMap/iClient-JavaScript/blob/master/libs/echarts/echarts.common.js | Apache-2.0 |
function returnFalse() {
return false;
} | @module zrender/Layer
@author pissang(https://www.github.com/pissang) | returnFalse ( ) | javascript | SuperMap/iClient-JavaScript | libs/echarts/echarts.common.js | https://github.com/SuperMap/iClient-JavaScript/blob/master/libs/echarts/echarts.common.js | Apache-2.0 |
function createDom(id, painter, dpr) {
var newDom = createCanvas();
var width = painter.getWidth();
var height = painter.getHeight();
var newDomStyle = newDom.style;
if (newDomStyle) { // In node or some other non-browser environment
newDomStyle.position = 'absolute';
newDomStyle.left = 0;
newDomStyle.top = 0;
newDomStyle.width = width + 'px';
newDomStyle.height = height + 'px';
newDom.setAttribute('data-zr-dom-id', id);
}
newDom.width = width * dpr;
newDom.height = height * dpr;
return newDom;
} | 创建dom
@inner
@param {string} id dom id 待用
@param {Painter} painter painter instance
@param {number} number | createDom ( id , painter , dpr ) | javascript | SuperMap/iClient-JavaScript | libs/echarts/echarts.common.js | https://github.com/SuperMap/iClient-JavaScript/blob/master/libs/echarts/echarts.common.js | Apache-2.0 |
var Layer = function (id, painter, dpr) {
var dom;
dpr = dpr || devicePixelRatio;
if (typeof id === 'string') {
dom = createDom(id, painter, dpr);
}
// Not using isDom because in node it will return false
else if (isObject$1(id)) {
dom = id;
id = dom.id;
}
this.id = id;
this.dom = dom;
var domStyle = dom.style;
if (domStyle) { // Not in node
dom.onselectstart = returnFalse; // 避免页面选中的尴尬
domStyle['-webkit-user-select'] = 'none';
domStyle['user-select'] = 'none';
domStyle['-webkit-touch-callout'] = 'none';
domStyle['-webkit-tap-highlight-color'] = 'rgba(0,0,0,0)';
domStyle['padding'] = 0; // eslint-disable-line dot-notation
domStyle['margin'] = 0; // eslint-disable-line dot-notation
domStyle['border-width'] = 0;
}
this.domBack = null;
this.ctxBack = null;
this.painter = painter;
this.config = null;
// Configs
/**
* 每次清空画布的颜色
* @type {string}
* @default 0
*/
this.clearColor = 0;
/**
* 是否开启动态模糊
* @type {boolean}
* @default false
*/
this.motionBlur = false;
/**
* 在开启动态模糊的时候使用,与上一帧混合的alpha值,值越大尾迹越明显
* @type {number}
* @default 0.7
*/
this.lastFrameAlpha = 0.7;
/**
* Layer dpr
* @type {number}
*/
this.dpr = dpr;
}; | @alias module:zrender/Layer
@constructor
@extends module:zrender/mixin/Transformable
@param {string} id
@param {module:zrender/Painter} painter
@param {number} [dpr] | Layer ( id , painter , dpr ) | javascript | SuperMap/iClient-JavaScript | libs/echarts/echarts.common.js | https://github.com/SuperMap/iClient-JavaScript/blob/master/libs/echarts/echarts.common.js | Apache-2.0 |
resize: function (width, height) {
var dpr = this.dpr;
var dom = this.dom;
var domStyle = dom.style;
var domBack = this.domBack;
if (domStyle) {
domStyle.width = width + 'px';
domStyle.height = height + 'px';
}
dom.width = width * dpr;
dom.height = height * dpr;
if (domBack) {
domBack.width = width * dpr;
domBack.height = height * dpr;
if (dpr !== 1) {
this.ctxBack.scale(dpr, dpr);
}
}
}, | @param {number} width
@param {number} height | resize ( width , height ) | javascript | SuperMap/iClient-JavaScript | libs/echarts/echarts.common.js | https://github.com/SuperMap/iClient-JavaScript/blob/master/libs/echarts/echarts.common.js | Apache-2.0 |
clear: function (clearAll, clearColor) {
var dom = this.dom;
var ctx = this.ctx;
var width = dom.width;
var height = dom.height;
var clearColor = clearColor || this.clearColor;
var haveMotionBLur = this.motionBlur && !clearAll;
var lastFrameAlpha = this.lastFrameAlpha;
var dpr = this.dpr;
if (haveMotionBLur) {
if (!this.domBack) {
this.createBackBuffer();
}
this.ctxBack.globalCompositeOperation = 'copy';
this.ctxBack.drawImage(
dom, 0, 0,
width / dpr,
height / dpr
);
}
ctx.clearRect(0, 0, width, height);
if (clearColor && clearColor !== 'transparent') {
var clearColorGradientOrPattern;
// Gradient
if (clearColor.colorStops) {
// Cache canvas gradient
clearColorGradientOrPattern = clearColor.__canvasGradient || Style.getGradient(ctx, clearColor, {
x: 0,
y: 0,
width: width,
height: height
});
clearColor.__canvasGradient = clearColorGradientOrPattern;
}
// Pattern
else if (clearColor.image) {
clearColorGradientOrPattern = Pattern.prototype.getCanvasPattern.call(clearColor, ctx);
}
ctx.save();
ctx.fillStyle = clearColorGradientOrPattern || clearColor;
ctx.fillRect(0, 0, width, height);
ctx.restore();
}
if (haveMotionBLur) {
var domBack = this.domBack;
ctx.save();
ctx.globalAlpha = lastFrameAlpha;
ctx.drawImage(domBack, 0, 0, width, height);
ctx.restore();
}
} | 清空该层画布
@param {boolean} [clearAll]=false Clear all with out motion blur
@param {Color} [clearColor] | clear ( clearAll , clearColor ) | javascript | SuperMap/iClient-JavaScript | libs/echarts/echarts.common.js | https://github.com/SuperMap/iClient-JavaScript/blob/master/libs/echarts/echarts.common.js | Apache-2.0 |
function findExistImage(newImageOrSrc) {
if (typeof newImageOrSrc === 'string') {
var cachedImgObj = globalImageCache.get(newImageOrSrc);
return cachedImgObj && cachedImgObj.image;
}
else {
return newImageOrSrc;
}
} | @param {string|HTMLImageElement|HTMLCanvasElement|Canvas} newImageOrSrc
@return {HTMLImageElement|HTMLCanvasElement|Canvas} image | findExistImage ( newImageOrSrc ) | javascript | SuperMap/iClient-JavaScript | libs/echarts/echarts.common.js | https://github.com/SuperMap/iClient-JavaScript/blob/master/libs/echarts/echarts.common.js | Apache-2.0 |
function createOrUpdateImage(newImageOrSrc, image, hostEl, cb, cbPayload) {
if (!newImageOrSrc) {
return image;
}
else if (typeof newImageOrSrc === 'string') {
// Image should not be loaded repeatly.
if ((image && image.__zrImageSrc === newImageOrSrc) || !hostEl) {
return image;
}
// Only when there is no existent image or existent image src
// is different, this method is responsible for load.
var cachedImgObj = globalImageCache.get(newImageOrSrc);
var pendingWrap = {hostEl: hostEl, cb: cb, cbPayload: cbPayload};
if (cachedImgObj) {
image = cachedImgObj.image;
!isImageReady(image) && cachedImgObj.pending.push(pendingWrap);
}
else {
image = new Image();
image.onload = image.onerror = imageOnLoad;
globalImageCache.put(
newImageOrSrc,
image.__cachedImgObj = {
image: image,
pending: [pendingWrap]
}
);
image.src = image.__zrImageSrc = newImageOrSrc;
}
return image;
}
// newImageOrSrc is an HTMLImageElement or HTMLCanvasElement or Canvas
else {
return newImageOrSrc;
}
} | Caution: User should cache loaded images, but not just count on LRU.
Consider if required images more than LRU size, will dead loop occur?
@param {string|HTMLImageElement|HTMLCanvasElement|Canvas} newImageOrSrc
@param {HTMLImageElement|HTMLCanvasElement|Canvas} image Existent image.
@param {module:zrender/Element} [hostEl] For calling `dirty`.
@param {Function} [cb] params: (image, cbPayload)
@param {Object} [cbPayload] Payload on cb calling.
@return {HTMLImageElement|HTMLCanvasElement|Canvas} image | createOrUpdateImage ( newImageOrSrc , image , hostEl , cb , cbPayload ) | javascript | SuperMap/iClient-JavaScript | libs/echarts/echarts.common.js | https://github.com/SuperMap/iClient-JavaScript/blob/master/libs/echarts/echarts.common.js | Apache-2.0 |
function getWidth(text, font) {
font = font || DEFAULT_FONT$1;
var key = text + ':' + font;
if (textWidthCache[key]) {
return textWidthCache[key];
}
var textLines = (text + '').split('\n');
var width = 0;
for (var i = 0, l = textLines.length; i < l; i++) {
// textContain.measureText may be overrided in SVG or VML
width = Math.max(measureText(textLines[i], font).width, width);
}
if (textWidthCacheCounter > TEXT_CACHE_MAX) {
textWidthCacheCounter = 0;
textWidthCache = {};
}
textWidthCacheCounter++;
textWidthCache[key] = width;
return width;
} | @public
@param {string} text
@param {string} font
@return {number} width | getWidth ( text , font ) | javascript | SuperMap/iClient-JavaScript | libs/echarts/echarts.common.js | https://github.com/SuperMap/iClient-JavaScript/blob/master/libs/echarts/echarts.common.js | Apache-2.0 |
function getBoundingRect(text, font, textAlign, textVerticalAlign, textPadding, textLineHeight, rich, truncate) {
return rich
? getRichTextRect(text, font, textAlign, textVerticalAlign, textPadding, textLineHeight, rich, truncate)
: getPlainTextRect(text, font, textAlign, textVerticalAlign, textPadding, textLineHeight, truncate);
} | @public
@param {string} text
@param {string} font
@param {string} [textAlign='left']
@param {string} [textVerticalAlign='top']
@param {Array.<number>} [textPadding]
@param {Object} [rich]
@param {Object} [truncate]
@return {Object} {x, y, width, height, lineHeight} | getBoundingRect ( text , font , textAlign , textVerticalAlign , textPadding , textLineHeight , rich , truncate ) | javascript | SuperMap/iClient-JavaScript | libs/echarts/echarts.common.js | https://github.com/SuperMap/iClient-JavaScript/blob/master/libs/echarts/echarts.common.js | Apache-2.0 |
function adjustTextX(x, width, textAlign) {
// FIXME Right to left language
if (textAlign === 'right') {
x -= width;
}
else if (textAlign === 'center') {
x -= width / 2;
}
return x;
} | @public
@param {number} x
@param {number} width
@param {string} [textAlign='left']
@return {number} Adjusted x. | adjustTextX ( x , width , textAlign ) | javascript | SuperMap/iClient-JavaScript | libs/echarts/echarts.common.js | https://github.com/SuperMap/iClient-JavaScript/blob/master/libs/echarts/echarts.common.js | Apache-2.0 |
function adjustTextY(y, height, textVerticalAlign) {
if (textVerticalAlign === 'middle') {
y -= height / 2;
}
else if (textVerticalAlign === 'bottom') {
y -= height;
}
return y;
} | @public
@param {number} y
@param {number} height
@param {string} [textVerticalAlign='top']
@return {number} Adjusted y. | adjustTextY ( y , height , textVerticalAlign ) | javascript | SuperMap/iClient-JavaScript | libs/echarts/echarts.common.js | https://github.com/SuperMap/iClient-JavaScript/blob/master/libs/echarts/echarts.common.js | Apache-2.0 |
function calculateTextPosition(out, style, rect) {
var textPosition = style.textPosition;
var distance = style.textDistance;
var x = rect.x;
var y = rect.y;
distance = distance || 0;
var height = rect.height;
var width = rect.width;
var halfHeight = height / 2;
var textAlign = 'left';
var textVerticalAlign = 'top';
switch (textPosition) {
case 'left':
x -= distance;
y += halfHeight;
textAlign = 'right';
textVerticalAlign = 'middle';
break;
case 'right':
x += distance + width;
y += halfHeight;
textVerticalAlign = 'middle';
break;
case 'top':
x += width / 2;
y -= distance;
textAlign = 'center';
textVerticalAlign = 'bottom';
break;
case 'bottom':
x += width / 2;
y += height + distance;
textAlign = 'center';
break;
case 'inside':
x += width / 2;
y += halfHeight;
textAlign = 'center';
textVerticalAlign = 'middle';
break;
case 'insideLeft':
x += distance;
y += halfHeight;
textVerticalAlign = 'middle';
break;
case 'insideRight':
x += width - distance;
y += halfHeight;
textAlign = 'right';
textVerticalAlign = 'middle';
break;
case 'insideTop':
x += width / 2;
y += distance;
textAlign = 'center';
break;
case 'insideBottom':
x += width / 2;
y += height - distance;
textAlign = 'center';
textVerticalAlign = 'bottom';
break;
case 'insideTopLeft':
x += distance;
y += distance;
break;
case 'insideTopRight':
x += width - distance;
y += distance;
textAlign = 'right';
break;
case 'insideBottomLeft':
x += distance;
y += height - distance;
textVerticalAlign = 'bottom';
break;
case 'insideBottomRight':
x += width - distance;
y += height - distance;
textAlign = 'right';
textVerticalAlign = 'bottom';
break;
}
out = out || {};
out.x = x;
out.y = y;
out.textAlign = textAlign;
out.textVerticalAlign = textVerticalAlign;
return out;
} | Follow same interface to `Displayable.prototype.calculateTextPosition`.
@public
@param {Obejct} [out] Prepared out object. If not input, auto created in the method.
@param {module:zrender/graphic/Style} style where `textPosition` and `textDistance` are visited.
@param {Object} rect {x, y, width, height} Rect of the host elment, according to which the text positioned.
@return {Object} The input `out`. Set: {x, y, textAlign, textVerticalAlign} | calculateTextPosition ( out , style , rect ) | javascript | SuperMap/iClient-JavaScript | libs/echarts/echarts.common.js | https://github.com/SuperMap/iClient-JavaScript/blob/master/libs/echarts/echarts.common.js | Apache-2.0 |
function truncateText(text, containerWidth, font, ellipsis, options) {
if (!containerWidth) {
return '';
}
var textLines = (text + '').split('\n');
options = prepareTruncateOptions(containerWidth, font, ellipsis, options);
// FIXME
// It is not appropriate that every line has '...' when truncate multiple lines.
for (var i = 0, len = textLines.length; i < len; i++) {
textLines[i] = truncateSingleLine(textLines[i], options);
}
return textLines.join('\n');
} | Show ellipsis if overflow.
@public
@param {string} text
@param {string} containerWidth
@param {string} font
@param {number} [ellipsis='...']
@param {Object} [options]
@param {number} [options.maxIterations=3]
@param {number} [options.minChar=0] If truncate result are less
then minChar, ellipsis will not show, which is
better for user hint in some cases.
@param {number} [options.placeholder=''] When all truncated, use the placeholder.
@return {string} | truncateText ( text , containerWidth , font , ellipsis , options ) | javascript | SuperMap/iClient-JavaScript | libs/echarts/echarts.common.js | https://github.com/SuperMap/iClient-JavaScript/blob/master/libs/echarts/echarts.common.js | Apache-2.0 |
function getLineHeight(font) {
// FIXME A rough approach.
return getWidth('国', font);
} | @public
@param {string} font
@return {number} line height | getLineHeight ( font ) | javascript | SuperMap/iClient-JavaScript | libs/echarts/echarts.common.js | https://github.com/SuperMap/iClient-JavaScript/blob/master/libs/echarts/echarts.common.js | Apache-2.0 |
function measureText(text, font) {
return methods$1.measureText(text, font);
} | @public
@param {string} text
@param {string} font
@return {Object} width | measureText ( text , font ) | javascript | SuperMap/iClient-JavaScript | libs/echarts/echarts.common.js | https://github.com/SuperMap/iClient-JavaScript/blob/master/libs/echarts/echarts.common.js | Apache-2.0 |
function parseRichText(text, style) {
var contentBlock = {lines: [], width: 0, height: 0};
text != null && (text += '');
if (!text) {
return contentBlock;
}
var lastIndex = STYLE_REG.lastIndex = 0;
var result;
while ((result = STYLE_REG.exec(text)) != null) {
var matchedIndex = result.index;
if (matchedIndex > lastIndex) {
pushTokens(contentBlock, text.substring(lastIndex, matchedIndex));
}
pushTokens(contentBlock, result[2], result[1]);
lastIndex = STYLE_REG.lastIndex;
}
if (lastIndex < text.length) {
pushTokens(contentBlock, text.substring(lastIndex, text.length));
}
var lines = contentBlock.lines;
var contentHeight = 0;
var contentWidth = 0;
// For `textWidth: 100%`
var pendingList = [];
var stlPadding = style.textPadding;
var truncate = style.truncate;
var truncateWidth = truncate && truncate.outerWidth;
var truncateHeight = truncate && truncate.outerHeight;
if (stlPadding) {
truncateWidth != null && (truncateWidth -= stlPadding[1] + stlPadding[3]);
truncateHeight != null && (truncateHeight -= stlPadding[0] + stlPadding[2]);
}
// Calculate layout info of tokens.
for (var i = 0; i < lines.length; i++) {
var line = lines[i];
var lineHeight = 0;
var lineWidth = 0;
for (var j = 0; j < line.tokens.length; j++) {
var token = line.tokens[j];
var tokenStyle = token.styleName && style.rich[token.styleName] || {};
// textPadding should not inherit from style.
var textPadding = token.textPadding = tokenStyle.textPadding;
// textFont has been asigned to font by `normalizeStyle`.
var font = token.font = tokenStyle.font || style.font;
// textHeight can be used when textVerticalAlign is specified in token.
var tokenHeight = token.textHeight = retrieve2(
// textHeight should not be inherited, consider it can be specified
// as box height of the block.
tokenStyle.textHeight, getLineHeight(font)
);
textPadding && (tokenHeight += textPadding[0] + textPadding[2]);
token.height = tokenHeight;
token.lineHeight = retrieve3(
tokenStyle.textLineHeight, style.textLineHeight, tokenHeight
);
token.textAlign = tokenStyle && tokenStyle.textAlign || style.textAlign;
token.textVerticalAlign = tokenStyle && tokenStyle.textVerticalAlign || 'middle';
if (truncateHeight != null && contentHeight + token.lineHeight > truncateHeight) {
return {lines: [], width: 0, height: 0};
}
token.textWidth = getWidth(token.text, font);
var tokenWidth = tokenStyle.textWidth;
var tokenWidthNotSpecified = tokenWidth == null || tokenWidth === 'auto';
// Percent width, can be `100%`, can be used in drawing separate
// line when box width is needed to be auto.
if (typeof tokenWidth === 'string' && tokenWidth.charAt(tokenWidth.length - 1) === '%') {
token.percentWidth = tokenWidth;
pendingList.push(token);
tokenWidth = 0;
// Do not truncate in this case, because there is no user case
// and it is too complicated.
}
else {
if (tokenWidthNotSpecified) {
tokenWidth = token.textWidth;
// FIXME: If image is not loaded and textWidth is not specified, calling
// `getBoundingRect()` will not get correct result.
var textBackgroundColor = tokenStyle.textBackgroundColor;
var bgImg = textBackgroundColor && textBackgroundColor.image;
// Use cases:
// (1) If image is not loaded, it will be loaded at render phase and call
// `dirty()` and `textBackgroundColor.image` will be replaced with the loaded
// image, and then the right size will be calculated here at the next tick.
// See `graphic/helper/text.js`.
// (2) If image loaded, and `textBackgroundColor.image` is image src string,
// use `imageHelper.findExistImage` to find cached image.
// `imageHelper.findExistImage` will always be called here before
// `imageHelper.createOrUpdateImage` in `graphic/helper/text.js#renderRichText`
// which ensures that image will not be rendered before correct size calcualted.
if (bgImg) {
bgImg = findExistImage(bgImg);
if (isImageReady(bgImg)) {
tokenWidth = Math.max(tokenWidth, bgImg.width * tokenHeight / bgImg.height);
}
}
}
var paddingW = textPadding ? textPadding[1] + textPadding[3] : 0;
tokenWidth += paddingW;
var remianTruncWidth = truncateWidth != null ? truncateWidth - lineWidth : null;
if (remianTruncWidth != null && remianTruncWidth < tokenWidth) {
if (!tokenWidthNotSpecified || remianTruncWidth < paddingW) {
token.text = '';
token.textWidth = tokenWidth = 0;
}
else {
token.text = truncateText(
token.text, remianTruncWidth - paddingW, font, truncate.ellipsis,
{minChar: truncate.minChar}
);
token.textWidth = getWidth(token.text, font);
tokenWidth = token.textWidth + paddingW;
}
}
}
lineWidth += (token.width = tokenWidth);
tokenStyle && (lineHeight = Math.max(lineHeight, token.lineHeight));
}
line.width = lineWidth;
line.lineHeight = lineHeight;
contentHeight += lineHeight;
contentWidth = Math.max(contentWidth, lineWidth);
}
contentBlock.outerWidth = contentBlock.width = retrieve2(style.textWidth, contentWidth);
contentBlock.outerHeight = contentBlock.height = retrieve2(style.textHeight, contentHeight);
if (stlPadding) {
contentBlock.outerWidth += stlPadding[1] + stlPadding[3];
contentBlock.outerHeight += stlPadding[0] + stlPadding[2];
}
for (var i = 0; i < pendingList.length; i++) {
var token = pendingList[i];
var percentWidth = token.percentWidth;
// Should not base on outerWidth, because token can not be placed out of padding.
token.width = parseInt(percentWidth, 10) / 100 * contentWidth;
}
return contentBlock;
} | For example: 'some text {a|some text}other text{b|some text}xxx{c|}xxx'
Also consider 'bbbb{a|xxx\nzzz}xxxx\naaaa'.
@public
@param {string} text
@param {Object} style
@return {Object} block
{
width,
height,
lines: [{
lineHeight,
width,
tokens: [[{
styleName,
text,
width, // include textPadding
height, // include textPadding
textWidth, // pure text width
textHeight, // pure text height
lineHeihgt,
font,
textAlign,
textVerticalAlign
}], [...], ...]
}, ...]
}
If styleName is undefined, it is plain text. | parseRichText ( text , style ) | javascript | SuperMap/iClient-JavaScript | libs/echarts/echarts.common.js | https://github.com/SuperMap/iClient-JavaScript/blob/master/libs/echarts/echarts.common.js | Apache-2.0 |
function buildPath(ctx, shape) {
var x = shape.x;
var y = shape.y;
var width = shape.width;
var height = shape.height;
var r = shape.r;
var r1;
var r2;
var r3;
var r4;
// Convert width and height to positive for better borderRadius
if (width < 0) {
x = x + width;
width = -width;
}
if (height < 0) {
y = y + height;
height = -height;
}
if (typeof r === 'number') {
r1 = r2 = r3 = r4 = r;
}
else if (r instanceof Array) {
if (r.length === 1) {
r1 = r2 = r3 = r4 = r[0];
}
else if (r.length === 2) {
r1 = r3 = r[0];
r2 = r4 = r[1];
}
else if (r.length === 3) {
r1 = r[0];
r2 = r4 = r[1];
r3 = r[2];
}
else {
r1 = r[0];
r2 = r[1];
r3 = r[2];
r4 = r[3];
}
}
else {
r1 = r2 = r3 = r4 = 0;
}
var total;
if (r1 + r2 > width) {
total = r1 + r2;
r1 *= width / total;
r2 *= width / total;
}
if (r3 + r4 > width) {
total = r3 + r4;
r3 *= width / total;
r4 *= width / total;
}
if (r2 + r3 > height) {
total = r2 + r3;
r2 *= height / total;
r3 *= height / total;
}
if (r1 + r4 > height) {
total = r1 + r4;
r1 *= height / total;
r4 *= height / total;
}
ctx.moveTo(x + r1, y);
ctx.lineTo(x + width - r2, y);
r2 !== 0 && ctx.arc(x + width - r2, y + r2, r2, -Math.PI / 2, 0);
ctx.lineTo(x + width, y + height - r3);
r3 !== 0 && ctx.arc(x + width - r3, y + height - r3, r3, 0, Math.PI / 2);
ctx.lineTo(x + r4, y + height);
r4 !== 0 && ctx.arc(x + r4, y + height - r4, r4, Math.PI / 2, Math.PI);
ctx.lineTo(x, y + r1);
r1 !== 0 && ctx.arc(x + r1, y + r1, r1, Math.PI, Math.PI * 1.5);
} | @param {Object} ctx
@param {Object} shape
@param {number} shape.x
@param {number} shape.y
@param {number} shape.width
@param {number} shape.height
@param {number} shape.r | buildPath ( ctx , shape ) | javascript | SuperMap/iClient-JavaScript | libs/echarts/echarts.common.js | https://github.com/SuperMap/iClient-JavaScript/blob/master/libs/echarts/echarts.common.js | Apache-2.0 |
function normalizeTextStyle(style) {
normalizeStyle(style);
each$1(style.rich, normalizeStyle);
return style;
} | @param {module:zrender/graphic/Style} style
@return {module:zrender/graphic/Style} The input style. | normalizeTextStyle ( style ) | javascript | SuperMap/iClient-JavaScript | libs/echarts/echarts.common.js | https://github.com/SuperMap/iClient-JavaScript/blob/master/libs/echarts/echarts.common.js | Apache-2.0 |
function renderText(hostEl, ctx, text, style, rect, prevEl) {
style.rich
? renderRichText(hostEl, ctx, text, style, rect, prevEl)
: renderPlainText(hostEl, ctx, text, style, rect, prevEl);
} | @param {CanvasRenderingContext2D} ctx
@param {string} text
@param {module:zrender/graphic/Style} style
@param {Object|boolean} [rect] {x, y, width, height}
If set false, rect text is not used.
@param {Element|module:zrender/graphic/helper/constant.WILL_BE_RESTORED} [prevEl] For ctx prop cache. | renderText ( hostEl , ctx , text , style , rect , prevEl ) | javascript | SuperMap/iClient-JavaScript | libs/echarts/echarts.common.js | https://github.com/SuperMap/iClient-JavaScript/blob/master/libs/echarts/echarts.common.js | Apache-2.0 |
function getStroke(stroke, lineWidth) {
return (stroke == null || lineWidth <= 0 || stroke === 'transparent' || stroke === 'none')
? null
// TODO pattern and gradient?
: (stroke.image || stroke.colorStops)
? '#000'
: stroke;
} | @param {string} [stroke] If specified, do not check style.textStroke.
@param {string} [lineWidth] If specified, do not check style.textStroke.
@param {number} style | getStroke ( stroke , lineWidth ) | javascript | SuperMap/iClient-JavaScript | libs/echarts/echarts.common.js | https://github.com/SuperMap/iClient-JavaScript/blob/master/libs/echarts/echarts.common.js | Apache-2.0 |
function needDrawText(text, style) {
return text != null
&& (text
|| style.textBackgroundColor
|| (style.textBorderWidth && style.textBorderColor)
|| style.textPadding
);
} | @param {string} text
@param {module:zrender/Style} style
@return {boolean} | needDrawText ( text , style ) | javascript | SuperMap/iClient-JavaScript | libs/echarts/echarts.common.js | https://github.com/SuperMap/iClient-JavaScript/blob/master/libs/echarts/echarts.common.js | Apache-2.0 |
drawRectText: function (ctx, rect) {
var style = this.style;
rect = style.textRect || rect;
// Optimize, avoid normalize every time.
this.__dirty && normalizeTextStyle(style, true);
var text = style.text;
// Convert to string
text != null && (text += '');
if (!needDrawText(text, style)) {
return;
}
// FIXME
// Do not provide prevEl to `textHelper.renderText` for ctx prop cache,
// but use `ctx.save()` and `ctx.restore()`. Because the cache for rect
// text propably break the cache for its host elements.
ctx.save();
// Transform rect to view space
var transform = this.transform;
if (!style.transformText) {
if (transform) {
tmpRect$1.copy(rect);
tmpRect$1.applyTransform(transform);
rect = tmpRect$1;
}
}
else {
this.setTransform(ctx);
}
// transformText and textRotation can not be used at the same time.
renderText(this, ctx, text, style, rect, WILL_BE_RESTORED);
ctx.restore();
} | Draw text in a rect with specified position.
@param {CanvasRenderingContext2D} ctx
@param {Object} rect Displayable rect | drawRectText ( ctx , rect ) | javascript | SuperMap/iClient-JavaScript | libs/echarts/echarts.common.js | https://github.com/SuperMap/iClient-JavaScript/blob/master/libs/echarts/echarts.common.js | Apache-2.0 |
function Displayable(opts) {
opts = opts || {};
Element.call(this, opts);
// Extend properties
for (var name in opts) {
if (
opts.hasOwnProperty(name)
&& name !== 'style'
) {
this[name] = opts[name];
}
}
/**
* @type {module:zrender/graphic/Style}
*/
this.style = new Style(opts.style, this);
this._rect = null;
// Shapes for cascade clipping.
// Can only be `null`/`undefined` or an non-empty array, MUST NOT be an empty array.
// because it is easy to only using null to check whether clipPaths changed.
this.__clipPaths = null;
// FIXME Stateful must be mixined after style is setted
// Stateful.call(this, opts);
} | @alias module:zrender/graphic/Displayable
@extends module:zrender/Element
@extends module:zrender/graphic/mixin/RectText | Displayable ( opts ) | javascript | SuperMap/iClient-JavaScript | libs/echarts/echarts.common.js | https://github.com/SuperMap/iClient-JavaScript/blob/master/libs/echarts/echarts.common.js | Apache-2.0 |
contain: function (x, y) {
return this.rectContain(x, y);
}, | If displayable element contain coord x, y
@param {number} x
@param {number} y
@return {boolean} | contain ( x , y ) | javascript | SuperMap/iClient-JavaScript | libs/echarts/echarts.common.js | https://github.com/SuperMap/iClient-JavaScript/blob/master/libs/echarts/echarts.common.js | Apache-2.0 |
rectContain: function (x, y) {
var coord = this.transformCoordToLocal(x, y);
var rect = this.getBoundingRect();
return rect.contain(coord[0], coord[1]);
}, | If bounding rect of element contain coord x, y
@param {number} x
@param {number} y
@return {boolean} | rectContain ( x , y ) | javascript | SuperMap/iClient-JavaScript | libs/echarts/echarts.common.js | https://github.com/SuperMap/iClient-JavaScript/blob/master/libs/echarts/echarts.common.js | Apache-2.0 |
dirty: function () {
this.__dirty = this.__dirtyText = true;
this._rect = null;
this.__zr && this.__zr.refresh();
}, | Mark displayable element dirty and refresh next frame | dirty ( ) | javascript | SuperMap/iClient-JavaScript | libs/echarts/echarts.common.js | https://github.com/SuperMap/iClient-JavaScript/blob/master/libs/echarts/echarts.common.js | Apache-2.0 |
animateStyle: function (loop) {
return this.animate('style', loop);
}, | Alias for animate('style')
@param {boolean} loop | animateStyle ( loop ) | javascript | SuperMap/iClient-JavaScript | libs/echarts/echarts.common.js | https://github.com/SuperMap/iClient-JavaScript/blob/master/libs/echarts/echarts.common.js | Apache-2.0 |
setStyle: function (key, value) {
this.style.set(key, value);
this.dirty(false);
return this;
}, | @param {Object|string} key
@param {*} value | setStyle ( key , value ) | javascript | SuperMap/iClient-JavaScript | libs/echarts/echarts.common.js | https://github.com/SuperMap/iClient-JavaScript/blob/master/libs/echarts/echarts.common.js | Apache-2.0 |
useStyle: function (obj) {
this.style = new Style(obj, this);
this.dirty(false);
return this;
}, | Use given style object
@param {Object} obj | useStyle ( obj ) | javascript | SuperMap/iClient-JavaScript | libs/echarts/echarts.common.js | https://github.com/SuperMap/iClient-JavaScript/blob/master/libs/echarts/echarts.common.js | Apache-2.0 |
function ZImage(opts) {
Displayable.call(this, opts);
} | @alias zrender/graphic/Image
@extends module:zrender/graphic/Displayable
@constructor
@param {Object} opts | ZImage ( opts ) | javascript | SuperMap/iClient-JavaScript | libs/echarts/echarts.common.js | https://github.com/SuperMap/iClient-JavaScript/blob/master/libs/echarts/echarts.common.js | Apache-2.0 |
var Painter = function (root, storage, opts) {
this.type = 'canvas';
// In node environment using node-canvas
var singleCanvas = !root.nodeName // In node ?
|| root.nodeName.toUpperCase() === 'CANVAS';
this._opts = opts = extend({}, opts || {});
/**
* @type {number}
*/
this.dpr = opts.devicePixelRatio || devicePixelRatio;
/**
* @type {boolean}
* @private
*/
this._singleCanvas = singleCanvas;
/**
* 绘图容器
* @type {HTMLElement}
*/
this.root = root;
var rootStyle = root.style;
if (rootStyle) {
rootStyle['-webkit-tap-highlight-color'] = 'transparent';
rootStyle['-webkit-user-select'] =
rootStyle['user-select'] =
rootStyle['-webkit-touch-callout'] = 'none';
root.innerHTML = '';
}
/**
* @type {module:zrender/Storage}
*/
this.storage = storage;
/**
* @type {Array.<number>}
* @private
*/
var zlevelList = this._zlevelList = [];
/**
* @type {Object.<string, module:zrender/Layer>}
* @private
*/
var layers = this._layers = {};
/**
* @type {Object.<string, Object>}
* @private
*/
this._layerConfig = {};
/**
* zrender will do compositing when root is a canvas and have multiple zlevels.
*/
this._needsManuallyCompositing = false;
if (!singleCanvas) {
this._width = this._getSize(0);
this._height = this._getSize(1);
var domRoot = this._domRoot = createRoot(
this._width, this._height
);
root.appendChild(domRoot);
}
else {
var width = root.width;
var height = root.height;
if (opts.width != null) {
width = opts.width;
}
if (opts.height != null) {
height = opts.height;
}
this.dpr = opts.devicePixelRatio || 1;
// Use canvas width and height directly
root.width = width * this.dpr;
root.height = height * this.dpr;
this._width = width;
this._height = height;
// Create layer if only one given canvas
// Device can be specified to create a high dpi image.
var mainLayer = new Layer(root, this, this.dpr);
mainLayer.__builtin__ = true;
mainLayer.initContext();
// FIXME Use canvas width and height
// mainLayer.resize(width, height);
layers[CANVAS_ZLEVEL] = mainLayer;
mainLayer.zlevel = CANVAS_ZLEVEL;
// Not use common zlevel.
zlevelList.push(CANVAS_ZLEVEL);
this._domRoot = root;
}
/**
* @type {module:zrender/Layer}
* @private
*/
this._hoverlayer = null;
this._hoverElements = [];
}; | @alias module:zrender/Painter
@constructor
@param {HTMLElement} root 绘图容器
@param {module:zrender/Storage} storage
@param {Object} opts | Painter ( root , storage , opts ) | javascript | SuperMap/iClient-JavaScript | libs/echarts/echarts.common.js | https://github.com/SuperMap/iClient-JavaScript/blob/master/libs/echarts/echarts.common.js | Apache-2.0 |
isSingleCanvas: function () {
return this._singleCanvas;
}, | If painter use a single canvas
@return {boolean} | isSingleCanvas ( ) | javascript | SuperMap/iClient-JavaScript | libs/echarts/echarts.common.js | https://github.com/SuperMap/iClient-JavaScript/blob/master/libs/echarts/echarts.common.js | Apache-2.0 |
refresh: function (paintAll) {
var list = this.storage.getDisplayList(true);
var zlevelList = this._zlevelList;
this._redrawId = Math.random();
this._paintList(list, paintAll, this._redrawId);
// Paint custum layers
for (var i = 0; i < zlevelList.length; i++) {
var z = zlevelList[i];
var layer = this._layers[z];
if (!layer.__builtin__ && layer.refresh) {
var clearColor = i === 0 ? this._backgroundColor : null;
layer.refresh(clearColor);
}
}
this.refreshHover();
return this;
}, | 刷新
@param {boolean} [paintAll=false] 强制绘制所有displayable | refresh ( paintAll ) | javascript | SuperMap/iClient-JavaScript | libs/echarts/echarts.common.js | https://github.com/SuperMap/iClient-JavaScript/blob/master/libs/echarts/echarts.common.js | Apache-2.0 |
getLayer: function (zlevel, virtual) {
if (this._singleCanvas && !this._needsManuallyCompositing) {
zlevel = CANVAS_ZLEVEL;
}
var layer = this._layers[zlevel];
if (!layer) {
// Create a new layer
layer = new Layer('zr_' + zlevel, this, this.dpr);
layer.zlevel = zlevel;
layer.__builtin__ = true;
if (this._layerConfig[zlevel]) {
merge(layer, this._layerConfig[zlevel], true);
}
// TODO Remove EL_AFTER_INCREMENTAL_INC magic number
else if (this._layerConfig[zlevel - EL_AFTER_INCREMENTAL_INC]) {
merge(layer, this._layerConfig[zlevel - EL_AFTER_INCREMENTAL_INC], true);
}
if (virtual) {
layer.virtual = virtual;
}
this.insertLayer(zlevel, layer);
// Context is created after dom inserted to document
// Or excanvas will get 0px clientWidth and clientHeight
layer.initContext();
}
return layer;
}, | 获取 zlevel 所在层,如果不存在则会创建一个新的层
@param {number} zlevel
@param {boolean} virtual Virtual layer will not be inserted into dom.
@return {module:zrender/Layer} | getLayer ( zlevel , virtual ) | javascript | SuperMap/iClient-JavaScript | libs/echarts/echarts.common.js | https://github.com/SuperMap/iClient-JavaScript/blob/master/libs/echarts/echarts.common.js | Apache-2.0 |
getLayers: function () {
return this._layers;
}, | 获取所有已创建的层
@param {Array.<module:zrender/Layer>} [prevLayer] | getLayers ( ) | javascript | SuperMap/iClient-JavaScript | libs/echarts/echarts.common.js | https://github.com/SuperMap/iClient-JavaScript/blob/master/libs/echarts/echarts.common.js | Apache-2.0 |
var Animation = function (options) {
options = options || {};
this.stage = options.stage || {};
this.onframe = options.onframe || function () {};
// private properties
this._clips = [];
this._running = false;
this._time;
this._pausedTime;
this._pauseStart;
this._paused = false;
Eventful.call(this);
}; | @alias module:zrender/animation/Animation
@constructor
@param {Object} [options]
@param {Function} [options.onframe]
@param {IZRenderStage} [options.stage]
@example
var animation = new Animation();
var obj = {
x: 100,
y: 100
};
animation.animate(node.position)
.when(1000, {
x: 500,
y: 500
})
.when(2000, {
x: 100,
y: 100
})
.start('spline'); | Animation ( options ) | javascript | SuperMap/iClient-JavaScript | libs/echarts/echarts.common.js | https://github.com/SuperMap/iClient-JavaScript/blob/master/libs/echarts/echarts.common.js | Apache-2.0 |
addClip: function (clip) {
this._clips.push(clip);
}, | Add clip
@param {module:zrender/animation/Clip} clip | addClip ( clip ) | javascript | SuperMap/iClient-JavaScript | libs/echarts/echarts.common.js | https://github.com/SuperMap/iClient-JavaScript/blob/master/libs/echarts/echarts.common.js | Apache-2.0 |
addAnimator: function (animator) {
animator.animation = this;
var clips = animator.getClips();
for (var i = 0; i < clips.length; i++) {
this.addClip(clips[i]);
}
}, | Add animator
@param {module:zrender/animation/Animator} animator | addAnimator ( animator ) | javascript | SuperMap/iClient-JavaScript | libs/echarts/echarts.common.js | https://github.com/SuperMap/iClient-JavaScript/blob/master/libs/echarts/echarts.common.js | Apache-2.0 |
removeClip: function (clip) {
var idx = indexOf(this._clips, clip);
if (idx >= 0) {
this._clips.splice(idx, 1);
}
}, | Delete animation clip
@param {module:zrender/animation/Clip} clip | removeClip ( clip ) | javascript | SuperMap/iClient-JavaScript | libs/echarts/echarts.common.js | https://github.com/SuperMap/iClient-JavaScript/blob/master/libs/echarts/echarts.common.js | Apache-2.0 |
removeAnimator: function (animator) {
var clips = animator.getClips();
for (var i = 0; i < clips.length; i++) {
this.removeClip(clips[i]);
}
animator.animation = null;
}, | Delete animation clip
@param {module:zrender/animation/Animator} animator | removeAnimator ( animator ) | javascript | SuperMap/iClient-JavaScript | libs/echarts/echarts.common.js | https://github.com/SuperMap/iClient-JavaScript/blob/master/libs/echarts/echarts.common.js | Apache-2.0 |
function setTouchTimer(scope) {
scope.touching = true;
if (scope.touchTimer != null) {
clearTimeout(scope.touchTimer);
scope.touchTimer = null;
}
scope.touchTimer = setTimeout(function () {
scope.touching = false;
scope.touchTimer = null;
}, 700);
} | Prevent mouse event from being dispatched after Touch Events action
@see <https://github.com/deltakosh/handjs/blob/master/src/hand.base.js>
1. Mobile browsers dispatch mouse events 300ms after touchend.
2. Chrome for Android dispatch mousedown for long-touch about 650ms
Result: Blocking Mouse Events for 700ms.
@param {DOMHandlerScope} scope | setTouchTimer ( scope ) | javascript | SuperMap/iClient-JavaScript | libs/echarts/echarts.common.js | https://github.com/SuperMap/iClient-JavaScript/blob/master/libs/echarts/echarts.common.js | Apache-2.0 |
function isLocalEl(instance, el) {
var elTmp = el;
var isLocal = false;
while (elTmp && elTmp.nodeType !== 9
&& !(
isLocal = elTmp.domBelongToZr
|| (elTmp !== el && elTmp === instance.painterRoot)
)
) {
elTmp = elTmp.parentNode;
}
return isLocal;
} | Detect whether the given el is in `painterRoot`. | isLocalEl ( instance , el ) | javascript | SuperMap/iClient-JavaScript | libs/echarts/echarts.common.js | https://github.com/SuperMap/iClient-JavaScript/blob/master/libs/echarts/echarts.common.js | Apache-2.0 |
function FakeGlobalEvent(instance, event) {
this.type = event.type;
this.target = this.currentTarget = instance.dom;
this.pointerType = event.pointerType;
// Necessray for the force calculation of zrX, zrY
this.clientX = event.clientX;
this.clientY = event.clientY;
// Because we do not mount global listeners to touch events,
// we do not copy `targetTouches` and `changedTouches` here.
} | Make a fake event but not change the original event,
becuase the global event probably be used by other
listeners not belonging to zrender.
@class | FakeGlobalEvent ( instance , event ) | javascript | SuperMap/iClient-JavaScript | libs/echarts/echarts.common.js | https://github.com/SuperMap/iClient-JavaScript/blob/master/libs/echarts/echarts.common.js | Apache-2.0 |
each$1(['click', 'mousewheel', 'dblclick', 'contextmenu'], function (name) {
localDOMHandlers[name] = function (event) {
event = normalizeEvent(this.dom, event);
this.trigger(name, event);
};
}); | Othere DOM UI Event handlers for zr dom.
@this {HandlerProxy} | (anonymous) ( name ) | javascript | SuperMap/iClient-JavaScript | libs/echarts/echarts.common.js | https://github.com/SuperMap/iClient-JavaScript/blob/master/libs/echarts/echarts.common.js | Apache-2.0 |
function mountLocalDOMEventListeners(instance, scope) {
var domHandlers = scope.domHandlers;
if (env$1.pointerEventsSupported) { // Only IE11+/Edge
// 1. On devices that both enable touch and mouse (e.g., MS Surface and lenovo X240),
// IE11+/Edge do not trigger touch event, but trigger pointer event and mouse event
// at the same time.
// 2. On MS Surface, it probablely only trigger mousedown but no mouseup when tap on
// screen, which do not occurs in pointer event.
// So we use pointer event to both detect touch gesture and mouse behavior.
each$1(localNativeListenerNames.pointer, function (nativeEventName) {
mountSingleDOMEventListener(scope, nativeEventName, function (event) {
// markTriggeredFromLocal(event);
domHandlers[nativeEventName].call(instance, event);
});
});
// FIXME
// Note: MS Gesture require CSS touch-action set. But touch-action is not reliable,
// which does not prevent defuault behavior occasionally (which may cause view port
// zoomed in but use can not zoom it back). And event.preventDefault() does not work.
// So we have to not to use MSGesture and not to support touchmove and pinch on MS
// touch screen. And we only support click behavior on MS touch screen now.
// MS Gesture Event is only supported on IE11+/Edge and on Windows 8+.
// We dont support touch on IE on win7.
// See <https://msdn.microsoft.com/en-us/library/dn433243(v=vs.85).aspx>
// if (typeof MSGesture === 'function') {
// (this._msGesture = new MSGesture()).target = dom; // jshint ignore:line
// dom.addEventListener('MSGestureChange', onMSGestureChange);
// }
}
else {
if (env$1.touchEventsSupported) {
each$1(localNativeListenerNames.touch, function (nativeEventName) {
mountSingleDOMEventListener(scope, nativeEventName, function (event) {
// markTriggeredFromLocal(event);
domHandlers[nativeEventName].call(instance, event);
setTouchTimer(scope);
});
});
// Handler of 'mouseout' event is needed in touch mode, which will be mounted below.
// addEventListener(root, 'mouseout', this._mouseoutHandler);
}
// 1. Considering some devices that both enable touch and mouse event (like on MS Surface
// and lenovo X240, @see #2350), we make mouse event be always listened, otherwise
// mouse event can not be handle in those devices.
// 2. On MS Surface, Chrome will trigger both touch event and mouse event. How to prevent
// mouseevent after touch event triggered, see `setTouchTimer`.
each$1(localNativeListenerNames.mouse, function (nativeEventName) {
mountSingleDOMEventListener(scope, nativeEventName, function (event) {
event = getNativeEvent(event);
if (!scope.touching) {
// markTriggeredFromLocal(event);
domHandlers[nativeEventName].call(instance, event);
}
});
});
}
} | @param {HandlerProxy} instance
@param {DOMHandlerScope} scope | mountLocalDOMEventListeners ( instance , scope ) | javascript | SuperMap/iClient-JavaScript | libs/echarts/echarts.common.js | https://github.com/SuperMap/iClient-JavaScript/blob/master/libs/echarts/echarts.common.js | Apache-2.0 |
function togglePointerCapture(instance, isPointerCapturing) {
instance._mayPointerCapture = null;
if (globalEventSupported && (instance._pointerCapturing ^ isPointerCapturing)) {
instance._pointerCapturing = isPointerCapturing;
var globalHandlerScope = instance._globalHandlerScope;
isPointerCapturing
? mountGlobalDOMEventListeners(instance, globalHandlerScope)
: unmountDOMEventListeners(globalHandlerScope);
}
} | See [Drag Outside] in `Handler.js`.
@implement
@param {boolean} isPointerCapturing Should never be `null`/`undefined`.
`true`: start to capture pointer if it is not capturing.
`false`: end the capture if it is capturing. | togglePointerCapture ( instance , isPointerCapturing ) | javascript | SuperMap/iClient-JavaScript | libs/echarts/echarts.common.js | https://github.com/SuperMap/iClient-JavaScript/blob/master/libs/echarts/echarts.common.js | Apache-2.0 |
function init$1(dom, opts) {
var zr = new ZRender(guid(), dom, opts);
instances$1[zr.id] = zr;
return zr;
} | Initializing a zrender instance
@param {HTMLElement} dom
@param {Object} [opts]
@param {string} [opts.renderer='canvas'] 'canvas' or 'svg'
@param {number} [opts.devicePixelRatio]
@param {number|string} [opts.width] Can be 'auto' (the same as null/undefined)
@param {number|string} [opts.height] Can be 'auto' (the same as null/undefined)
@return {module:zrender/ZRender} | $1 ( dom , opts ) | javascript | SuperMap/iClient-JavaScript | libs/echarts/echarts.common.js | https://github.com/SuperMap/iClient-JavaScript/blob/master/libs/echarts/echarts.common.js | Apache-2.0 |
function dispose$1(zr) {
if (zr) {
zr.dispose();
}
else {
for (var key in instances$1) {
if (instances$1.hasOwnProperty(key)) {
instances$1[key].dispose();
}
}
instances$1 = {};
}
return this;
} | Dispose zrender instance
@param {module:zrender/ZRender} zr | $1 ( zr ) | javascript | SuperMap/iClient-JavaScript | libs/echarts/echarts.common.js | https://github.com/SuperMap/iClient-JavaScript/blob/master/libs/echarts/echarts.common.js | Apache-2.0 |
function getInstance(id) {
return instances$1[id];
} | Get zrender instance by id
@param {string} id zrender instance id
@return {module:zrender/ZRender} | getInstance ( id ) | javascript | SuperMap/iClient-JavaScript | libs/echarts/echarts.common.js | https://github.com/SuperMap/iClient-JavaScript/blob/master/libs/echarts/echarts.common.js | Apache-2.0 |
add: function (el) {
this.storage.addRoot(el);
this._needsRefresh = true;
}, | 添加元素
@param {module:zrender/Element} el | add ( el ) | javascript | SuperMap/iClient-JavaScript | libs/echarts/echarts.common.js | https://github.com/SuperMap/iClient-JavaScript/blob/master/libs/echarts/echarts.common.js | Apache-2.0 |
remove: function (el) {
this.storage.delRoot(el);
this._needsRefresh = true;
}, | 删除元素
@param {module:zrender/Element} el | remove ( el ) | javascript | SuperMap/iClient-JavaScript | libs/echarts/echarts.common.js | https://github.com/SuperMap/iClient-JavaScript/blob/master/libs/echarts/echarts.common.js | Apache-2.0 |
configLayer: function (zLevel, config) {
if (this.painter.configLayer) {
this.painter.configLayer(zLevel, config);
}
this._needsRefresh = true;
}, | Change configuration of layer
@param {string} zLevel
@param {Object} config
@param {string} [config.clearColor=0] Clear color
@param {string} [config.motionBlur=false] If enable motion blur
@param {number} [config.lastFrameAlpha=0.7] Motion blur factor. Larger value cause longer trailer | configLayer ( zLevel , config ) | javascript | SuperMap/iClient-JavaScript | libs/echarts/echarts.common.js | https://github.com/SuperMap/iClient-JavaScript/blob/master/libs/echarts/echarts.common.js | Apache-2.0 |
setBackgroundColor: function (backgroundColor) {
if (this.painter.setBackgroundColor) {
this.painter.setBackgroundColor(backgroundColor);
}
this._needsRefresh = true;
}, | Set background color
@param {string} backgroundColor | setBackgroundColor ( backgroundColor ) | javascript | SuperMap/iClient-JavaScript | libs/echarts/echarts.common.js | https://github.com/SuperMap/iClient-JavaScript/blob/master/libs/echarts/echarts.common.js | Apache-2.0 |
refresh: function () {
this._needsRefresh = true;
}, | Mark and repaint the canvas in the next frame of browser | refresh ( ) | javascript | SuperMap/iClient-JavaScript | libs/echarts/echarts.common.js | https://github.com/SuperMap/iClient-JavaScript/blob/master/libs/echarts/echarts.common.js | Apache-2.0 |
addHover: function (el, style) {
if (this.painter.addHover) {
var elMirror = this.painter.addHover(el, style);
this.refreshHover();
return elMirror;
}
}, | Add element to hover layer
@param {module:zrender/Element} el
@param {Object} style | addHover ( el , style ) | javascript | SuperMap/iClient-JavaScript | libs/echarts/echarts.common.js | https://github.com/SuperMap/iClient-JavaScript/blob/master/libs/echarts/echarts.common.js | Apache-2.0 |
removeHover: function (el) {
if (this.painter.removeHover) {
this.painter.removeHover(el);
this.refreshHover();
}
}, | Add element from hover layer
@param {module:zrender/Element} el | removeHover ( el ) | javascript | SuperMap/iClient-JavaScript | libs/echarts/echarts.common.js | https://github.com/SuperMap/iClient-JavaScript/blob/master/libs/echarts/echarts.common.js | Apache-2.0 |
clearHover: function () {
if (this.painter.clearHover) {
this.painter.clearHover();
this.refreshHover();
}
}, | Clear all hover elements in hover layer
@param {module:zrender/Element} el | clearHover ( ) | javascript | SuperMap/iClient-JavaScript | libs/echarts/echarts.common.js | https://github.com/SuperMap/iClient-JavaScript/blob/master/libs/echarts/echarts.common.js | Apache-2.0 |
resize: function (opts) {
opts = opts || {};
this.painter.resize(opts.width, opts.height);
this.handler.resize();
}, | Resize the canvas.
Should be invoked when container size is changed
@param {Object} [opts]
@param {number|string} [opts.width] Can be 'auto' (the same as null/undefined)
@param {number|string} [opts.height] Can be 'auto' (the same as null/undefined) | resize ( opts ) | javascript | SuperMap/iClient-JavaScript | libs/echarts/echarts.common.js | https://github.com/SuperMap/iClient-JavaScript/blob/master/libs/echarts/echarts.common.js | Apache-2.0 |
clearAnimation: function () {
this.animation.clear();
}, | Stop and clear all animation immediately | clearAnimation ( ) | javascript | SuperMap/iClient-JavaScript | libs/echarts/echarts.common.js | https://github.com/SuperMap/iClient-JavaScript/blob/master/libs/echarts/echarts.common.js | Apache-2.0 |
pathToImage: function (e, dpr) {
return this.painter.pathToImage(e, dpr);
}, | Converting a path to image.
It has much better performance of drawing image rather than drawing a vector path.
@param {module:zrender/graphic/Path} e
@param {number} width
@param {number} height | pathToImage ( e , dpr ) | javascript | SuperMap/iClient-JavaScript | libs/echarts/echarts.common.js | https://github.com/SuperMap/iClient-JavaScript/blob/master/libs/echarts/echarts.common.js | Apache-2.0 |
setCursorStyle: function (cursorStyle) {
this.handler.setCursorStyle(cursorStyle);
}, | Set default cursor
@param {string} [cursorStyle='default'] 例如 crosshair | setCursorStyle ( cursorStyle ) | javascript | SuperMap/iClient-JavaScript | libs/echarts/echarts.common.js | https://github.com/SuperMap/iClient-JavaScript/blob/master/libs/echarts/echarts.common.js | Apache-2.0 |
findHover: function (x, y) {
return this.handler.findHover(x, y);
}, | Find hovered element
@param {number} x
@param {number} y
@return {Object} {target, topTarget} | findHover ( x , y ) | javascript | SuperMap/iClient-JavaScript | libs/echarts/echarts.common.js | https://github.com/SuperMap/iClient-JavaScript/blob/master/libs/echarts/echarts.common.js | Apache-2.0 |
on: function (eventName, eventHandler, context) {
this.handler.on(eventName, eventHandler, context);
}, | Bind event
@param {string} eventName Event name
@param {Function} eventHandler Handler function
@param {Object} [context] Context object | on ( eventName , eventHandler , context ) | javascript | SuperMap/iClient-JavaScript | libs/echarts/echarts.common.js | https://github.com/SuperMap/iClient-JavaScript/blob/master/libs/echarts/echarts.common.js | Apache-2.0 |
off: function (eventName, eventHandler) {
this.handler.off(eventName, eventHandler);
}, | Unbind event
@param {string} eventName Event name
@param {Function} [eventHandler] Handler function | off ( eventName , eventHandler ) | javascript | SuperMap/iClient-JavaScript | libs/echarts/echarts.common.js | https://github.com/SuperMap/iClient-JavaScript/blob/master/libs/echarts/echarts.common.js | Apache-2.0 |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.