123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145 |
- import { __extends } from "tslib";
- import * as zrUtil from 'zrender/lib/core/util.js';
- import createSeriesDataSimply from '../helper/createSeriesDataSimply.js';
- import { defaultEmphasis } from '../../util/model.js';
- import { makeSeriesEncodeForNameBased } from '../../data/helper/sourceHelper.js';
- import LegendVisualProvider from '../../visual/LegendVisualProvider.js';
- import SeriesModel from '../../model/Series.js';
- var FunnelSeriesModel = function (_super) {
- __extends(FunnelSeriesModel, _super);
- function FunnelSeriesModel() {
- var _this = _super !== null && _super.apply(this, arguments) || this;
- _this.type = FunnelSeriesModel.type;
- return _this;
- }
- FunnelSeriesModel.prototype.init = function (option) {
- _super.prototype.init.apply(this, arguments);
-
-
- this.legendVisualProvider = new LegendVisualProvider(zrUtil.bind(this.getData, this), zrUtil.bind(this.getRawData, this));
-
- this._defaultLabelLine(option);
- };
- FunnelSeriesModel.prototype.getInitialData = function (option, ecModel) {
- return createSeriesDataSimply(this, {
- coordDimensions: ['value'],
- encodeDefaulter: zrUtil.curry(makeSeriesEncodeForNameBased, this)
- });
- };
- FunnelSeriesModel.prototype._defaultLabelLine = function (option) {
-
- defaultEmphasis(option, 'labelLine', ['show']);
- var labelLineNormalOpt = option.labelLine;
- var labelLineEmphasisOpt = option.emphasis.labelLine;
-
- labelLineNormalOpt.show = labelLineNormalOpt.show && option.label.show;
- labelLineEmphasisOpt.show = labelLineEmphasisOpt.show && option.emphasis.label.show;
- };
-
- FunnelSeriesModel.prototype.getDataParams = function (dataIndex) {
- var data = this.getData();
- var params = _super.prototype.getDataParams.call(this, dataIndex);
- var valueDim = data.mapDimension('value');
- var sum = data.getSum(valueDim);
-
- params.percent = !sum ? 0 : +(data.get(valueDim, dataIndex) / sum * 100).toFixed(2);
- params.$vars.push('percent');
- return params;
- };
- FunnelSeriesModel.type = 'series.funnel';
- FunnelSeriesModel.defaultOption = {
-
- z: 2,
- legendHoverLink: true,
- colorBy: 'data',
- left: 80,
- top: 60,
- right: 80,
- bottom: 60,
-
-
-
-
-
- minSize: '0%',
- maxSize: '100%',
- sort: 'descending',
- orient: 'vertical',
- gap: 0,
- funnelAlign: 'center',
- label: {
- show: true,
- position: 'outer'
-
- },
- labelLine: {
- show: true,
- length: 20,
- lineStyle: {
-
- width: 1
- }
- },
- itemStyle: {
-
- borderColor: '#fff',
- borderWidth: 1
- },
- emphasis: {
- label: {
- show: true
- }
- },
- select: {
- itemStyle: {
- borderColor: '#212121'
- }
- }
- };
- return FunnelSeriesModel;
- }(SeriesModel);
- export default FunnelSeriesModel;
|