How to use the echarts/lib/echarts.extendSeriesModel 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
import echarts from 'echarts/lib/echarts';
import createGraphFromNodeEdge from './createGraphFromNodeEdge';
import formatUtil from '../../util/format';

var GraphSeries = echarts.extendSeriesModel({

    type: 'series.graphGL',

    visualColorAccessPath: 'itemStyle.color',

    init: function (option) {
        GraphSeries.superApply(this, 'init', arguments);

        // Provide data for legend select
        this.legendDataProvider = function () {
            return this._categoriesData;
        };

        this._updateCategoriesData();
    },
github ecomfe / echarts-gl / src / chart / polygons3D / Polygons3DSeries.js View on Github external
import echarts from 'echarts/lib/echarts';
import componentShadingMixin from '../../component/common/componentShadingMixin';

function transformPolygon(coordSys, poly) {
    var ret = [];
    for (var i = 0; i < poly.length; i++) {
        ret.push(coordSys.dataToPoint(poly[i]));
    }
    return ret;
}

var Polygons3DSeries = echarts.extendSeriesModel({

    type: 'series.polygons3D',

    getRegionModel: function (idx) {
        return this.getData().getItemModel(idx);
    },

    getRegionPolygonCoords: function (idx) {
        var coordSys = this.coordinateSystem;
        var itemModel = this.getData().getItemModel(idx);
        var coords = itemModel.option instanceof Array
            ? itemModel.option : itemModel.getShallow('coords');
        if (!itemModel.get('multiPolygon')) {
            coords = [coords];
        }
        // TODO Validate
github ecomfe / echarts-gl / src / chart / lines3D / Lines3DSeries.js View on Github external
import echarts from 'echarts/lib/echarts';

echarts.extendSeriesModel({

    type: 'series.lines3D',

    dependencies: ['globe'],

    visualColorAccessPath: 'lineStyle.color',

    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 {
github ecomfe / echarts-gl / src / chart / surface / SurfaceSeries.js View on Github external
import echarts from 'echarts/lib/echarts';
import componentShadingMixin from '../../component/common/componentShadingMixin';
import formatTooltip from '../common/formatTooltip';
import createList from '../common/createList';

var SurfaceSeries = echarts.extendSeriesModel({

    type: 'series.surface',

    dependencies: ['globe', 'grid3D', 'geo3D'],

    visualColorAccessPath: 'itemStyle.color',

    formatTooltip: function (dataIndex) {
        return formatTooltip(this, dataIndex);
    },

    getInitialData: function (option, ecModel) {
        var data = option.data;

        function validateDimension(dimOpts) {
            return !(isNaN(dimOpts.min) || isNaN(dimOpts.max) || isNaN(dimOpts.step));
github ecomfe / echarts-gl / src / chart / scatter3D / Scatter3DSeries.js View on Github external
import echarts from 'echarts/lib/echarts';
import formatUtil from '../../util/format';
import formatTooltip from '../common/formatTooltip';

echarts.extendSeriesModel({

    type: 'series.scatter3D',

    dependencies: ['globe', 'grid3D', 'geo3D'],

    visualColorAccessPath: 'itemStyle.color',

    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 / chart / line3D / Line3DSeries.js View on Github external
import echarts from 'echarts/lib/echarts';
import formatTooltip from '../common/formatTooltip';
import createList from '../common/createList';

var Line3DSeries = echarts.extendSeriesModel({

    type: 'series.line3D',

    dependencies: ['grid3D'],

    visualColorAccessPath: 'lineStyle.color',

    getInitialData: function (option, ecModel) {
        return createList(this);
    },

    formatTooltip: function (dataIndex) {
        return formatTooltip(this, dataIndex);
    },

    defaultOption: {
github ecomfe / echarts-gl / src / chart / map3D / Map3DSeries.js View on Github external
import componentLightMixin from '../../component/common/componentLightMixin';
import componentShadingMixin from '../../component/common/componentShadingMixin';
import geo3DModelMixin from '../../coord/geo3D/geo3DModelMixin';
import formatUtil from '../../util/format';
import formatTooltip from '../common/formatTooltip';
import geo3DCreator from '../../coord/geo3DCreator';

function transformPolygon(mapbox3DCoordSys, poly) {
    var newPoly = [];
    for (var k = 0; k < poly.length; k++) {
        newPoly.push(mapbox3DCoordSys.dataToPoint(poly[k]));
    }
    return newPoly;
}

var Map3DSeries = echarts.extendSeriesModel({

    type: 'series.map3D',

    layoutMode: 'box',

    coordinateSystem: null,

    visualColorAccessPath: 'itemStyle.color',

    optionUpdated: function (newOpt) {
        newOpt = newOpt || {};
        var coordSysType = this.get('coordinateSystem');
        if (coordSysType == null || coordSysType === 'geo3D') {
            return;
        }
github ecomfe / echarts-gl / src / chart / linesGL / LinesGLSeries.js View on Github external
import echarts from 'echarts/lib/echarts';
import { concatArray } from 'zrender/lib/core/util';

var LinesSeries = echarts.extendSeriesModel({

    type: 'series.linesGL',

    dependencies: ['grid', 'geo'],

    visualColorAccessPath: 'lineStyle.color',

    streamEnabled: true,

    init: function (option) {
        var result = this._processFlatCoordsArray(option.data);
        this._flatCoords = result.flatCoords;
        this._flatCoordsOffset = result.flatCoordsOffset;
        if (result.flatCoords) {
            option.data = new Float32Array(result.count);
        }
github ecomfe / echarts-wordcloud / src / WordCloudSeries.js View on Github external
var completeDimensions = require('echarts/lib/data/helper/completeDimensions');
var echarts = require('echarts/lib/echarts');

echarts.extendSeriesModel({

    type: 'series.wordCloud',

    visualColorAccessPath: 'textStyle.normal.color',

    optionUpdated: function () {
        var option = this.option;
        option.gridSize = Math.max(Math.floor(option.gridSize), 4);
    },

    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 / bar3D / Bar3DSeries.js View on Github external
import echarts from 'echarts/lib/echarts';
import componentShadingMixin from '../../component/common/componentShadingMixin';
import formatUtil from '../../util/format';
import formatTooltip from '../common/formatTooltip';
import createList from '../common/createList';

var Bar3DSeries = echarts.extendSeriesModel({

    type: 'series.bar3D',

    dependencies: ['globe'],

    visualColorAccessPath: 'itemStyle.color',

    getInitialData: function (option, ecModel) {
        return createList(this);
    },

    getFormattedLabel: function (dataIndex, status, dataType, dimIndex) {
        var text = formatUtil.getFormattedLabel(this, dataIndex, status, dataType, dimIndex);
        if (text == null) {
            text = this.getData().get('z', dataIndex);
        }