Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
_updateCategoriesData: function () {
var categories = (this.option.categories || []).map(function (category) {
// Data must has value
return category.value != null ? category : echarts.util.extend({
value: 0
}, category);
});
var categoriesData = new echarts.List(['value'], this);
categoriesData.initData(categories);
this._categoriesData = categoriesData;
this._categoriesModels = categoriesData.mapArray(function (idx) {
return categoriesData.getItemModel(idx, true);
});
},
getInitialData: function (option) {
var polygonsData = new echarts.List(['value'], this);
polygonsData.hasItemOption = false;
polygonsData.initData(option.data, [], function (dataItem, dimName, dataIndex, dimIndex) {
// dataItem is simply coords
if (dataItem instanceof Array) {
return NaN;
}
else {
polygonsData.hasItemOption = true;
var value = dataItem.value;
if (value != null) {
return value instanceof Array ? value[dimIndex] : value;
}
}
});
return polygonsData;
var target = link.target;
// addEdge may fail when source or target not exists
if (graph.addEdge(source, target, linkCount)) {
validEdges.push(link);
linkNameList.push(retrieve.firstNotNull(link.id, source + ' > ' + target));
linkCount++;
}
}
var nodeData;
// FIXME, support more coordinate systems.
var dimensionNames = echarts.helper.completeDimensions(
['value'], nodes
);
nodeData = new echarts.List(dimensionNames, hostModel);
nodeData.initData(nodes);
var edgeData = new echarts.List(['value'], hostModel);
edgeData.initData(validEdges, linkNameList);
beforeLink && beforeLink(nodeData, edgeData);
linkList({
mainData: nodeData,
struct: graph,
structAttr: 'graph',
datas: {node: nodeData, edge: edgeData},
datasAttr: {node: 'data', edge: 'edgeData'}
});
// Update dataIndex of nodes and edges because invalid edge may be removed
getInitialData: function (option, ecModel) {
var lineData = new echarts.List(['value'], this);
lineData.hasItemOption = false;
lineData.initData(option.data, [], function (dataItem, dimName, dataIndex, dimIndex) {
// dataItem is simply coords
if (dataItem instanceof Array) {
return NaN;
}
else {
lineData.hasItemOption = true;
var value = dataItem.value;
if (value != null) {
return value instanceof Array ? value[dimIndex] : value;
}
}
});
return lineData;
getInitialData: function (option, ecModel) {
var coordSysDimensions = echarts.getCoordinateSystemDimensions(this.get('coordinateSystem')) || ['x', 'y'];
if (__DEV__) {
if (coordSysDimensions.length > 2) {
throw new Error('flowGL can only be used on 2d coordinate systems.')
}
}
coordSysDimensions.push('vx', 'vy');
var dimensions = echarts.helper.completeDimensions(coordSysDimensions, this.getSource(), {
encodeDef: this.get('encode'),
dimsDef: this.get('dimensions')
});
var data = new echarts.List(dimensions, this);
data.initData(this.getSource());
return data;
},
getInitialData: function (option) {
option.data = this.getFilledRegions(option.data, option.map);
var dimensions = echarts.helper.completeDimensions(['value'], option.data);
var list = new echarts.List(dimensions, this);
list.initData(option.data);
var regionModelMap = {};
list.each(function (idx) {
var name = list.getName(idx);
var itemModel = list.getItemModel(idx);
regionModelMap[name] = itemModel;
});
this._regionModelMap = regionModelMap;
return list;
},
getInitialData: function (option, ecModel) {
var dimensions = completeDimensions(['value'], option.data);
var list = new echarts.List(dimensions, this);
list.initData(option.data);
return list;
},
getInitialData: function (option, ecModel) {
var dimensions = completeDimensions(['value'], option.data);
var list = new echarts.List(dimensions, this);
list.initData(option.data);
return list;
},
getInitialData: function (option, ecModel) {
var coordSysDimensions = echarts.getCoordinateSystemDimensions(this.get('coordinateSystem')) || ['x', 'y', 'z'];
var dimensions = echarts.helper.completeDimensions(coordSysDimensions, option.data, {
encodeDef: this.get('encode'),
dimsDef: this.get('dimensions')
});
var data = new echarts.List(dimensions, this);
data.initData(option.data);
return data;
},
optionUpdated: function () {
var option = this.option;
option.regions = this.getFilledRegions(option.regions, option.map);
var dimensions = echarts.helper.completeDimensions(['value'], option.data, {
encodeDef: this.get('encode'),
dimsDef: this.get('dimensions')
});
var list = new echarts.List(dimensions, this);
list.initData(option.regions);
var regionModelMap = {};
list.each(function (idx) {
var name = list.getName(idx);
var itemModel = list.getItemModel(idx);
regionModelMap[name] = itemModel;
});
this._regionModelMap = regionModelMap;
this._data = list;
},