code
stringlengths 24
2.07M
| docstring
stringlengths 25
85.3k
| func_name
stringlengths 1
92
| language
stringclasses 1
value | repo
stringlengths 5
64
| path
stringlengths 4
172
| url
stringlengths 44
218
| license
stringclasses 7
values |
---|---|---|---|---|---|---|---|
dataStack = function (ecModel) {
var stackInfoMap = createHashMap();
ecModel.eachSeries(function (seriesModel) {
var stack = seriesModel.get('stack');
// Compatibal: when `stack` is set as '', do not stack.
if (stack) {
var stackInfoList = stackInfoMap.get(stack) || stackInfoMap.set(stack, []);
var data = seriesModel.getData();
var stackInfo = {
// Used for calculate axis extent automatically.
stackResultDimension: data.getCalculationInfo('stackResultDimension'),
stackedOverDimension: data.getCalculationInfo('stackedOverDimension'),
stackedDimension: data.getCalculationInfo('stackedDimension'),
stackedByDimension: data.getCalculationInfo('stackedByDimension'),
isStackedByIndex: data.getCalculationInfo('isStackedByIndex'),
data: data,
seriesModel: seriesModel
};
// If stacked on axis that do not support data stack.
if (!stackInfo.stackedDimension
|| !(stackInfo.isStackedByIndex || stackInfo.stackedByDimension)
) {
return;
}
stackInfoList.length && data.setCalculationInfo(
'stackedOnSeries', stackInfoList[stackInfoList.length - 1].seriesModel
);
stackInfoList.push(stackInfo);
}
});
stackInfoMap.each(calculateStack);
}
|
If normal array used, mutable chunk size is supported.
If typed array used, chunk size must be fixed.
|
dataStack
|
javascript
|
douyu/juno
|
assets/public/js/echarts/v4.7.0/echarts.simple.js
|
https://github.com/douyu/juno/blob/master/assets/public/js/echarts/v4.7.0/echarts.simple.js
|
Apache-2.0
|
function calculateStack(stackInfoList) {
each$1(stackInfoList, function (targetStackInfo, idxInStack) {
var resultVal = [];
var resultNaN = [NaN, NaN];
var dims = [targetStackInfo.stackResultDimension, targetStackInfo.stackedOverDimension];
var targetData = targetStackInfo.data;
var isStackedByIndex = targetStackInfo.isStackedByIndex;
// Should not write on raw data, because stack series model list changes
// depending on legend selection.
var newData = targetData.map(dims, function (v0, v1, dataIndex) {
var sum = targetData.get(targetStackInfo.stackedDimension, dataIndex);
// Consider `connectNulls` of line area, if value is NaN, stackedOver
// should also be NaN, to draw a appropriate belt area.
if (isNaN(sum)) {
return resultNaN;
}
var byValue;
var stackedDataRawIndex;
if (isStackedByIndex) {
stackedDataRawIndex = targetData.getRawIndex(dataIndex);
}
else {
byValue = targetData.get(targetStackInfo.stackedByDimension, dataIndex);
}
// If stackOver is NaN, chart view will render point on value start.
var stackedOver = NaN;
for (var j = idxInStack - 1; j >= 0; j--) {
var stackInfo = stackInfoList[j];
// Has been optimized by inverted indices on `stackedByDimension`.
if (!isStackedByIndex) {
stackedDataRawIndex = stackInfo.data.rawIndexOf(stackInfo.stackedByDimension, byValue);
}
if (stackedDataRawIndex >= 0) {
var val = stackInfo.data.getByRawIndex(stackInfo.stackResultDimension, stackedDataRawIndex);
// Considering positive stack, negative stack and empty data
if ((sum >= 0 && val > 0) // Positive stack
|| (sum <= 0 && val < 0) // Negative stack
) {
sum += val;
stackedOver = val;
break;
}
}
}
resultVal[0] = sum;
resultVal[1] = stackedOver;
return resultVal;
});
targetData.hostModel.setData(newData);
// Update for consequent calculation
targetStackInfo.data = newData;
});
}
|
If normal array used, mutable chunk size is supported.
If typed array used, chunk size must be fixed.
|
calculateStack
|
javascript
|
douyu/juno
|
assets/public/js/echarts/v4.7.0/echarts.simple.js
|
https://github.com/douyu/juno/blob/master/assets/public/js/echarts/v4.7.0/echarts.simple.js
|
Apache-2.0
|
function DefaultDataProvider(source, dimSize) {
if (!Source.isInstance(source)) {
source = Source.seriesDataToSource(source);
}
this._source = source;
var data = this._data = source.data;
var sourceFormat = source.sourceFormat;
// Typed array. TODO IE10+?
if (sourceFormat === SOURCE_FORMAT_TYPED_ARRAY) {
if (__DEV__) {
if (dimSize == null) {
throw new Error('Typed array data must specify dimension size');
}
}
this._offset = 0;
this._dimSize = dimSize;
this._data = data;
}
var methods = providerMethods[
sourceFormat === SOURCE_FORMAT_ARRAY_ROWS
? sourceFormat + '_' + source.seriesLayoutBy
: sourceFormat
];
if (__DEV__) {
assert$1(methods, 'Invalide sourceFormat: ' + sourceFormat);
}
extend(this, methods);
}
|
If normal array used, mutable chunk size is supported.
If typed array used, chunk size must be fixed.
|
DefaultDataProvider
|
javascript
|
douyu/juno
|
assets/public/js/echarts/v4.7.0/echarts.simple.js
|
https://github.com/douyu/juno/blob/master/assets/public/js/echarts/v4.7.0/echarts.simple.js
|
Apache-2.0
|
function countSimply() {
return this._data.length;
}
|
Compatible with some cases (in pie, map) like:
data: [{name: 'xx', value: 5, selected: true}, ...]
where only sourceFormat is 'original' and 'objectRows' supported.
??? TODO
Supported detail options in data item when using 'arrayRows'.
@param {module:echarts/data/List} data
@param {number} dataIndex
@param {string} attr like 'selected'
|
countSimply
|
javascript
|
douyu/juno
|
assets/public/js/echarts/v4.7.0/echarts.simple.js
|
https://github.com/douyu/juno/blob/master/assets/public/js/echarts/v4.7.0/echarts.simple.js
|
Apache-2.0
|
function getItemSimply(idx) {
return this._data[idx];
}
|
Compatible with some cases (in pie, map) like:
data: [{name: 'xx', value: 5, selected: true}, ...]
where only sourceFormat is 'original' and 'objectRows' supported.
??? TODO
Supported detail options in data item when using 'arrayRows'.
@param {module:echarts/data/List} data
@param {number} dataIndex
@param {string} attr like 'selected'
|
getItemSimply
|
javascript
|
douyu/juno
|
assets/public/js/echarts/v4.7.0/echarts.simple.js
|
https://github.com/douyu/juno/blob/master/assets/public/js/echarts/v4.7.0/echarts.simple.js
|
Apache-2.0
|
function appendDataSimply(newData) {
for (var i = 0; i < newData.length; i++) {
this._data.push(newData[i]);
}
}
|
Compatible with some cases (in pie, map) like:
data: [{name: 'xx', value: 5, selected: true}, ...]
where only sourceFormat is 'original' and 'objectRows' supported.
??? TODO
Supported detail options in data item when using 'arrayRows'.
@param {module:echarts/data/List} data
@param {number} dataIndex
@param {string} attr like 'selected'
|
appendDataSimply
|
javascript
|
douyu/juno
|
assets/public/js/echarts/v4.7.0/echarts.simple.js
|
https://github.com/douyu/juno/blob/master/assets/public/js/echarts/v4.7.0/echarts.simple.js
|
Apache-2.0
|
function getRawValueSimply(dataItem, dataIndex, dimIndex, dimName) {
return dimIndex != null ? dataItem[dimIndex] : dataItem;
}
|
Compatible with some cases (in pie, map) like:
data: [{name: 'xx', value: 5, selected: true}, ...]
where only sourceFormat is 'original' and 'objectRows' supported.
??? TODO
Supported detail options in data item when using 'arrayRows'.
@param {module:echarts/data/List} data
@param {number} dataIndex
@param {string} attr like 'selected'
|
getRawValueSimply
|
javascript
|
douyu/juno
|
assets/public/js/echarts/v4.7.0/echarts.simple.js
|
https://github.com/douyu/juno/blob/master/assets/public/js/echarts/v4.7.0/echarts.simple.js
|
Apache-2.0
|
function getDimValueSimply(dataItem, dimName, dataIndex, dimIndex) {
return converDataValue(dataItem[dimIndex], this._dimensionInfos[dimName]);
}
|
Get params for formatter
@param {number} dataIndex
@param {string} [dataType]
@return {Object}
|
getDimValueSimply
|
javascript
|
douyu/juno
|
assets/public/js/echarts/v4.7.0/echarts.simple.js
|
https://github.com/douyu/juno/blob/master/assets/public/js/echarts/v4.7.0/echarts.simple.js
|
Apache-2.0
|
function converDataValue(value, dimInfo) {
// Performance sensitive.
var dimType = dimInfo && dimInfo.type;
if (dimType === 'ordinal') {
// If given value is a category string
var ordinalMeta = dimInfo && dimInfo.ordinalMeta;
return ordinalMeta
? ordinalMeta.parseAndCollect(value)
: value;
}
if (dimType === 'time'
// spead up when using timestamp
&& typeof value !== 'number'
&& value != null
&& value !== '-'
) {
value = +parseDate(value);
}
// dimType defaults 'number'.
// If dimType is not ordinal and value is null or undefined or NaN or '-',
// parse to NaN.
return (value == null || value === '')
? NaN
// If string (like '-'), using '+' parse to NaN
// If object, also parse to NaN
: +value;
}
|
Get params for formatter
@param {number} dataIndex
@param {string} [dataType]
@return {Object}
|
converDataValue
|
javascript
|
douyu/juno
|
assets/public/js/echarts/v4.7.0/echarts.simple.js
|
https://github.com/douyu/juno/blob/master/assets/public/js/echarts/v4.7.0/echarts.simple.js
|
Apache-2.0
|
function retrieveRawValue(data, dataIndex, dim) {
if (!data) {
return;
}
// Consider data may be not persistent.
var dataItem = data.getRawDataItem(dataIndex);
if (dataItem == null) {
return;
}
var sourceFormat = data.getProvider().getSource().sourceFormat;
var dimName;
var dimIndex;
var dimInfo = data.getDimensionInfo(dim);
if (dimInfo) {
dimName = dimInfo.name;
dimIndex = dimInfo.index;
}
return rawValueGetters[sourceFormat](dataItem, dataIndex, dimIndex, dimName);
}
|
Format label
@param {number} dataIndex
@param {string} [status='normal'] 'normal' or 'emphasis'
@param {string} [dataType]
@param {number} [dimIndex] Only used in some chart that
use formatter in different dimensions, like radar.
@param {string} [labelProp='label']
@return {string} If not formatter, return null/undefined
|
retrieveRawValue
|
javascript
|
douyu/juno
|
assets/public/js/echarts/v4.7.0/echarts.simple.js
|
https://github.com/douyu/juno/blob/master/assets/public/js/echarts/v4.7.0/echarts.simple.js
|
Apache-2.0
|
function retrieveRawAttr(data, dataIndex, attr) {
if (!data) {
return;
}
var sourceFormat = data.getProvider().getSource().sourceFormat;
if (sourceFormat !== SOURCE_FORMAT_ORIGINAL
&& sourceFormat !== SOURCE_FORMAT_OBJECT_ROWS
) {
return;
}
var dataItem = data.getRawDataItem(dataIndex);
if (sourceFormat === SOURCE_FORMAT_ORIGINAL && !isObject$1(dataItem)) {
dataItem = null;
}
if (dataItem) {
return dataItem[attr];
}
}
|
Get raw value in option
@param {number} idx
@param {string} [dataType]
@return {Array|number|string}
|
retrieveRawAttr
|
javascript
|
douyu/juno
|
assets/public/js/echarts/v4.7.0/echarts.simple.js
|
https://github.com/douyu/juno/blob/master/assets/public/js/echarts/v4.7.0/echarts.simple.js
|
Apache-2.0
|
function createTask(define) {
return new Task(define);
}
|
@param {Object} performArgs
@param {number} [performArgs.step] Specified step.
@param {number} [performArgs.skip] Skip customer perform call.
@param {number} [performArgs.modBy] Sampling window size.
@param {number} [performArgs.modDataCount] Sampling count.
|
createTask
|
javascript
|
douyu/juno
|
assets/public/js/echarts/v4.7.0/echarts.simple.js
|
https://github.com/douyu/juno/blob/master/assets/public/js/echarts/v4.7.0/echarts.simple.js
|
Apache-2.0
|
function Task(define) {
define = define || {};
this._reset = define.reset;
this._plan = define.plan;
this._count = define.count;
this._onDirty = define.onDirty;
this._dirty = true;
// Context must be specified implicitly, to
// avoid miss update context when model changed.
this.context;
}
|
@param {Object} performArgs
@param {number} [performArgs.step] Specified step.
@param {number} [performArgs.skip] Skip customer perform call.
@param {number} [performArgs.modBy] Sampling window size.
@param {number} [performArgs.modDataCount] Sampling count.
|
Task
|
javascript
|
douyu/juno
|
assets/public/js/echarts/v4.7.0/echarts.simple.js
|
https://github.com/douyu/juno/blob/master/assets/public/js/echarts/v4.7.0/echarts.simple.js
|
Apache-2.0
|
function normalizeModBy(val) {
!(val >= 1) && (val = 1); // jshint ignore:line
return val;
}
|
@param {Object} downTask The downstream task.
@return {Object} The downstream task.
|
normalizeModBy
|
javascript
|
douyu/juno
|
assets/public/js/echarts/v4.7.0/echarts.simple.js
|
https://github.com/douyu/juno/blob/master/assets/public/js/echarts/v4.7.0/echarts.simple.js
|
Apache-2.0
|
function sequentialNext() {
return current < end ? current++ : null;
}
|
@param {Object} downTask The downstream task.
@return {Object} The downstream task.
|
sequentialNext
|
javascript
|
douyu/juno
|
assets/public/js/echarts/v4.7.0/echarts.simple.js
|
https://github.com/douyu/juno/blob/master/assets/public/js/echarts/v4.7.0/echarts.simple.js
|
Apache-2.0
|
function modNext() {
var dataIndex = (current % winCount) * modBy + Math.ceil(current / winCount);
var result = current >= end
? null
: dataIndex < modDataCount
? dataIndex
// If modDataCount is smaller than data.count() (consider `appendData` case),
// Use normal linear rendering mode.
: current;
current++;
return result;
}
|
@param {Object} downTask The downstream task.
@return {Object} The downstream task.
|
modNext
|
javascript
|
douyu/juno
|
assets/public/js/echarts/v4.7.0/echarts.simple.js
|
https://github.com/douyu/juno/blob/master/assets/public/js/echarts/v4.7.0/echarts.simple.js
|
Apache-2.0
|
function reset(taskIns, skip) {
taskIns._dueIndex = taskIns._outputDueEnd = taskIns._dueEnd = 0;
taskIns._settedOutputEnd = null;
var progress;
var forceFirstProgress;
if (!skip && taskIns._reset) {
progress = taskIns._reset(taskIns.context);
if (progress && progress.progress) {
forceFirstProgress = progress.forceFirstProgress;
progress = progress.progress;
}
// To simplify no progress checking, array must has item.
if (isArray(progress) && !progress.length) {
progress = null;
}
}
taskIns._progress = progress;
taskIns._modBy = taskIns._modDataCount = null;
var downstream = taskIns._downstream;
downstream && downstream.dirty();
return forceFirstProgress;
}
|
Access path of color for visual
|
reset
|
javascript
|
douyu/juno
|
assets/public/js/echarts/v4.7.0/echarts.simple.js
|
https://github.com/douyu/juno/blob/master/assets/public/js/echarts/v4.7.0/echarts.simple.js
|
Apache-2.0
|
function setEachItem(val, dim) {
var dimInfo = data.getDimensionInfo(dim);
// If `dimInfo.tooltip` is not set, show tooltip.
if (!dimInfo || dimInfo.otherDims.tooltip === false) {
return;
}
var dimType = dimInfo.type;
var markName = 'sub' + series.seriesIndex + 'at' + markerId;
var dimHead = getTooltipMarker({
color: color,
type: 'subItem',
renderMode: renderMode,
markerId: markName
});
var dimHeadStr = typeof dimHead === 'string' ? dimHead : dimHead.content;
var valStr = (vertially
? dimHeadStr + encodeHTML(dimInfo.displayName || '-') + ': '
: ''
)
// FIXME should not format time for raw data?
+ encodeHTML(dimType === 'ordinal'
? val + ''
: dimType === 'time'
? (multipleSeries ? '' : formatTime('yyyy/MM/dd hh:mm:ss', val))
: addCommas(val)
);
valStr && result.push(valStr);
if (isRichText) {
markers[markName] = color;
++markerId;
}
}
|
Get progressive rendering count each step
@return {number}
|
setEachItem
|
javascript
|
douyu/juno
|
assets/public/js/echarts/v4.7.0/echarts.simple.js
|
https://github.com/douyu/juno/blob/master/assets/public/js/echarts/v4.7.0/echarts.simple.js
|
Apache-2.0
|
function formatSingleValue(val) {
// return encodeHTML(addCommas(val));
return {
renderMode: renderMode,
content: encodeHTML(addCommas(val)),
style: markers
};
}
|
MUST be called after `prepareSource` called
Here we need to make auto series, especially for auto legend. But we
do not modify series.name in option to avoid side effects.
|
formatSingleValue
|
javascript
|
douyu/juno
|
assets/public/js/echarts/v4.7.0/echarts.simple.js
|
https://github.com/douyu/juno/blob/master/assets/public/js/echarts/v4.7.0/echarts.simple.js
|
Apache-2.0
|
function autoSeriesName(seriesModel) {
// User specified name has higher priority, otherwise it may cause
// series can not be queried unexpectedly.
var name = seriesModel.name;
if (!isNameSpecified(seriesModel)) {
seriesModel.name = getSeriesAutoName(seriesModel) || name;
}
}
|
@return {string} If large mode changed, return string 'reset';
|
autoSeriesName
|
javascript
|
douyu/juno
|
assets/public/js/echarts/v4.7.0/echarts.simple.js
|
https://github.com/douyu/juno/blob/master/assets/public/js/echarts/v4.7.0/echarts.simple.js
|
Apache-2.0
|
function getSeriesAutoName(seriesModel) {
var data = seriesModel.getRawData();
var dataDims = data.mapDimension('seriesName', true);
var nameArr = [];
each$1(dataDims, function (dataDim) {
var dimInfo = data.getDimensionInfo(dataDim);
dimInfo.displayName && nameArr.push(dimInfo.displayName);
});
return nameArr.join(' ');
}
|
@return {string} If large mode changed, return string 'reset';
|
getSeriesAutoName
|
javascript
|
douyu/juno
|
assets/public/js/echarts/v4.7.0/echarts.simple.js
|
https://github.com/douyu/juno/blob/master/assets/public/js/echarts/v4.7.0/echarts.simple.js
|
Apache-2.0
|
function dataTaskCount(context) {
return context.model.getRawData().count();
}
|
@return {string} If large mode changed, return string 'reset';
|
dataTaskCount
|
javascript
|
douyu/juno
|
assets/public/js/echarts/v4.7.0/echarts.simple.js
|
https://github.com/douyu/juno/blob/master/assets/public/js/echarts/v4.7.0/echarts.simple.js
|
Apache-2.0
|
function dataTaskReset(context) {
var seriesModel = context.model;
seriesModel.setData(seriesModel.getRawData().cloneShallow());
return dataTaskProgress;
}
|
@return {string} If large mode changed, return string 'reset';
|
dataTaskReset
|
javascript
|
douyu/juno
|
assets/public/js/echarts/v4.7.0/echarts.simple.js
|
https://github.com/douyu/juno/blob/master/assets/public/js/echarts/v4.7.0/echarts.simple.js
|
Apache-2.0
|
function dataTaskProgress(param, context) {
// Avoid repead cloneShallow when data just created in reset.
if (param.end > context.outputData.count()) {
context.model.getRawData().cloneShallow(context.outputData);
}
}
|
@return {string} If large mode changed, return string 'reset';
|
dataTaskProgress
|
javascript
|
douyu/juno
|
assets/public/js/echarts/v4.7.0/echarts.simple.js
|
https://github.com/douyu/juno/blob/master/assets/public/js/echarts/v4.7.0/echarts.simple.js
|
Apache-2.0
|
function wrapData(data, seriesModel) {
each$1(data.CHANGABLE_METHODS, function (methodName) {
data.wrapMethod(methodName, curry(onDataSelfChange, seriesModel));
});
}
|
@return {string} If large mode changed, return string 'reset';
|
wrapData
|
javascript
|
douyu/juno
|
assets/public/js/echarts/v4.7.0/echarts.simple.js
|
https://github.com/douyu/juno/blob/master/assets/public/js/echarts/v4.7.0/echarts.simple.js
|
Apache-2.0
|
Component = function () {
/**
* @type {module:zrender/container/Group}
* @readOnly
*/
this.group = new Group();
/**
* @type {string}
* @readOnly
*/
this.uid = getUID('viewComponent');
}
|
Downplay series or specified data item.
@param {module:echarts/model/Series} seriesModel
@param {module:echarts/model/Global} ecModel
@param {module:echarts/ExtensionAPI} api
@param {Object} payload
|
Component
|
javascript
|
douyu/juno
|
assets/public/js/echarts/v4.7.0/echarts.simple.js
|
https://github.com/douyu/juno/blob/master/assets/public/js/echarts/v4.7.0/echarts.simple.js
|
Apache-2.0
|
createRenderPlanner = function () {
var inner = makeInner();
return function (seriesModel) {
var fields = inner(seriesModel);
var pipelineContext = seriesModel.pipelineContext;
var originalLarge = fields.large;
var originalProgressive = fields.progressiveRender;
// FIXME: if the planner works on a filtered series, `pipelineContext` does not
// exists. See #11611 . Probably we need to modify this structure, see the comment
// on `performRawSeries` in `Schedular.js`.
var large = fields.large = pipelineContext && pipelineContext.large;
var progressive = fields.progressiveRender = pipelineContext && pipelineContext.progressiveRender;
return !!((originalLarge ^ large) || (originalProgressive ^ progressive)) && 'reset';
};
}
|
@param {string} eventType
@param {Object} query
@param {module:zrender/Element} targetEl
@param {Object} packedEvent
@return {boolen} Pass only when return `true`.
|
createRenderPlanner
|
javascript
|
douyu/juno
|
assets/public/js/echarts/v4.7.0/echarts.simple.js
|
https://github.com/douyu/juno/blob/master/assets/public/js/echarts/v4.7.0/echarts.simple.js
|
Apache-2.0
|
function Chart() {
/**
* @type {module:zrender/container/Group}
* @readOnly
*/
this.group = new Group();
/**
* @type {string}
* @readOnly
*/
this.uid = getUID('viewChart');
this.renderTask = createTask({
plan: renderTaskPlan,
reset: renderTaskReset
});
this.renderTask.context = {view: this};
}
|
@param {module:echarts/data/List} data
@param {Object} payload
@param {string} state 'normal'|'emphasis'
|
Chart
|
javascript
|
douyu/juno
|
assets/public/js/echarts/v4.7.0/echarts.simple.js
|
https://github.com/douyu/juno/blob/master/assets/public/js/echarts/v4.7.0/echarts.simple.js
|
Apache-2.0
|
function elSetState(el, state, highlightDigit) {
if (el) {
el.trigger(state, highlightDigit);
if (el.isGroup
// Simple optimize.
&& !isHighDownDispatcher(el)
) {
for (var i = 0, len = el.childCount(); i < len; i++) {
elSetState(el.childAt(i), state, highlightDigit);
}
}
}
}
|
@public
@param {(Function)} fn
@param {number} [delay=0] Unit: ms.
@param {boolean} [debounce=false]
true: If call interval less than `delay`, only the last call works.
false: If call interval less than `delay, call works on fixed rate.
@return {(Function)} throttled fn.
|
elSetState
|
javascript
|
douyu/juno
|
assets/public/js/echarts/v4.7.0/echarts.simple.js
|
https://github.com/douyu/juno/blob/master/assets/public/js/echarts/v4.7.0/echarts.simple.js
|
Apache-2.0
|
function renderTaskReset(context) {
var seriesModel = context.model;
var ecModel = context.ecModel;
var api = context.api;
var payload = context.payload;
// ???! remove updateView updateVisual
var progressiveRender = seriesModel.pipelineContext.progressiveRender;
var view = context.view;
var updateMethod = payload && inner$5(payload).updateMethod;
var methodName = progressiveRender
? 'incrementalPrepareRender'
: (updateMethod && view[updateMethod])
? updateMethod
// `appendData` is also supported when data amount
// is less than progressive threshold.
: 'render';
if (methodName !== 'render') {
view[methodName](seriesModel, ecModel, api, payload);
}
return progressMethodMap[methodName];
}
|
Create throttle method or update throttle rate.
@example
ComponentView.prototype.render = function () {
...
throttle.createOrUpdate(
this,
'_dispatchAction',
this.model.get('throttle'),
'fixRate'
);
};
ComponentView.prototype.remove = function () {
throttle.clear(this, '_dispatchAction');
};
ComponentView.prototype.dispose = function () {
throttle.clear(this, '_dispatchAction');
};
@public
@param {Object} obj
@param {string} fnAttr
@param {number} [rate]
@param {string} [throttleType='fixRate'] 'fixRate' or 'debounce'
@return {Function} throttled function.
|
renderTaskReset
|
javascript
|
douyu/juno
|
assets/public/js/echarts/v4.7.0/echarts.simple.js
|
https://github.com/douyu/juno/blob/master/assets/public/js/echarts/v4.7.0/echarts.simple.js
|
Apache-2.0
|
function throttle(fn, delay, debounce) {
var currCall;
var lastCall = 0;
var lastExec = 0;
var timer = null;
var diff;
var scope;
var args;
var debounceNextCall;
delay = delay || 0;
function exec() {
lastExec = (new Date()).getTime();
timer = null;
fn.apply(scope, args || []);
}
var cb = function () {
currCall = (new Date()).getTime();
scope = this;
args = arguments;
var thisDelay = debounceNextCall || delay;
var thisDebounce = debounceNextCall || debounce;
debounceNextCall = null;
diff = currCall - (thisDebounce ? lastCall : lastExec) - thisDelay;
clearTimeout(timer);
// Here we should make sure that: the `exec` SHOULD NOT be called later
// than a new call of `cb`, that is, preserving the command order. Consider
// calculating "scale rate" when roaming as an example. When a call of `cb`
// happens, either the `exec` is called dierectly, or the call is delayed.
// But the delayed call should never be later than next call of `cb`. Under
// this assurance, we can simply update view state each time `dispatchAction`
// triggered by user roaming, but not need to add extra code to avoid the
// state being "rolled-back".
if (thisDebounce) {
timer = setTimeout(exec, thisDelay);
}
else {
if (diff >= 0) {
exec();
}
else {
timer = setTimeout(exec, -diff);
}
}
lastCall = currCall;
};
/**
* Clear throttle.
* @public
*/
cb.clear = function () {
if (timer) {
clearTimeout(timer);
timer = null;
}
};
/**
* Enable debounce once.
*/
cb.debounceNextCall = function (debounceDelay) {
debounceNextCall = debounceDelay;
};
return cb;
}
|
Clear throttle. Example see throttle.createOrUpdate.
@public
@param {Object} obj
@param {string} fnAttr
|
throttle
|
javascript
|
douyu/juno
|
assets/public/js/echarts/v4.7.0/echarts.simple.js
|
https://github.com/douyu/juno/blob/master/assets/public/js/echarts/v4.7.0/echarts.simple.js
|
Apache-2.0
|
function exec() {
lastExec = (new Date()).getTime();
timer = null;
fn.apply(scope, args || []);
}
|
Clear throttle. Example see throttle.createOrUpdate.
@public
@param {Object} obj
@param {string} fnAttr
|
exec
|
javascript
|
douyu/juno
|
assets/public/js/echarts/v4.7.0/echarts.simple.js
|
https://github.com/douyu/juno/blob/master/assets/public/js/echarts/v4.7.0/echarts.simple.js
|
Apache-2.0
|
cb = function () {
currCall = (new Date()).getTime();
scope = this;
args = arguments;
var thisDelay = debounceNextCall || delay;
var thisDebounce = debounceNextCall || debounce;
debounceNextCall = null;
diff = currCall - (thisDebounce ? lastCall : lastExec) - thisDelay;
clearTimeout(timer);
// Here we should make sure that: the `exec` SHOULD NOT be called later
// than a new call of `cb`, that is, preserving the command order. Consider
// calculating "scale rate" when roaming as an example. When a call of `cb`
// happens, either the `exec` is called dierectly, or the call is delayed.
// But the delayed call should never be later than next call of `cb`. Under
// this assurance, we can simply update view state each time `dispatchAction`
// triggered by user roaming, but not need to add extra code to avoid the
// state being "rolled-back".
if (thisDebounce) {
timer = setTimeout(exec, thisDelay);
}
else {
if (diff >= 0) {
exec();
}
else {
timer = setTimeout(exec, -diff);
}
}
lastCall = currCall;
}
|
Clear throttle. Example see throttle.createOrUpdate.
@public
@param {Object} obj
@param {string} fnAttr
|
cb
|
javascript
|
douyu/juno
|
assets/public/js/echarts/v4.7.0/echarts.simple.js
|
https://github.com/douyu/juno/blob/master/assets/public/js/echarts/v4.7.0/echarts.simple.js
|
Apache-2.0
|
function replace(str, keyValues) {
if (typeof str !== 'string') {
return str;
}
var result = str;
each$1(keyValues, function (value, key) {
result = result.replace(
new RegExp('\\{\\s*' + key + '\\s*\\}', 'g'),
value
);
});
return result;
}
|
@param {module:echarts/model/Global} ecModel
@param {Object} payload
|
replace
|
javascript
|
douyu/juno
|
assets/public/js/echarts/v4.7.0/echarts.simple.js
|
https://github.com/douyu/juno/blob/master/assets/public/js/echarts/v4.7.0/echarts.simple.js
|
Apache-2.0
|
function getConfig(path) {
var userConfig = ariaModel.get(path);
if (userConfig == null) {
var pathArr = path.split('.');
var result = lang.aria;
for (var i = 0; i < pathArr.length; ++i) {
result = result[pathArr[i]];
}
return result;
}
else {
return userConfig;
}
}
|
@param {module:echarts/model/Global} ecModel
@param {Object} payload
|
getConfig
|
javascript
|
douyu/juno
|
assets/public/js/echarts/v4.7.0/echarts.simple.js
|
https://github.com/douyu/juno/blob/master/assets/public/js/echarts/v4.7.0/echarts.simple.js
|
Apache-2.0
|
function getTitle() {
var title = ecModel.getModel('title').option;
if (title && title.length) {
title = title[0];
}
return title && title.text;
}
|
@param {module:echarts/model/Global} ecModel
@param {Object} payload
|
getTitle
|
javascript
|
douyu/juno
|
assets/public/js/echarts/v4.7.0/echarts.simple.js
|
https://github.com/douyu/juno/blob/master/assets/public/js/echarts/v4.7.0/echarts.simple.js
|
Apache-2.0
|
loadingDefault = function (api, opts) {
opts = opts || {};
defaults(opts, {
text: 'loading',
color: '#c23531',
textColor: '#000',
maskColor: 'rgba(255, 255, 255, 0.8)',
zlevel: 0
});
var mask = new Rect({
style: {
fill: opts.maskColor
},
zlevel: opts.zlevel,
z: 10000
});
var arc = new Arc({
shape: {
startAngle: -PI$1 / 2,
endAngle: -PI$1 / 2 + 0.1,
r: 10
},
style: {
stroke: opts.color,
lineCap: 'round',
lineWidth: 5
},
zlevel: opts.zlevel,
z: 10001
});
var labelRect = new Rect({
style: {
fill: 'none',
text: opts.text,
textPosition: 'right',
textDistance: 10,
textFill: opts.textColor
},
zlevel: opts.zlevel,
z: 10001
});
arc.animateShape(true)
.when(1000, {
endAngle: PI$1 * 3 / 2
})
.start('circularInOut');
arc.animateShape(true)
.when(1000, {
startAngle: PI$1 * 3 / 2
})
.delay(300)
.start('circularInOut');
var group = new Group();
group.add(arc);
group.add(labelRect);
group.add(mask);
// Inject resize
group.resize = function () {
var cx = api.getWidth() / 2;
var cy = api.getHeight() / 2;
arc.setShape({
cx: cx,
cy: cy
});
var r = arc.shape.r;
labelRect.setShape({
x: cx - r,
y: cy - r,
width: r * 2,
height: r * 2
});
mask.setShape({
x: 0,
y: 0,
width: api.getWidth(),
height: api.getHeight()
});
};
group.resize();
return group;
}
|
@param {module:echarts/model/Global} ecModel
@param {Object} payload
|
loadingDefault
|
javascript
|
douyu/juno
|
assets/public/js/echarts/v4.7.0/echarts.simple.js
|
https://github.com/douyu/juno/blob/master/assets/public/js/echarts/v4.7.0/echarts.simple.js
|
Apache-2.0
|
function Scheduler(ecInstance, api, dataProcessorHandlers, visualHandlers) {
this.ecInstance = ecInstance;
this.api = api;
this.unfinished;
// Fix current processors in case that in some rear cases that
// processors might be registered after echarts instance created.
// Register processors incrementally for a echarts instance is
// not supported by this stream architecture.
var dataProcessorHandlers = this._dataProcessorHandlers = dataProcessorHandlers.slice();
var visualHandlers = this._visualHandlers = visualHandlers.slice();
this._allHandlers = dataProcessorHandlers.concat(visualHandlers);
/**
* @private
* @type {
* [handlerUID: string]: {
* seriesTaskMap?: {
* [seriesUID: string]: Task
* },
* overallTask?: Task
* }
* }
*/
this._stageTaskMap = createHashMap();
}
|
Current, progressive rendering starts from visual and layout.
Always detect render mode in the same stage, avoiding that incorrect
detection caused by data filtering.
Caution:
`updateStreamModes` use `seriesModel.getData()`.
|
Scheduler
|
javascript
|
douyu/juno
|
assets/public/js/echarts/v4.7.0/echarts.simple.js
|
https://github.com/douyu/juno/blob/master/assets/public/js/echarts/v4.7.0/echarts.simple.js
|
Apache-2.0
|
function performStageTasks(scheduler, stageHandlers, ecModel, payload, opt) {
opt = opt || {};
var unfinished;
each$1(stageHandlers, function (stageHandler, idx) {
if (opt.visualType && opt.visualType !== stageHandler.visualType) {
return;
}
var stageHandlerRecord = scheduler._stageTaskMap.get(stageHandler.uid);
var seriesTaskMap = stageHandlerRecord.seriesTaskMap;
var overallTask = stageHandlerRecord.overallTask;
if (overallTask) {
var overallNeedDirty;
var agentStubMap = overallTask.agentStubMap;
agentStubMap.each(function (stub) {
if (needSetDirty(opt, stub)) {
stub.dirty();
overallNeedDirty = true;
}
});
overallNeedDirty && overallTask.dirty();
updatePayload(overallTask, payload);
var performArgs = scheduler.getPerformArgs(overallTask, opt.block);
// Execute stubs firstly, which may set the overall task dirty,
// then execute the overall task. And stub will call seriesModel.setData,
// which ensures that in the overallTask seriesModel.getData() will not
// return incorrect data.
agentStubMap.each(function (stub) {
stub.perform(performArgs);
});
unfinished |= overallTask.perform(performArgs);
}
else if (seriesTaskMap) {
seriesTaskMap.each(function (task, pipelineId) {
if (needSetDirty(opt, task)) {
task.dirty();
}
var performArgs = scheduler.getPerformArgs(task, opt.block);
// FIXME
// if intending to decalare `performRawSeries` in handlers, only
// stream-independent (specifically, data item independent) operations can be
// performed. Because is a series is filtered, most of the tasks will not
// be performed. A stream-dependent operation probably cause wrong biz logic.
// Perhaps we should not provide a separate callback for this case instead
// of providing the config `performRawSeries`. The stream-dependent operaions
// and stream-independent operations should better not be mixed.
performArgs.skip = !stageHandler.performRawSeries
&& ecModel.isSeriesFiltered(task.context.model);
updatePayload(task, payload);
unfinished |= task.perform(performArgs);
});
}
});
function needSetDirty(opt, task) {
return opt.setDirty && (!opt.dirtyMap || opt.dirtyMap.get(task.__pipeline.id));
}
scheduler.unfinished |= unfinished;
}
|
Current, progressive rendering starts from visual and layout.
Always detect render mode in the same stage, avoiding that incorrect
detection caused by data filtering.
Caution:
`updateStreamModes` use `seriesModel.getData()`.
|
performStageTasks
|
javascript
|
douyu/juno
|
assets/public/js/echarts/v4.7.0/echarts.simple.js
|
https://github.com/douyu/juno/blob/master/assets/public/js/echarts/v4.7.0/echarts.simple.js
|
Apache-2.0
|
function needSetDirty(opt, task) {
return opt.setDirty && (!opt.dirtyMap || opt.dirtyMap.get(task.__pipeline.id));
}
|
Current, progressive rendering starts from visual and layout.
Always detect render mode in the same stage, avoiding that incorrect
detection caused by data filtering.
Caution:
`updateStreamModes` use `seriesModel.getData()`.
|
needSetDirty
|
javascript
|
douyu/juno
|
assets/public/js/echarts/v4.7.0/echarts.simple.js
|
https://github.com/douyu/juno/blob/master/assets/public/js/echarts/v4.7.0/echarts.simple.js
|
Apache-2.0
|
function createSeriesStageTask(scheduler, stageHandler, stageHandlerRecord, ecModel, api) {
var seriesTaskMap = stageHandlerRecord.seriesTaskMap
|| (stageHandlerRecord.seriesTaskMap = createHashMap());
var seriesType = stageHandler.seriesType;
var getTargetSeries = stageHandler.getTargetSeries;
// If a stageHandler should cover all series, `createOnAllSeries` should be declared mandatorily,
// to avoid some typo or abuse. Otherwise if an extension do not specify a `seriesType`,
// it works but it may cause other irrelevant charts blocked.
if (stageHandler.createOnAllSeries) {
ecModel.eachRawSeries(create);
}
else if (seriesType) {
ecModel.eachRawSeriesByType(seriesType, create);
}
else if (getTargetSeries) {
getTargetSeries(ecModel, api).each(create);
}
function create(seriesModel) {
var pipelineId = seriesModel.uid;
// Init tasks for each seriesModel only once.
// Reuse original task instance.
var task = seriesTaskMap.get(pipelineId)
|| seriesTaskMap.set(pipelineId, createTask({
plan: seriesTaskPlan,
reset: seriesTaskReset,
count: seriesTaskCount
}));
task.context = {
model: seriesModel,
ecModel: ecModel,
api: api,
useClearVisual: stageHandler.isVisual && !stageHandler.isLayout,
plan: stageHandler.plan,
reset: stageHandler.reset,
scheduler: scheduler
};
pipe(scheduler, seriesModel, task);
}
// Clear unused series tasks.
var pipelineMap = scheduler._pipelineMap;
seriesTaskMap.each(function (task, pipelineId) {
if (!pipelineMap.get(pipelineId)) {
task.dispose();
seriesTaskMap.removeKey(pipelineId);
}
});
}
|
Current, progressive rendering starts from visual and layout.
Always detect render mode in the same stage, avoiding that incorrect
detection caused by data filtering.
Caution:
`updateStreamModes` use `seriesModel.getData()`.
|
createSeriesStageTask
|
javascript
|
douyu/juno
|
assets/public/js/echarts/v4.7.0/echarts.simple.js
|
https://github.com/douyu/juno/blob/master/assets/public/js/echarts/v4.7.0/echarts.simple.js
|
Apache-2.0
|
function create(seriesModel) {
var pipelineId = seriesModel.uid;
// Init tasks for each seriesModel only once.
// Reuse original task instance.
var task = seriesTaskMap.get(pipelineId)
|| seriesTaskMap.set(pipelineId, createTask({
plan: seriesTaskPlan,
reset: seriesTaskReset,
count: seriesTaskCount
}));
task.context = {
model: seriesModel,
ecModel: ecModel,
api: api,
useClearVisual: stageHandler.isVisual && !stageHandler.isLayout,
plan: stageHandler.plan,
reset: stageHandler.reset,
scheduler: scheduler
};
pipe(scheduler, seriesModel, task);
}
|
Current, progressive rendering starts from visual and layout.
Always detect render mode in the same stage, avoiding that incorrect
detection caused by data filtering.
Caution:
`updateStreamModes` use `seriesModel.getData()`.
|
create
|
javascript
|
douyu/juno
|
assets/public/js/echarts/v4.7.0/echarts.simple.js
|
https://github.com/douyu/juno/blob/master/assets/public/js/echarts/v4.7.0/echarts.simple.js
|
Apache-2.0
|
function createOverallStageTask(scheduler, stageHandler, stageHandlerRecord, ecModel, api) {
var overallTask = stageHandlerRecord.overallTask = stageHandlerRecord.overallTask
// For overall task, the function only be called on reset stage.
|| createTask({reset: overallTaskReset});
overallTask.context = {
ecModel: ecModel,
api: api,
overallReset: stageHandler.overallReset,
scheduler: scheduler
};
// Reuse orignal stubs.
var agentStubMap = overallTask.agentStubMap = overallTask.agentStubMap || createHashMap();
var seriesType = stageHandler.seriesType;
var getTargetSeries = stageHandler.getTargetSeries;
var overallProgress = true;
var modifyOutputEnd = stageHandler.modifyOutputEnd;
// An overall task with seriesType detected or has `getTargetSeries`, we add
// stub in each pipelines, it will set the overall task dirty when the pipeline
// progress. Moreover, to avoid call the overall task each frame (too frequent),
// we set the pipeline block.
if (seriesType) {
ecModel.eachRawSeriesByType(seriesType, createStub);
}
else if (getTargetSeries) {
getTargetSeries(ecModel, api).each(createStub);
}
// Otherwise, (usually it is legancy case), the overall task will only be
// executed when upstream dirty. Otherwise the progressive rendering of all
// pipelines will be disabled unexpectedly. But it still needs stubs to receive
// dirty info from upsteam.
else {
overallProgress = false;
each$1(ecModel.getSeries(), createStub);
}
function createStub(seriesModel) {
var pipelineId = seriesModel.uid;
var stub = agentStubMap.get(pipelineId);
if (!stub) {
stub = agentStubMap.set(pipelineId, createTask(
{reset: stubReset, onDirty: stubOnDirty}
));
// When the result of `getTargetSeries` changed, the overallTask
// should be set as dirty and re-performed.
overallTask.dirty();
}
stub.context = {
model: seriesModel,
overallProgress: overallProgress,
modifyOutputEnd: modifyOutputEnd
};
stub.agent = overallTask;
stub.__block = overallProgress;
pipe(scheduler, seriesModel, stub);
}
// Clear unused stubs.
var pipelineMap = scheduler._pipelineMap;
agentStubMap.each(function (stub, pipelineId) {
if (!pipelineMap.get(pipelineId)) {
stub.dispose();
// When the result of `getTargetSeries` changed, the overallTask
// should be set as dirty and re-performed.
overallTask.dirty();
agentStubMap.removeKey(pipelineId);
}
});
}
|
Only some legacy stage handlers (usually in echarts extensions) are pure function.
To ensure that they can work normally, they should work in block mode, that is,
they should not be started util the previous tasks finished. So they cause the
progressive rendering disabled. We try to detect the series type, to narrow down
the block range to only the series type they concern, but not all series.
|
createOverallStageTask
|
javascript
|
douyu/juno
|
assets/public/js/echarts/v4.7.0/echarts.simple.js
|
https://github.com/douyu/juno/blob/master/assets/public/js/echarts/v4.7.0/echarts.simple.js
|
Apache-2.0
|
function createStub(seriesModel) {
var pipelineId = seriesModel.uid;
var stub = agentStubMap.get(pipelineId);
if (!stub) {
stub = agentStubMap.set(pipelineId, createTask(
{reset: stubReset, onDirty: stubOnDirty}
));
// When the result of `getTargetSeries` changed, the overallTask
// should be set as dirty and re-performed.
overallTask.dirty();
}
stub.context = {
model: seriesModel,
overallProgress: overallProgress,
modifyOutputEnd: modifyOutputEnd
};
stub.agent = overallTask;
stub.__block = overallProgress;
pipe(scheduler, seriesModel, stub);
}
|
Only some legacy stage handlers (usually in echarts extensions) are pure function.
To ensure that they can work normally, they should work in block mode, that is,
they should not be started util the previous tasks finished. So they cause the
progressive rendering disabled. We try to detect the series type, to narrow down
the block range to only the series type they concern, but not all series.
|
createStub
|
javascript
|
douyu/juno
|
assets/public/js/echarts/v4.7.0/echarts.simple.js
|
https://github.com/douyu/juno/blob/master/assets/public/js/echarts/v4.7.0/echarts.simple.js
|
Apache-2.0
|
function overallTaskReset(context) {
context.overallReset(
context.ecModel, context.api, context.payload
);
}
|
Only some legacy stage handlers (usually in echarts extensions) are pure function.
To ensure that they can work normally, they should work in block mode, that is,
they should not be started util the previous tasks finished. So they cause the
progressive rendering disabled. We try to detect the series type, to narrow down
the block range to only the series type they concern, but not all series.
|
overallTaskReset
|
javascript
|
douyu/juno
|
assets/public/js/echarts/v4.7.0/echarts.simple.js
|
https://github.com/douyu/juno/blob/master/assets/public/js/echarts/v4.7.0/echarts.simple.js
|
Apache-2.0
|
function stubReset(context, upstreamContext) {
return context.overallProgress && stubProgress;
}
|
Only some legacy stage handlers (usually in echarts extensions) are pure function.
To ensure that they can work normally, they should work in block mode, that is,
they should not be started util the previous tasks finished. So they cause the
progressive rendering disabled. We try to detect the series type, to narrow down
the block range to only the series type they concern, but not all series.
|
stubReset
|
javascript
|
douyu/juno
|
assets/public/js/echarts/v4.7.0/echarts.simple.js
|
https://github.com/douyu/juno/blob/master/assets/public/js/echarts/v4.7.0/echarts.simple.js
|
Apache-2.0
|
function stubProgress() {
this.agent.dirty();
this.getDownstream().dirty();
}
|
Only some legacy stage handlers (usually in echarts extensions) are pure function.
To ensure that they can work normally, they should work in block mode, that is,
they should not be started util the previous tasks finished. So they cause the
progressive rendering disabled. We try to detect the series type, to narrow down
the block range to only the series type they concern, but not all series.
|
stubProgress
|
javascript
|
douyu/juno
|
assets/public/js/echarts/v4.7.0/echarts.simple.js
|
https://github.com/douyu/juno/blob/master/assets/public/js/echarts/v4.7.0/echarts.simple.js
|
Apache-2.0
|
function stubOnDirty() {
this.agent && this.agent.dirty();
}
|
Only some legacy stage handlers (usually in echarts extensions) are pure function.
To ensure that they can work normally, they should work in block mode, that is,
they should not be started util the previous tasks finished. So they cause the
progressive rendering disabled. We try to detect the series type, to narrow down
the block range to only the series type they concern, but not all series.
|
stubOnDirty
|
javascript
|
douyu/juno
|
assets/public/js/echarts/v4.7.0/echarts.simple.js
|
https://github.com/douyu/juno/blob/master/assets/public/js/echarts/v4.7.0/echarts.simple.js
|
Apache-2.0
|
function seriesTaskPlan(context) {
return context.plan && context.plan(
context.model, context.ecModel, context.api, context.payload
);
}
|
Only some legacy stage handlers (usually in echarts extensions) are pure function.
To ensure that they can work normally, they should work in block mode, that is,
they should not be started util the previous tasks finished. So they cause the
progressive rendering disabled. We try to detect the series type, to narrow down
the block range to only the series type they concern, but not all series.
|
seriesTaskPlan
|
javascript
|
douyu/juno
|
assets/public/js/echarts/v4.7.0/echarts.simple.js
|
https://github.com/douyu/juno/blob/master/assets/public/js/echarts/v4.7.0/echarts.simple.js
|
Apache-2.0
|
function seriesTaskReset(context) {
if (context.useClearVisual) {
context.data.clearAllVisual();
}
var resetDefines = context.resetDefines = normalizeToArray(context.reset(
context.model, context.ecModel, context.api, context.payload
));
return resetDefines.length > 1
? map(resetDefines, function (v, idx) {
return makeSeriesTaskProgress(idx);
})
: singleSeriesTaskProgress;
}
|
Only some legacy stage handlers (usually in echarts extensions) are pure function.
To ensure that they can work normally, they should work in block mode, that is,
they should not be started util the previous tasks finished. So they cause the
progressive rendering disabled. We try to detect the series type, to narrow down
the block range to only the series type they concern, but not all series.
|
seriesTaskReset
|
javascript
|
douyu/juno
|
assets/public/js/echarts/v4.7.0/echarts.simple.js
|
https://github.com/douyu/juno/blob/master/assets/public/js/echarts/v4.7.0/echarts.simple.js
|
Apache-2.0
|
function makeSeriesTaskProgress(resetDefineIdx) {
return function (params, context) {
var data = context.data;
var resetDefine = context.resetDefines[resetDefineIdx];
if (resetDefine && resetDefine.dataEach) {
for (var i = params.start; i < params.end; i++) {
resetDefine.dataEach(data, i);
}
}
else if (resetDefine && resetDefine.progress) {
resetDefine.progress(params, data);
}
};
}
|
Only some legacy stage handlers (usually in echarts extensions) are pure function.
To ensure that they can work normally, they should work in block mode, that is,
they should not be started util the previous tasks finished. So they cause the
progressive rendering disabled. We try to detect the series type, to narrow down
the block range to only the series type they concern, but not all series.
|
makeSeriesTaskProgress
|
javascript
|
douyu/juno
|
assets/public/js/echarts/v4.7.0/echarts.simple.js
|
https://github.com/douyu/juno/blob/master/assets/public/js/echarts/v4.7.0/echarts.simple.js
|
Apache-2.0
|
function seriesTaskCount(context) {
return context.data.count();
}
|
Only some legacy stage handlers (usually in echarts extensions) are pure function.
To ensure that they can work normally, they should work in block mode, that is,
they should not be started util the previous tasks finished. So they cause the
progressive rendering disabled. We try to detect the series type, to narrow down
the block range to only the series type they concern, but not all series.
|
seriesTaskCount
|
javascript
|
douyu/juno
|
assets/public/js/echarts/v4.7.0/echarts.simple.js
|
https://github.com/douyu/juno/blob/master/assets/public/js/echarts/v4.7.0/echarts.simple.js
|
Apache-2.0
|
function pipe(scheduler, seriesModel, task) {
var pipelineId = seriesModel.uid;
var pipeline = scheduler._pipelineMap.get(pipelineId);
!pipeline.head && (pipeline.head = task);
pipeline.tail && pipeline.tail.pipe(task);
pipeline.tail = task;
task.__idxInPipeline = pipeline.count++;
task.__pipeline = pipeline;
}
|
Only some legacy stage handlers (usually in echarts extensions) are pure function.
To ensure that they can work normally, they should work in block mode, that is,
they should not be started util the previous tasks finished. So they cause the
progressive rendering disabled. We try to detect the series type, to narrow down
the block range to only the series type they concern, but not all series.
|
pipe
|
javascript
|
douyu/juno
|
assets/public/js/echarts/v4.7.0/echarts.simple.js
|
https://github.com/douyu/juno/blob/master/assets/public/js/echarts/v4.7.0/echarts.simple.js
|
Apache-2.0
|
function detectSeriseType(legacyFunc) {
seriesType = null;
try {
// Assume there is no async when calling `eachSeriesByType`.
legacyFunc(ecModelMock, apiMock);
}
catch (e) {
}
return seriesType;
}
|
Only some legacy stage handlers (usually in echarts extensions) are pure function.
To ensure that they can work normally, they should work in block mode, that is,
they should not be started util the previous tasks finished. So they cause the
progressive rendering disabled. We try to detect the series type, to narrow down
the block range to only the series type they concern, but not all series.
|
detectSeriseType
|
javascript
|
douyu/juno
|
assets/public/js/echarts/v4.7.0/echarts.simple.js
|
https://github.com/douyu/juno/blob/master/assets/public/js/echarts/v4.7.0/echarts.simple.js
|
Apache-2.0
|
function mockMethods(target, Clz) {
/* eslint-disable */
for (var name in Clz.prototype) {
// Do not use hasOwnProperty
target[name] = noop;
}
/* eslint-enable */
}
|
Only some legacy stage handlers (usually in echarts extensions) are pure function.
To ensure that they can work normally, they should work in block mode, that is,
they should not be started util the previous tasks finished. So they cause the
progressive rendering disabled. We try to detect the series type, to narrow down
the block range to only the series type they concern, but not all series.
|
mockMethods
|
javascript
|
douyu/juno
|
assets/public/js/echarts/v4.7.0/echarts.simple.js
|
https://github.com/douyu/juno/blob/master/assets/public/js/echarts/v4.7.0/echarts.simple.js
|
Apache-2.0
|
axisCommon = function () {
return {
axisLine: {
lineStyle: {
color: contrastColor
}
},
axisTick: {
lineStyle: {
color: contrastColor
}
},
axisLabel: {
textStyle: {
color: contrastColor
}
},
splitLine: {
lineStyle: {
type: 'dashed',
color: '#aaa'
}
},
splitArea: {
areaStyle: {
color: contrastColor
}
}
};
}
|
For big svg string, this method might be time consuming.
@param {string} svg xml string
@return {Object} xml root.
|
axisCommon
|
javascript
|
douyu/juno
|
assets/public/js/echarts/v4.7.0/echarts.simple.js
|
https://github.com/douyu/juno/blob/master/assets/public/js/echarts/v4.7.0/echarts.simple.js
|
Apache-2.0
|
function parseXML(svg) {
if (isString(svg)) {
var parser = new DOMParser();
svg = parser.parseFromString(svg, 'text/xml');
}
// Document node. If using $.get, doc node may be input.
if (svg.nodeType === 9) {
svg = svg.firstChild;
}
// nodeName of <!DOCTYPE svg> is also 'svg'.
while (svg.nodeName.toLowerCase() !== 'svg' || svg.nodeType !== 1) {
svg = svg.nextSibling;
}
return svg;
}
|
For big svg string, this method might be time consuming.
@param {string} svg xml string
@return {Object} xml root.
|
parseXML
|
javascript
|
douyu/juno
|
assets/public/js/echarts/v4.7.0/echarts.simple.js
|
https://github.com/douyu/juno/blob/master/assets/public/js/echarts/v4.7.0/echarts.simple.js
|
Apache-2.0
|
function SVGParser() {
this._defs = {};
this._root = null;
this._isDefine = false;
this._isText = false;
}
|
For big svg string, this method might be time consuming.
@param {string} svg xml string
@return {Object} xml root.
|
SVGParser
|
javascript
|
douyu/juno
|
assets/public/js/echarts/v4.7.0/echarts.simple.js
|
https://github.com/douyu/juno/blob/master/assets/public/js/echarts/v4.7.0/echarts.simple.js
|
Apache-2.0
|
function _parseGradientColorStops(xmlNode, gradient) {
var stop = xmlNode.firstChild;
while (stop) {
if (stop.nodeType === 1) {
var offset = stop.getAttribute('offset');
if (offset.indexOf('%') > 0) { // percentage
offset = parseInt(offset, 10) / 100;
}
else if (offset) { // number from 0 to 1
offset = parseFloat(offset);
}
else {
offset = 0;
}
var stopColor = stop.getAttribute('stop-color') || '#000000';
gradient.addColorStop(offset, stopColor);
}
stop = stop.nextSibling;
}
}
|
For big svg string, this method might be time consuming.
@param {string} svg xml string
@return {Object} xml root.
|
_parseGradientColorStops
|
javascript
|
douyu/juno
|
assets/public/js/echarts/v4.7.0/echarts.simple.js
|
https://github.com/douyu/juno/blob/master/assets/public/js/echarts/v4.7.0/echarts.simple.js
|
Apache-2.0
|
function inheritStyle(parent, child) {
if (parent && parent.__inheritedStyle) {
if (!child.__inheritedStyle) {
child.__inheritedStyle = {};
}
defaults(child.__inheritedStyle, parent.__inheritedStyle);
}
}
|
For big svg string, this method might be time consuming.
@param {string} svg xml string
@return {Object} xml root.
|
inheritStyle
|
javascript
|
douyu/juno
|
assets/public/js/echarts/v4.7.0/echarts.simple.js
|
https://github.com/douyu/juno/blob/master/assets/public/js/echarts/v4.7.0/echarts.simple.js
|
Apache-2.0
|
function parsePoints(pointsString) {
var list = trim(pointsString).split(DILIMITER_REG);
var points = [];
for (var i = 0; i < list.length; i += 2) {
var x = parseFloat(list[i]);
var y = parseFloat(list[i + 1]);
points.push([x, y]);
}
return points;
}
|
For big svg string, this method might be time consuming.
@param {string} svg xml string
@return {Object} xml root.
|
parsePoints
|
javascript
|
douyu/juno
|
assets/public/js/echarts/v4.7.0/echarts.simple.js
|
https://github.com/douyu/juno/blob/master/assets/public/js/echarts/v4.7.0/echarts.simple.js
|
Apache-2.0
|
function parseAttributes(xmlNode, el, defs, onlyInlineStyle) {
var zrStyle = el.__inheritedStyle || {};
var isTextEl = el.type === 'text';
// TODO Shadow
if (xmlNode.nodeType === 1) {
parseTransformAttribute(xmlNode, el);
extend(zrStyle, parseStyleAttribute(xmlNode));
if (!onlyInlineStyle) {
for (var svgAttrName in attributesMap) {
if (attributesMap.hasOwnProperty(svgAttrName)) {
var attrValue = xmlNode.getAttribute(svgAttrName);
if (attrValue != null) {
zrStyle[attributesMap[svgAttrName]] = attrValue;
}
}
}
}
}
var elFillProp = isTextEl ? 'textFill' : 'fill';
var elStrokeProp = isTextEl ? 'textStroke' : 'stroke';
el.style = el.style || new Style();
var elStyle = el.style;
zrStyle.fill != null && elStyle.set(elFillProp, getPaint(zrStyle.fill, defs));
zrStyle.stroke != null && elStyle.set(elStrokeProp, getPaint(zrStyle.stroke, defs));
each$1([
'lineWidth', 'opacity', 'fillOpacity', 'strokeOpacity', 'miterLimit', 'fontSize'
], function (propName) {
var elPropName = (propName === 'lineWidth' && isTextEl) ? 'textStrokeWidth' : propName;
zrStyle[propName] != null && elStyle.set(elPropName, parseFloat(zrStyle[propName]));
});
if (!zrStyle.textBaseline || zrStyle.textBaseline === 'auto') {
zrStyle.textBaseline = 'alphabetic';
}
if (zrStyle.textBaseline === 'alphabetic') {
zrStyle.textBaseline = 'bottom';
}
if (zrStyle.textAlign === 'start') {
zrStyle.textAlign = 'left';
}
if (zrStyle.textAlign === 'end') {
zrStyle.textAlign = 'right';
}
each$1(['lineDashOffset', 'lineCap', 'lineJoin',
'fontWeight', 'fontFamily', 'fontStyle', 'textAlign', 'textBaseline'
], function (propName) {
zrStyle[propName] != null && elStyle.set(propName, zrStyle[propName]);
});
if (zrStyle.lineDash) {
el.style.lineDash = trim(zrStyle.lineDash).split(DILIMITER_REG);
}
if (elStyle[elStrokeProp] && elStyle[elStrokeProp] !== 'none') {
// enable stroke
el[elStrokeProp] = true;
}
el.__inheritedStyle = zrStyle;
}
|
@param {Array.<number>} viewBoxRect
@param {number} width
@param {number} height
@return {Object} {scale, position}
|
parseAttributes
|
javascript
|
douyu/juno
|
assets/public/js/echarts/v4.7.0/echarts.simple.js
|
https://github.com/douyu/juno/blob/master/assets/public/js/echarts/v4.7.0/echarts.simple.js
|
Apache-2.0
|
function getPaint(str, defs) {
// if (str === 'none') {
// return;
// }
var urlMatch = defs && str && str.match(urlRegex);
if (urlMatch) {
var url = trim(urlMatch[1]);
var def = defs[url];
return def;
}
return str;
}
|
@param {string|XMLElement} xml
@param {Object} [opt]
@param {number} [opt.width] Default width if svg width not specified or is a percent value.
@param {number} [opt.height] Default height if svg height not specified or is a percent value.
@param {boolean} [opt.ignoreViewBox]
@param {boolean} [opt.ignoreRootClip]
@return {Object} result:
{
root: Group, The root of the the result tree of zrender shapes,
width: number, the viewport width of the SVG,
height: number, the viewport height of the SVG,
viewBoxRect: {x, y, width, height}, the declared viewBox rect of the SVG, if exists,
viewBoxTransform: the {scale, position} calculated by viewBox and viewport, is exists.
}
|
getPaint
|
javascript
|
douyu/juno
|
assets/public/js/echarts/v4.7.0/echarts.simple.js
|
https://github.com/douyu/juno/blob/master/assets/public/js/echarts/v4.7.0/echarts.simple.js
|
Apache-2.0
|
function parseTransformAttribute(xmlNode, node) {
var transform = xmlNode.getAttribute('transform');
if (transform) {
transform = transform.replace(/,/g, ' ');
var m = null;
var transformOps = [];
transform.replace(transformRegex, function (str, type, value) {
transformOps.push(type, value);
});
for (var i = transformOps.length - 1; i > 0; i -= 2) {
var value = transformOps[i];
var type = transformOps[i - 1];
m = m || create$1();
switch (type) {
case 'translate':
value = trim(value).split(DILIMITER_REG);
translate(m, m, [parseFloat(value[0]), parseFloat(value[1] || 0)]);
break;
case 'scale':
value = trim(value).split(DILIMITER_REG);
scale$1(m, m, [parseFloat(value[0]), parseFloat(value[1] || value[0])]);
break;
case 'rotate':
value = trim(value).split(DILIMITER_REG);
rotate(m, m, parseFloat(value[0]));
break;
case 'skew':
value = trim(value).split(DILIMITER_REG);
console.warn('Skew transform is not supported yet');
break;
case 'matrix':
var value = trim(value).split(DILIMITER_REG);
m[0] = parseFloat(value[0]);
m[1] = parseFloat(value[1]);
m[2] = parseFloat(value[2]);
m[3] = parseFloat(value[3]);
m[4] = parseFloat(value[4]);
m[5] = parseFloat(value[5]);
break;
}
}
node.setLocalTransform(m);
}
}
|
@param {string|XMLElement} xml
@param {Object} [opt]
@param {number} [opt.width] Default width if svg width not specified or is a percent value.
@param {number} [opt.height] Default height if svg height not specified or is a percent value.
@param {boolean} [opt.ignoreViewBox]
@param {boolean} [opt.ignoreRootClip]
@return {Object} result:
{
root: Group, The root of the the result tree of zrender shapes,
width: number, the viewport width of the SVG,
height: number, the viewport height of the SVG,
viewBoxRect: {x, y, width, height}, the declared viewBox rect of the SVG, if exists,
viewBoxTransform: the {scale, position} calculated by viewBox and viewport, is exists.
}
|
parseTransformAttribute
|
javascript
|
douyu/juno
|
assets/public/js/echarts/v4.7.0/echarts.simple.js
|
https://github.com/douyu/juno/blob/master/assets/public/js/echarts/v4.7.0/echarts.simple.js
|
Apache-2.0
|
function parseStyleAttribute(xmlNode) {
var style = xmlNode.getAttribute('style');
var result = {};
if (!style) {
return result;
}
var styleList = {};
styleRegex.lastIndex = 0;
var styleRegResult;
while ((styleRegResult = styleRegex.exec(style)) != null) {
styleList[styleRegResult[1]] = styleRegResult[2];
}
for (var svgAttrName in attributesMap) {
if (attributesMap.hasOwnProperty(svgAttrName) && styleList[svgAttrName] != null) {
result[attributesMap[svgAttrName]] = styleList[svgAttrName];
}
}
return result;
}
|
@param {string|XMLElement} xml
@param {Object} [opt]
@param {number} [opt.width] Default width if svg width not specified or is a percent value.
@param {number} [opt.height] Default height if svg height not specified or is a percent value.
@param {boolean} [opt.ignoreViewBox]
@param {boolean} [opt.ignoreRootClip]
@return {Object} result:
{
root: Group, The root of the the result tree of zrender shapes,
width: number, the viewport width of the SVG,
height: number, the viewport height of the SVG,
viewBoxRect: {x, y, width, height}, the declared viewBox rect of the SVG, if exists,
viewBoxTransform: the {scale, position} calculated by viewBox and viewport, is exists.
}
|
parseStyleAttribute
|
javascript
|
douyu/juno
|
assets/public/js/echarts/v4.7.0/echarts.simple.js
|
https://github.com/douyu/juno/blob/master/assets/public/js/echarts/v4.7.0/echarts.simple.js
|
Apache-2.0
|
function makeViewBoxTransform(viewBoxRect, width, height) {
var scaleX = width / viewBoxRect.width;
var scaleY = height / viewBoxRect.height;
var scale = Math.min(scaleX, scaleY);
// preserveAspectRatio 'xMidYMid'
var viewBoxScale = [scale, scale];
var viewBoxPosition = [
-(viewBoxRect.x + viewBoxRect.width / 2) * scale + width / 2,
-(viewBoxRect.y + viewBoxRect.height / 2) * scale + height / 2
];
return {
scale: viewBoxScale,
position: viewBoxPosition
};
}
|
@param {string|XMLElement} xml
@param {Object} [opt]
@param {number} [opt.width] Default width if svg width not specified or is a percent value.
@param {number} [opt.height] Default height if svg height not specified or is a percent value.
@param {boolean} [opt.ignoreViewBox]
@param {boolean} [opt.ignoreRootClip]
@return {Object} result:
{
root: Group, The root of the the result tree of zrender shapes,
width: number, the viewport width of the SVG,
height: number, the viewport height of the SVG,
viewBoxRect: {x, y, width, height}, the declared viewBox rect of the SVG, if exists,
viewBoxTransform: the {scale, position} calculated by viewBox and viewport, is exists.
}
|
makeViewBoxTransform
|
javascript
|
douyu/juno
|
assets/public/js/echarts/v4.7.0/echarts.simple.js
|
https://github.com/douyu/juno/blob/master/assets/public/js/echarts/v4.7.0/echarts.simple.js
|
Apache-2.0
|
function ECharts(dom, theme$$1, opts) {
opts = opts || {};
// Get theme by name
if (typeof theme$$1 === 'string') {
theme$$1 = themeStorage[theme$$1];
}
/**
* @type {string}
*/
this.id;
/**
* Group id
* @type {string}
*/
this.group;
/**
* @type {HTMLElement}
* @private
*/
this._dom = dom;
var defaultRenderer = 'canvas';
if (__DEV__) {
defaultRenderer = (
typeof window === 'undefined' ? global : window
).__ECHARTS__DEFAULT__RENDERER__ || defaultRenderer;
}
/**
* @type {module:zrender/ZRender}
* @private
*/
var zr = this._zr = init$1(dom, {
renderer: opts.renderer || defaultRenderer,
devicePixelRatio: opts.devicePixelRatio,
width: opts.width,
height: opts.height
});
/**
* Expect 60 fps.
* @type {Function}
* @private
*/
this._throttledZrFlush = throttle(bind(zr.flush, zr), 17);
var theme$$1 = clone(theme$$1);
theme$$1 && backwardCompat(theme$$1, true);
/**
* @type {Object}
* @private
*/
this._theme = theme$$1;
/**
* @type {Array.<module:echarts/view/Chart>}
* @private
*/
this._chartsViews = [];
/**
* @type {Object.<string, module:echarts/view/Chart>}
* @private
*/
this._chartsMap = {};
/**
* @type {Array.<module:echarts/view/Component>}
* @private
*/
this._componentsViews = [];
/**
* @type {Object.<string, module:echarts/view/Component>}
* @private
*/
this._componentsMap = {};
/**
* @type {module:echarts/CoordinateSystem}
* @private
*/
this._coordSysMgr = new CoordinateSystemManager();
/**
* @type {module:echarts/ExtensionAPI}
* @private
*/
var api = this._api = createExtensionAPI(this);
// Sort on demand
function prioritySortFunc(a, b) {
return a.__prio - b.__prio;
}
sort(visualFuncs, prioritySortFunc);
sort(dataProcessorFuncs, prioritySortFunc);
/**
* @type {module:echarts/stream/Scheduler}
*/
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 = 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.
setAsPrimitive(this);
}
|
Usage:
chart.setOption(option, notMerge, lazyUpdate);
chart.setOption(option, {
notMerge: ...,
lazyUpdate: ...,
silent: ...
});
@param {Object} option
@param {Object|boolean} [opts] opts or notMerge.
@param {boolean} [opts.notMerge=false]
@param {boolean} [opts.lazyUpdate=false] Useful when setOption frequently.
|
ECharts
|
javascript
|
douyu/juno
|
assets/public/js/echarts/v4.7.0/echarts.simple.js
|
https://github.com/douyu/juno/blob/master/assets/public/js/echarts/v4.7.0/echarts.simple.js
|
Apache-2.0
|
function prioritySortFunc(a, b) {
return a.__prio - b.__prio;
}
|
Get canvas which has all thing rendered
@param {Object} opts
@param {string} [opts.backgroundColor]
@return {string}
|
prioritySortFunc
|
javascript
|
douyu/juno
|
assets/public/js/echarts/v4.7.0/echarts.simple.js
|
https://github.com/douyu/juno/blob/master/assets/public/js/echarts/v4.7.0/echarts.simple.js
|
Apache-2.0
|
function prepare(ecIns) {
var ecModel = ecIns._model;
var scheduler = ecIns._scheduler;
scheduler.restorePipelines(ecModel);
scheduler.prepareStageTasks();
prepareView(ecIns, 'component', ecModel, scheduler);
prepareView(ecIns, 'chart', ecModel, scheduler);
scheduler.plan();
}
|
@pubilc
@param {Object} payload
@param {string} [payload.type] Action type
@param {Object|boolean} [opt] If pass boolean, means opt.silent
@param {boolean} [opt.silent=false] Whether trigger events.
@param {boolean} [opt.flush=undefined]
true: Flush immediately, and then pixel in canvas can be fetched
immediately. Caution: it might affect performance.
false: Not flush.
undefined: Auto decide whether perform flush.
|
prepare
|
javascript
|
douyu/juno
|
assets/public/js/echarts/v4.7.0/echarts.simple.js
|
https://github.com/douyu/juno/blob/master/assets/public/js/echarts/v4.7.0/echarts.simple.js
|
Apache-2.0
|
function updateDirectly(ecIns, method, payload, mainType, subType) {
var ecModel = ecIns._model;
// broadcast
if (!mainType) {
// FIXME
// Chart will not be update directly here, except set dirty.
// But there is no such scenario now.
each(ecIns._componentsViews.concat(ecIns._chartsViews), callView);
return;
}
var query = {};
query[mainType + 'Id'] = payload[mainType + 'Id'];
query[mainType + 'Index'] = payload[mainType + 'Index'];
query[mainType + 'Name'] = payload[mainType + 'Name'];
var condition = {mainType: mainType, query: query};
subType && (condition.subType = subType); // subType may be '' by parseClassType;
var excludeSeriesId = payload.excludeSeriesId;
if (excludeSeriesId != null) {
excludeSeriesId = createHashMap(normalizeToArray(excludeSeriesId));
}
// If dispatchAction before setOption, do nothing.
ecModel && ecModel.eachComponent(condition, function (model) {
if (!excludeSeriesId || excludeSeriesId.get(model.id) == null) {
callView(ecIns[
mainType === 'series' ? '_chartsMap' : '_componentsMap'
][model.__viewId]);
}
}, ecIns);
function callView(view) {
view && view.__alive && view[method] && view[method](
view.__model, ecModel, ecIns._api, payload
);
}
}
|
@pubilc
@param {Object} payload
@param {string} [payload.type] Action type
@param {Object|boolean} [opt] If pass boolean, means opt.silent
@param {boolean} [opt.silent=false] Whether trigger events.
@param {boolean} [opt.flush=undefined]
true: Flush immediately, and then pixel in canvas can be fetched
immediately. Caution: it might affect performance.
false: Not flush.
undefined: Auto decide whether perform flush.
|
updateDirectly
|
javascript
|
douyu/juno
|
assets/public/js/echarts/v4.7.0/echarts.simple.js
|
https://github.com/douyu/juno/blob/master/assets/public/js/echarts/v4.7.0/echarts.simple.js
|
Apache-2.0
|
function callView(view) {
view && view.__alive && view[method] && view[method](
view.__model, ecModel, ecIns._api, payload
);
}
|
@pubilc
@param {Object} payload
@param {string} [payload.type] Action type
@param {Object|boolean} [opt] If pass boolean, means opt.silent
@param {boolean} [opt.silent=false] Whether trigger events.
@param {boolean} [opt.flush=undefined]
true: Flush immediately, and then pixel in canvas can be fetched
immediately. Caution: it might affect performance.
false: Not flush.
undefined: Auto decide whether perform flush.
|
callView
|
javascript
|
douyu/juno
|
assets/public/js/echarts/v4.7.0/echarts.simple.js
|
https://github.com/douyu/juno/blob/master/assets/public/js/echarts/v4.7.0/echarts.simple.js
|
Apache-2.0
|
function updateStreamModes(ecIns, ecModel) {
var chartsMap = ecIns._chartsMap;
var scheduler = ecIns._scheduler;
ecModel.eachSeries(function (seriesModel) {
scheduler.updateStreamModes(seriesModel, chartsMap[seriesModel.__viewId]);
});
}
|
@pubilc
@param {Object} payload
@param {string} [payload.type] Action type
@param {Object|boolean} [opt] If pass boolean, means opt.silent
@param {boolean} [opt.silent=false] Whether trigger events.
@param {boolean} [opt.flush=undefined]
true: Flush immediately, and then pixel in canvas can be fetched
immediately. Caution: it might affect performance.
false: Not flush.
undefined: Auto decide whether perform flush.
|
updateStreamModes
|
javascript
|
douyu/juno
|
assets/public/js/echarts/v4.7.0/echarts.simple.js
|
https://github.com/douyu/juno/blob/master/assets/public/js/echarts/v4.7.0/echarts.simple.js
|
Apache-2.0
|
function doDispatchAction(payload, silent) {
var payloadType = payload.type;
var escapeConnect = payload.escapeConnect;
var actionWrap = actions[payloadType];
var actionInfo = actionWrap.actionInfo;
var cptType = (actionInfo.update || 'update').split(':');
var updateMethod = cptType.pop();
cptType = cptType[0] != null && parseClassType(cptType[0]);
this[IN_MAIN_PROCESS] = true;
var payloads = [payload];
var batched = false;
// Batch action
if (payload.batch) {
batched = true;
payloads = map(payload.batch, function (item) {
item = defaults(extend({}, item), payload);
item.batch = null;
return item;
});
}
var eventObjBatch = [];
var eventObj;
var isHighDown = payloadType === 'highlight' || payloadType === 'downplay';
each(payloads, function (batchItem) {
// Action can specify the event by return it.
eventObj = actionWrap.action(batchItem, this._model, this._api);
// Emit event outside
eventObj = eventObj || extend({}, batchItem);
// Convert type to eventType
eventObj.type = actionInfo.event || eventObj.type;
eventObjBatch.push(eventObj);
// light update does not perform data process, layout and visual.
if (isHighDown) {
// method, payload, mainType, subType
updateDirectly(this, updateMethod, batchItem, 'series');
}
else if (cptType) {
updateDirectly(this, updateMethod, batchItem, cptType.main, cptType.sub);
}
}, this);
if (updateMethod !== 'none' && !isHighDown && !cptType) {
// Still dirty
if (this[OPTION_UPDATED]) {
// FIXME Pass payload ?
prepare(this);
updateMethods.update.call(this, payload);
this[OPTION_UPDATED] = false;
}
else {
updateMethods[updateMethod].call(this, payload);
}
}
// Follow the rule of action batch
if (batched) {
eventObj = {
type: actionInfo.event || payloadType,
escapeConnect: escapeConnect,
batch: eventObjBatch
};
}
else {
eventObj = eventObjBatch[0];
}
this[IN_MAIN_PROCESS] = false;
!silent && this._messageCenter.trigger(eventObj.type, eventObj);
}
|
Prepare view instances of charts and components
@param {module:echarts/model/Global} ecModel
@private
|
doDispatchAction
|
javascript
|
douyu/juno
|
assets/public/js/echarts/v4.7.0/echarts.simple.js
|
https://github.com/douyu/juno/blob/master/assets/public/js/echarts/v4.7.0/echarts.simple.js
|
Apache-2.0
|
function flushPendingActions(silent) {
var pendingActions = this._pendingActions;
while (pendingActions.length) {
var payload = pendingActions.shift();
doDispatchAction.call(this, payload, silent);
}
}
|
// * Encode visual infomation from data after data processing
// *
// * @param {module:echarts/model/Global} ecModel
// * @param {object} layout
// * @param {boolean} [layoutFilter] `true`: only layout,
// * `false`: only not layout,
// * `null`/`undefined`: all.
// * @param {string} taskBaseTag
// * @private
//
|
flushPendingActions
|
javascript
|
douyu/juno
|
assets/public/js/echarts/v4.7.0/echarts.simple.js
|
https://github.com/douyu/juno/blob/master/assets/public/js/echarts/v4.7.0/echarts.simple.js
|
Apache-2.0
|
function triggerUpdatedEvent(silent) {
!silent && this.trigger('updated');
}
|
// * Encode visual infomation from data after data processing
// *
// * @param {module:echarts/model/Global} ecModel
// * @param {object} layout
// * @param {boolean} [layoutFilter] `true`: only layout,
// * `false`: only not layout,
// * `null`/`undefined`: all.
// * @param {string} taskBaseTag
// * @private
//
|
triggerUpdatedEvent
|
javascript
|
douyu/juno
|
assets/public/js/echarts/v4.7.0/echarts.simple.js
|
https://github.com/douyu/juno/blob/master/assets/public/js/echarts/v4.7.0/echarts.simple.js
|
Apache-2.0
|
function bindRenderedEvent(zr, ecIns) {
zr.on('rendered', function () {
ecIns.trigger('rendered');
// The `finished` event should not be triggered repeatly,
// so it should only be triggered when rendering indeed happend
// in zrender. (Consider the case that dipatchAction is keep
// triggering when mouse move).
if (
// Although zr is dirty if initial animation is not finished
// and this checking is called on frame, we also check
// animation finished for robustness.
zr.animation.isFinished()
&& !ecIns[OPTION_UPDATED]
&& !ecIns._scheduler.unfinished
&& !ecIns._pendingActions.length
) {
ecIns.trigger('finished');
}
});
}
|
Render each chart and component
@private
|
bindRenderedEvent
|
javascript
|
douyu/juno
|
assets/public/js/echarts/v4.7.0/echarts.simple.js
|
https://github.com/douyu/juno/blob/master/assets/public/js/echarts/v4.7.0/echarts.simple.js
|
Apache-2.0
|
function performPostUpdateFuncs(ecModel, api) {
each(postUpdateFuncs, function (func) {
func(ecModel, api);
});
}
|
Update chart progressive and blend.
@param {module:echarts/model/Series|module:echarts/model/Component} model
@param {module:echarts/view/Component|module:echarts/view/Chart} view
|
performPostUpdateFuncs
|
javascript
|
douyu/juno
|
assets/public/js/echarts/v4.7.0/echarts.simple.js
|
https://github.com/douyu/juno/blob/master/assets/public/js/echarts/v4.7.0/echarts.simple.js
|
Apache-2.0
|
handler = function (e) {
var ecModel = this.getModel();
var el = e.target;
var params;
var isGlobalOut = eveName === 'globalout';
// no e.target when 'globalout'.
if (isGlobalOut) {
params = {};
}
else if (el && el.dataIndex != null) {
var dataModel = el.dataModel || ecModel.getSeriesByIndex(el.seriesIndex);
params = dataModel && dataModel.getDataParams(el.dataIndex, el.dataType, el) || {};
}
// If element has custom eventData of components
else if (el && el.eventData) {
params = extend({}, el.eventData);
}
// Contract: if params prepared in mouse event,
// these properties must be specified:
// {
// componentType: string (component main type)
// componentIndex: number
// }
// Otherwise event query can not work.
if (params) {
var componentType = params.componentType;
var componentIndex = params.componentIndex;
// Special handling for historic reason: when trigger by
// markLine/markPoint/markArea, the componentType is
// 'markLine'/'markPoint'/'markArea', but we should better
// enable them to be queried by seriesIndex, since their
// option is set in each series.
if (componentType === 'markLine'
|| componentType === 'markPoint'
|| componentType === 'markArea'
) {
componentType = 'series';
componentIndex = params.seriesIndex;
}
var model = componentType && componentIndex != null
&& ecModel.getComponent(componentType, componentIndex);
var view = model && this[
model.mainType === 'series' ? '_chartsMap' : '_componentsMap'
][model.__viewId];
if (__DEV__) {
// `event.componentType` and `event[componentTpype + 'Index']` must not
// be missed, otherwise there is no way to distinguish source component.
// See `dataFormat.getDataParams`.
if (!isGlobalOut && !(model && view)) {
console.warn('model or view can not be found by params');
}
}
params.event = e;
params.type = eveName;
this._ecEventProcessor.eventInfo = {
targetEl: el,
packedEvent: params,
model: model,
view: view
};
this.trigger(eveName, params);
}
}
|
Update chart progressive and blend.
@param {module:echarts/model/Series|module:echarts/model/Component} model
@param {module:echarts/view/Component|module:echarts/view/Chart} view
|
handler
|
javascript
|
douyu/juno
|
assets/public/js/echarts/v4.7.0/echarts.simple.js
|
https://github.com/douyu/juno/blob/master/assets/public/js/echarts/v4.7.0/echarts.simple.js
|
Apache-2.0
|
function disposedWarning(id) {
if (__DEV__) {
console.warn('Instance ' + id + ' has been disposed');
}
}
|
@class
Usage of query:
`chart.on('click', query, handler);`
The `query` can be:
+ The component type query string, only `mainType` or `mainType.subType`,
like: 'xAxis', 'series', 'xAxis.category' or 'series.line'.
+ The component query object, like:
`{seriesIndex: 2}`, `{seriesName: 'xx'}`, `{seriesId: 'some'}`,
`{xAxisIndex: 2}`, `{xAxisName: 'xx'}`, `{xAxisId: 'some'}`.
+ The data query object, like:
`{dataIndex: 123}`, `{dataType: 'link'}`, `{name: 'some'}`.
+ The other query object (cmponent customized query), like:
`{element: 'some'}` (only available in custom series).
Caveat: If a prop in the `query` object is `null/undefined`, it is the
same as there is no such prop in the `query` object.
|
disposedWarning
|
javascript
|
douyu/juno
|
assets/public/js/echarts/v4.7.0/echarts.simple.js
|
https://github.com/douyu/juno/blob/master/assets/public/js/echarts/v4.7.0/echarts.simple.js
|
Apache-2.0
|
function updateHoverLayerStatus(ecIns, ecModel) {
var zr = ecIns._zr;
var storage = zr.storage;
var elCount = 0;
storage.traverse(function (el) {
elCount++;
});
if (elCount > ecModel.get('hoverLayerThreshold') && !env$1.node) {
ecModel.eachSeries(function (seriesModel) {
if (seriesModel.preventUsingHoverLayer) {
return;
}
var chartView = ecIns._chartsMap[seriesModel.__viewId];
if (chartView.__alive) {
chartView.group.traverse(function (el) {
// Don't switch back.
el.useHoverLayer = true;
});
}
});
}
}
|
@class
Usage of query:
`chart.on('click', query, handler);`
The `query` can be:
+ The component type query string, only `mainType` or `mainType.subType`,
like: 'xAxis', 'series', 'xAxis.category' or 'series.line'.
+ The component query object, like:
`{seriesIndex: 2}`, `{seriesName: 'xx'}`, `{seriesId: 'some'}`,
`{xAxisIndex: 2}`, `{xAxisName: 'xx'}`, `{xAxisId: 'some'}`.
+ The data query object, like:
`{dataIndex: 123}`, `{dataType: 'link'}`, `{name: 'some'}`.
+ The other query object (cmponent customized query), like:
`{element: 'some'}` (only available in custom series).
Caveat: If a prop in the `query` object is `null/undefined`, it is the
same as there is no such prop in the `query` object.
|
updateHoverLayerStatus
|
javascript
|
douyu/juno
|
assets/public/js/echarts/v4.7.0/echarts.simple.js
|
https://github.com/douyu/juno/blob/master/assets/public/js/echarts/v4.7.0/echarts.simple.js
|
Apache-2.0
|
function updateBlend(seriesModel, chartView) {
var blendMode = seriesModel.get('blendMode') || null;
if (__DEV__) {
if (!env$1.canvasSupported && blendMode && blendMode !== 'source-over') {
console.warn('Only canvas support blendMode');
}
}
chartView.group.traverse(function (el) {
// FIXME marker and other components
if (!el.isGroup) {
// Only set if blendMode is changed. In case element is incremental and don't wan't to rerender.
if (el.style.blend !== blendMode) {
el.setStyle('blend', blendMode);
}
}
if (el.eachPendingDisplayable) {
el.eachPendingDisplayable(function (displayable) {
displayable.setStyle('blend', blendMode);
});
}
});
}
|
@class
Usage of query:
`chart.on('click', query, handler);`
The `query` can be:
+ The component type query string, only `mainType` or `mainType.subType`,
like: 'xAxis', 'series', 'xAxis.category' or 'series.line'.
+ The component query object, like:
`{seriesIndex: 2}`, `{seriesName: 'xx'}`, `{seriesId: 'some'}`,
`{xAxisIndex: 2}`, `{xAxisName: 'xx'}`, `{xAxisId: 'some'}`.
+ The data query object, like:
`{dataIndex: 123}`, `{dataType: 'link'}`, `{name: 'some'}`.
+ The other query object (cmponent customized query), like:
`{element: 'some'}` (only available in custom series).
Caveat: If a prop in the `query` object is `null/undefined`, it is the
same as there is no such prop in the `query` object.
|
updateBlend
|
javascript
|
douyu/juno
|
assets/public/js/echarts/v4.7.0/echarts.simple.js
|
https://github.com/douyu/juno/blob/master/assets/public/js/echarts/v4.7.0/echarts.simple.js
|
Apache-2.0
|
function check(query, host, prop, propOnHost) {
return query[prop] == null || host[propOnHost || prop] === query[prop];
}
|
@param {HTMLElement} dom
@return {echarts~ECharts}
|
check
|
javascript
|
douyu/juno
|
assets/public/js/echarts/v4.7.0/echarts.simple.js
|
https://github.com/douyu/juno/blob/master/assets/public/js/echarts/v4.7.0/echarts.simple.js
|
Apache-2.0
|
function updateConnectedChartsStatus(charts, status) {
for (var i = 0; i < charts.length; i++) {
var otherChart = charts[i];
otherChart[STATUS_KEY] = status;
}
}
|
Usage:
registerAction('someAction', 'someEvent', function () { ... });
registerAction('someAction', function () { ... });
registerAction(
{type: 'someAction', event: 'someEvent', update: 'updateView'},
function () { ... }
);
@param {(string|Object)} actionInfo
@param {string} actionInfo.type
@param {string} [actionInfo.event]
@param {string} [actionInfo.update]
@param {string} [eventName]
@param {Function} action
|
updateConnectedChartsStatus
|
javascript
|
douyu/juno
|
assets/public/js/echarts/v4.7.0/echarts.simple.js
|
https://github.com/douyu/juno/blob/master/assets/public/js/echarts/v4.7.0/echarts.simple.js
|
Apache-2.0
|
function init(dom, theme$$1, opts) {
if (__DEV__) {
// Check version
if ((version$1.replace('.', '') - 0) < (dependencies.zrender.replace('.', '') - 0)) {
throw new Error(
'zrender/src ' + version$1
+ ' is too old for ECharts ' + version
+ '. Current version need ZRender '
+ dependencies.zrender + '+'
);
}
if (!dom) {
throw new Error('Initialize failed: invalid dom.');
}
}
var existInstance = getInstanceByDom(dom);
if (existInstance) {
if (__DEV__) {
console.warn('There is a chart instance already initialized on the dom.');
}
return existInstance;
}
if (__DEV__) {
if (isDom(dom)
&& dom.nodeName.toUpperCase() !== 'CANVAS'
&& (
(!dom.clientWidth && (!opts || opts.width == null))
|| (!dom.clientHeight && (!opts || opts.height == null))
)
) {
console.warn('Can\'t get DOM width or height. Please check '
+ 'dom.clientWidth and dom.clientHeight. They should not be 0.'
+ 'For example, you may need to call this in the callback '
+ 'of window.onload.');
}
}
var chart = new ECharts(dom, theme$$1, opts);
chart.id = 'ec_' + idBase++;
instances[chart.id] = chart;
setAttribute(dom, DOM_ATTRIBUTE_KEY, chart.id);
enableConnect(chart);
return chart;
}
|
@param {number} [priority=3000]
@param {module:echarts/stream/Task} visualTask
|
init
|
javascript
|
douyu/juno
|
assets/public/js/echarts/v4.7.0/echarts.simple.js
|
https://github.com/douyu/juno/blob/master/assets/public/js/echarts/v4.7.0/echarts.simple.js
|
Apache-2.0
|
function connect(groupId) {
// Is array of charts
if (isArray(groupId)) {
var charts = groupId;
groupId = null;
// If any chart has group
each(charts, function (chart) {
if (chart.group != null) {
groupId = chart.group;
}
});
groupId = groupId || ('g_' + groupIdBase++);
each(charts, function (chart) {
chart.group = groupId;
});
}
connectedGroups[groupId] = true;
return groupId;
}
|
@param {Object} opts
@param {string} [superClass]
|
connect
|
javascript
|
douyu/juno
|
assets/public/js/echarts/v4.7.0/echarts.simple.js
|
https://github.com/douyu/juno/blob/master/assets/public/js/echarts/v4.7.0/echarts.simple.js
|
Apache-2.0
|
function disConnect(groupId) {
connectedGroups[groupId] = false;
}
|
@param {Object} opts
@param {string} [superClass]
|
disConnect
|
javascript
|
douyu/juno
|
assets/public/js/echarts/v4.7.0/echarts.simple.js
|
https://github.com/douyu/juno/blob/master/assets/public/js/echarts/v4.7.0/echarts.simple.js
|
Apache-2.0
|
function dispose(chart) {
if (typeof chart === 'string') {
chart = instances[chart];
}
else if (!(chart instanceof ECharts)) {
// Try to treat as dom
chart = getInstanceByDom(chart);
}
if ((chart instanceof ECharts) && !chart.isDisposed()) {
chart.dispose();
}
}
|
@param {Object} opts
@param {string} [superClass]
|
dispose
|
javascript
|
douyu/juno
|
assets/public/js/echarts/v4.7.0/echarts.simple.js
|
https://github.com/douyu/juno/blob/master/assets/public/js/echarts/v4.7.0/echarts.simple.js
|
Apache-2.0
|
function getInstanceByDom(dom) {
return instances[getAttribute(dom, DOM_ATTRIBUTE_KEY)];
}
|
@param {Object} opts
@param {string} [superClass]
|
getInstanceByDom
|
javascript
|
douyu/juno
|
assets/public/js/echarts/v4.7.0/echarts.simple.js
|
https://github.com/douyu/juno/blob/master/assets/public/js/echarts/v4.7.0/echarts.simple.js
|
Apache-2.0
|
function getInstanceById(key) {
return instances[key];
}
|
@param {Object} opts
@param {string} [superClass]
|
getInstanceById
|
javascript
|
douyu/juno
|
assets/public/js/echarts/v4.7.0/echarts.simple.js
|
https://github.com/douyu/juno/blob/master/assets/public/js/echarts/v4.7.0/echarts.simple.js
|
Apache-2.0
|
function registerTheme(name, theme$$1) {
themeStorage[name] = theme$$1;
}
|
@param {Object} opts
@param {string} [superClass]
|
registerTheme
|
javascript
|
douyu/juno
|
assets/public/js/echarts/v4.7.0/echarts.simple.js
|
https://github.com/douyu/juno/blob/master/assets/public/js/echarts/v4.7.0/echarts.simple.js
|
Apache-2.0
|
function registerProcessor(priority, processor) {
normalizeRegister(dataProcessorFuncs, priority, processor, PRIORITY_PROCESSOR_FILTER);
}
|
ZRender need a canvas context to do measureText.
But in node environment canvas may be created by node-canvas.
So we need to specify how to create a canvas instead of using document.createElement('canvas')
Be careful of using it in the browser.
@param {Function} creator
@example
var Canvas = require('canvas');
var echarts = require('echarts');
echarts.setCanvasCreator(function () {
// Small size is enough.
return new Canvas(32, 32);
});
|
registerProcessor
|
javascript
|
douyu/juno
|
assets/public/js/echarts/v4.7.0/echarts.simple.js
|
https://github.com/douyu/juno/blob/master/assets/public/js/echarts/v4.7.0/echarts.simple.js
|
Apache-2.0
|
function registerVisual(priority, visualTask) {
normalizeRegister(visualFuncs, priority, visualTask, PRIORITY_VISUAL_CHART, 'visual');
}
|
@param {Array} oldArr
@param {Array} newArr
@param {Function} oldKeyGetter
@param {Function} newKeyGetter
@param {Object} [context] Can be visited by this.context in callback.
|
registerVisual
|
javascript
|
douyu/juno
|
assets/public/js/echarts/v4.7.0/echarts.simple.js
|
https://github.com/douyu/juno/blob/master/assets/public/js/echarts/v4.7.0/echarts.simple.js
|
Apache-2.0
|
function normalizeRegister(targetList, priority, fn, defaultPriority, visualType) {
if (isFunction(priority) || isObject(priority)) {
fn = priority;
priority = defaultPriority;
}
if (__DEV__) {
if (isNaN(priority) || priority == null) {
throw new Error('Illegal priority');
}
// Check duplicate
each(targetList, function (wrap) {
assert(wrap.__raw !== fn);
});
}
var stageHandler = Scheduler.wrapStageHandler(fn, visualType);
stageHandler.__prio = priority;
stageHandler.__raw = fn;
targetList.push(stageHandler);
return stageHandler;
}
|
@param {Array} oldArr
@param {Array} newArr
@param {Function} oldKeyGetter
@param {Function} newKeyGetter
@param {Object} [context] Can be visited by this.context in callback.
|
normalizeRegister
|
javascript
|
douyu/juno
|
assets/public/js/echarts/v4.7.0/echarts.simple.js
|
https://github.com/douyu/juno/blob/master/assets/public/js/echarts/v4.7.0/echarts.simple.js
|
Apache-2.0
|
function summarizeDimensions(data) {
var summary = {};
var encode = summary.encode = {};
var notExtraCoordDimMap = createHashMap();
var defaultedLabel = [];
var defaultedTooltip = [];
// See the comment of `List.js#userOutput`.
var userOutput = summary.userOutput = {
dimensionNames: data.dimensions.slice(),
encode: {}
};
each$1(data.dimensions, function (dimName) {
var dimItem = data.getDimensionInfo(dimName);
var coordDim = dimItem.coordDim;
if (coordDim) {
if (__DEV__) {
assert$1(OTHER_DIMENSIONS.get(coordDim) == null);
}
var coordDimIndex = dimItem.coordDimIndex;
getOrCreateEncodeArr(encode, coordDim)[coordDimIndex] = dimName;
if (!dimItem.isExtraCoord) {
notExtraCoordDimMap.set(coordDim, 1);
// Use the last coord dim (and label friendly) as default label,
// because when dataset is used, it is hard to guess which dimension
// can be value dimension. If both show x, y on label is not look good,
// and conventionally y axis is focused more.
if (mayLabelDimType(dimItem.type)) {
defaultedLabel[0] = dimName;
}
// User output encode do not contain generated coords.
// And it only has index. User can use index to retrieve value from the raw item array.
getOrCreateEncodeArr(userOutput.encode, coordDim)[coordDimIndex] = dimItem.index;
}
if (dimItem.defaultTooltip) {
defaultedTooltip.push(dimName);
}
}
OTHER_DIMENSIONS.each(function (v, otherDim) {
var encodeArr = getOrCreateEncodeArr(encode, otherDim);
var dimIndex = dimItem.otherDims[otherDim];
if (dimIndex != null && dimIndex !== false) {
encodeArr[dimIndex] = dimItem.name;
}
});
});
var dataDimsOnCoord = [];
var encodeFirstDimNotExtra = {};
notExtraCoordDimMap.each(function (v, coordDim) {
var dimArr = encode[coordDim];
// ??? FIXME extra coord should not be set in dataDimsOnCoord.
// But should fix the case that radar axes: simplify the logic
// of `completeDimension`, remove `extraPrefix`.
encodeFirstDimNotExtra[coordDim] = dimArr[0];
// Not necessary to remove duplicate, because a data
// dim canot on more than one coordDim.
dataDimsOnCoord = dataDimsOnCoord.concat(dimArr);
});
summary.dataDimsOnCoord = dataDimsOnCoord;
summary.encodeFirstDimNotExtra = encodeFirstDimNotExtra;
var encodeLabel = encode.label;
// FIXME `encode.label` is not recommanded, because formatter can not be set
// in this way. Use label.formatter instead. May be remove this approach someday.
if (encodeLabel && encodeLabel.length) {
defaultedLabel = encodeLabel.slice();
}
var encodeTooltip = encode.tooltip;
if (encodeTooltip && encodeTooltip.length) {
defaultedTooltip = encodeTooltip.slice();
}
else if (!defaultedTooltip.length) {
defaultedTooltip = defaultedLabel.slice();
}
encode.defaultedLabel = defaultedLabel;
encode.defaultedTooltip = defaultedTooltip;
return summary;
}
|
The origin name in dimsDef, see source helper.
If displayName given, the tooltip will displayed vertically.
Optional.
@type {string}
|
summarizeDimensions
|
javascript
|
douyu/juno
|
assets/public/js/echarts/v4.7.0/echarts.simple.js
|
https://github.com/douyu/juno/blob/master/assets/public/js/echarts/v4.7.0/echarts.simple.js
|
Apache-2.0
|
function getOrCreateEncodeArr(encode, dim) {
if (!encode.hasOwnProperty(dim)) {
encode[dim] = [];
}
return encode[dim];
}
|
List for data storage
@module echarts/data/List
|
getOrCreateEncodeArr
|
javascript
|
douyu/juno
|
assets/public/js/echarts/v4.7.0/echarts.simple.js
|
https://github.com/douyu/juno/blob/master/assets/public/js/echarts/v4.7.0/echarts.simple.js
|
Apache-2.0
|
function getDimensionTypeByAxis(axisType) {
return axisType === 'category'
? 'ordinal'
: axisType === 'time'
? 'time'
: 'float';
}
|
List for data storage
@module echarts/data/List
|
getDimensionTypeByAxis
|
javascript
|
douyu/juno
|
assets/public/js/echarts/v4.7.0/echarts.simple.js
|
https://github.com/douyu/juno/blob/master/assets/public/js/echarts/v4.7.0/echarts.simple.js
|
Apache-2.0
|
function mayLabelDimType(dimType) {
// In most cases, ordinal and time do not suitable for label.
// Ordinal info can be displayed on axis. Time is too long.
return !(dimType === 'ordinal' || dimType === 'time');
}
|
List for data storage
@module echarts/data/List
|
mayLabelDimType
|
javascript
|
douyu/juno
|
assets/public/js/echarts/v4.7.0/echarts.simple.js
|
https://github.com/douyu/juno/blob/master/assets/public/js/echarts/v4.7.0/echarts.simple.js
|
Apache-2.0
|
function DataDimensionInfo(opt) {
if (opt != null) {
extend(this, opt);
}
/**
* Dimension name.
* Mandatory.
* @type {string}
*/
// this.name;
/**
* The origin name in dimsDef, see source helper.
* If displayName given, the tooltip will displayed vertically.
* Optional.
* @type {string}
*/
// this.displayName;
/**
* Which coordSys dimension this dimension mapped to.
* A `coordDim` can be a "coordSysDim" that the coordSys required
* (for example, an item in `coordSysDims` of `model/referHelper#CoordSysInfo`),
* or an generated "extra coord name" if does not mapped to any "coordSysDim"
* (That is determined by whether `isExtraCoord` is `true`).
* Mandatory.
* @type {string}
*/
// this.coordDim;
/**
* The index of this dimension in `series.encode[coordDim]`.
* Mandatory.
* @type {number}
*/
// this.coordDimIndex;
/**
* Dimension type. The enumerable values are the key of
* `dataCtors` of `data/List`.
* Optional.
* @type {string}
*/
// this.type;
/**
* This index of this dimension info in `data/List#_dimensionInfos`.
* Mandatory after added to `data/List`.
* @type {number}
*/
// this.index;
/**
* The format of `otherDims` is:
* ```js
* {
* tooltip: number optional,
* label: number optional,
* itemName: number optional,
* seriesName: number optional,
* }
* ```
*
* A `series.encode` can specified these fields:
* ```js
* encode: {
* // "3, 1, 5" is the index of data dimension.
* tooltip: [3, 1, 5],
* label: [0, 3],
* ...
* }
* ```
* `otherDims` is the parse result of the `series.encode` above, like:
* ```js
* // Suppose the index of this data dimension is `3`.
* this.otherDims = {
* // `3` is at the index `0` of the `encode.tooltip`
* tooltip: 0,
* // `3` is at the index `1` of the `encode.tooltip`
* label: 1
* };
* ```
*
* This prop should never be `null`/`undefined` after initialized.
* @type {Object}
*/
this.otherDims = {};
/**
* Be `true` if this dimension is not mapped to any "coordSysDim" that the
* "coordSys" required.
* Mandatory.
* @type {boolean}
*/
// this.isExtraCoord;
/**
* @type {module:data/OrdinalMeta}
*/
// this.ordinalMeta;
/**
* Whether to create inverted indices.
* @type {boolean}
*/
// this.createInvertedIndices;
}
|
List for data storage
@module echarts/data/List
|
DataDimensionInfo
|
javascript
|
douyu/juno
|
assets/public/js/echarts/v4.7.0/echarts.simple.js
|
https://github.com/douyu/juno/blob/master/assets/public/js/echarts/v4.7.0/echarts.simple.js
|
Apache-2.0
|
function transferProperties(target, source) {
each$1(TRANSFERABLE_PROPERTIES.concat(source.__wrappedMethods || []), function (propName) {
if (source.hasOwnProperty(propName)) {
target[propName] = source[propName];
}
});
target.__wrappedMethods = source.__wrappedMethods;
each$1(CLONE_PROPERTIES, function (propName) {
target[propName] = clone(source[propName]);
});
target._calculationInfo = extend(source._calculationInfo);
}
|
If each data item has it's own option
@type {boolean}
|
transferProperties
|
javascript
|
douyu/juno
|
assets/public/js/echarts/v4.7.0/echarts.simple.js
|
https://github.com/douyu/juno/blob/master/assets/public/js/echarts/v4.7.0/echarts.simple.js
|
Apache-2.0
|
List = function (dimensions, hostModel) {
dimensions = dimensions || ['x', 'y'];
var dimensionInfos = {};
var dimensionNames = [];
var invertedIndicesMap = {};
for (var i = 0; i < dimensions.length; i++) {
// Use the original dimensions[i], where other flag props may exists.
var dimensionInfo = dimensions[i];
if (isString(dimensionInfo)) {
dimensionInfo = new DataDimensionInfo({name: dimensionInfo});
}
else if (!(dimensionInfo instanceof DataDimensionInfo)) {
dimensionInfo = new DataDimensionInfo(dimensionInfo);
}
var dimensionName = dimensionInfo.name;
dimensionInfo.type = dimensionInfo.type || 'float';
if (!dimensionInfo.coordDim) {
dimensionInfo.coordDim = dimensionName;
dimensionInfo.coordDimIndex = 0;
}
dimensionInfo.otherDims = dimensionInfo.otherDims || {};
dimensionNames.push(dimensionName);
dimensionInfos[dimensionName] = dimensionInfo;
dimensionInfo.index = i;
if (dimensionInfo.createInvertedIndices) {
invertedIndicesMap[dimensionName] = [];
}
}
/**
* @readOnly
* @type {Array.<string>}
*/
this.dimensions = dimensionNames;
/**
* Infomation of each data dimension, like data type.
* @type {Object}
*/
this._dimensionInfos = dimensionInfos;
/**
* @type {module:echarts/model/Model}
*/
this.hostModel = hostModel;
/**
* @type {module:echarts/model/Model}
*/
this.dataType;
/**
* Indices stores the indices of data subset after filtered.
* This data subset will be used in chart.
* @type {Array.<number>}
* @readOnly
*/
this._indices = null;
this._count = 0;
this._rawCount = 0;
/**
* Data storage
* @type {Object.<key, Array.<TypedArray|Array>>}
* @private
*/
this._storage = {};
/**
* @type {Array.<string>}
*/
this._nameList = [];
/**
* @type {Array.<string>}
*/
this._idList = [];
/**
* Models of data option is stored sparse for optimizing memory cost
* @type {Array.<module:echarts/model/Model>}
* @private
*/
this._optionModels = [];
/**
* Global visual properties after visual coding
* @type {Object}
* @private
*/
this._visual = {};
/**
* Globel layout properties.
* @type {Object}
* @private
*/
this._layout = {};
/**
* Item visual properties after visual coding
* @type {Array.<Object>}
* @private
*/
this._itemVisuals = [];
/**
* Key: visual type, Value: boolean
* @type {Object}
* @readOnly
*/
this.hasItemVisual = {};
/**
* Item layout properties after layout
* @type {Array.<Object>}
* @private
*/
this._itemLayouts = [];
/**
* Graphic elemnents
* @type {Array.<module:zrender/Element>}
* @private
*/
this._graphicEls = [];
/**
* Max size of each chunk.
* @type {number}
* @private
*/
this._chunkSize = 1e5;
/**
* @type {number}
* @private
*/
this._chunkCount = 0;
/**
* @type {Array.<Array|Object>}
* @private
*/
this._rawData;
/**
* Raw extent will not be cloned, but only transfered.
* It will not be calculated util needed.
* key: dim,
* value: {end: number, extent: Array.<number>}
* @type {Object}
* @private
*/
this._rawExtent = {};
/**
* @type {Object}
* @private
*/
this._extent = {};
/**
* key: dim
* value: extent
* @type {Object}
* @private
*/
this._approximateExtent = {};
/**
* Cache summary info for fast visit. See "dimensionHelper".
* @type {Object}
* @private
*/
this._dimensionsSummary = summarizeDimensions(this);
/**
* @type {Object.<Array|TypedArray>}
* @private
*/
this._invertedIndicesMap = invertedIndicesMap;
/**
* @type {Object}
* @private
*/
this._calculationInfo = {};
/**
* User output info of this data.
* DO NOT use it in other places!
*
* When preparing user params for user callbacks, we have
* to clone these inner data structures to prevent users
* from modifying them to effect built-in logic. And for
* performance consideration we make this `userOutput` to
* avoid clone them too many times.
*
* @type {Object}
* @readOnly
*/
this.userOutput = this._dimensionsSummary.userOutput;
}
|
If each data item has it's own option
@type {boolean}
|
List
|
javascript
|
douyu/juno
|
assets/public/js/echarts/v4.7.0/echarts.simple.js
|
https://github.com/douyu/juno/blob/master/assets/public/js/echarts/v4.7.0/echarts.simple.js
|
Apache-2.0
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.