How to use the echarts/lib/echarts.List function in echarts

To help you get started, we’ve selected a few echarts examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ecomfe / echarts-gl / src / chart / graphGL / GraphGLSeries.js View on Github external
_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);
        });
    },
github ecomfe / echarts-gl / src / chart / polygons3D / Polygons3DSeries.js View on Github external
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;
github ecomfe / echarts-gl / src / chart / graphGL / createGraphFromNodeEdge.js View on Github external
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
github ecomfe / echarts-gl / src / chart / lines3D / Lines3DSeries.js View on Github external
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;
github ecomfe / echarts-gl / src / chart / flowGL / FlowGLSeries.js View on Github external
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;
    },
github ecomfe / echarts-gl / src / chart / map3D / Map3DSeries.js View on Github external
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;
    },
github ecomfe / echarts-wordcloud / src / WordCloudSeries.js View on Github external
getInitialData: function (option, ecModel) {
        var dimensions = completeDimensions(['value'], option.data);
        var list = new echarts.List(dimensions, this);
        list.initData(option.data);
        return list;
    },
github ecomfe / echarts-liquidfill / src / liquidFillSeries.js View on Github external
getInitialData: function (option, ecModel) {
        var dimensions = completeDimensions(['value'], option.data);
        var list = new echarts.List(dimensions, this);
        list.initData(option.data);
        return list;
    },
github ecomfe / echarts-gl / src / chart / scatter3D / Scatter3DSeries.js View on Github external
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;
    },
github ecomfe / echarts-gl / src / component / geo3D / Geo3DModel.js View on Github external
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;
    },