cione-comp-lib
Version:
`$ yarn add cione-comp-lib` 或者 `$ npm i cione-comp-lib -S`
87 lines (86 loc) • 2.86 kB
JavaScript
import { __extends } from "../../../../tslib/tslib.es6.mjs";
import { bind, curry } from "../../../../zrender/lib/core/util.mjs";
import createSeriesDataSimply from "../helper/createSeriesDataSimply.mjs";
import { defaultEmphasis } from "../../util/model.mjs";
import { makeSeriesEncodeForNameBased } from "../../data/helper/sourceHelper.mjs";
import LegendVisualProvider from "../../visual/LegendVisualProvider.mjs";
import SeriesModel from "../../model/Series.mjs";
var FunnelSeriesModel = function(_super) {
__extends(FunnelSeriesModel2, _super);
function FunnelSeriesModel2() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.type = FunnelSeriesModel2.type;
return _this;
}
FunnelSeriesModel2.prototype.init = function(option) {
_super.prototype.init.apply(this, arguments);
this.legendVisualProvider = new LegendVisualProvider(bind(this.getData, this), bind(this.getRawData, this));
this._defaultLabelLine(option);
};
FunnelSeriesModel2.prototype.getInitialData = function(option, ecModel) {
return createSeriesDataSimply(this, {
coordDimensions: ["value"],
encodeDefaulter: curry(makeSeriesEncodeForNameBased, this)
});
};
FunnelSeriesModel2.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;
};
FunnelSeriesModel2.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;
};
FunnelSeriesModel2.type = "series.funnel";
FunnelSeriesModel2.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 FunnelSeriesModel2;
}(SeriesModel);
var FunnelSeriesModel$1 = FunnelSeriesModel;
export { FunnelSeriesModel$1 as default };