@antv/g2plot
Version:
G2 Plot, a market of plots built with the Grammar of Graphics'
82 lines • 2.58 kB
JavaScript
import { __assign, __extends } from "tslib";
import * as _ from '@antv/util';
import { registerPlotType } from '../../base/global';
import { getComponent } from '../../components/factory';
import BaseBarLayer from '../bar/layer';
import './component/label/stack-bar-label';
var StackBarLayer = /** @class */ (function (_super) {
__extends(StackBarLayer, _super);
function StackBarLayer() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.type = 'stackBar';
return _this;
}
StackBarLayer.getDefaultOptions = function () {
return _.deepMix({}, _super.getDefaultOptions.call(this), {
xAxis: {
visible: true,
autoHideLabel: false,
autoRotateLabel: false,
autoRotateTitle: false,
grid: {
visible: true,
},
line: {
visible: false,
},
tickLine: {
visible: true,
},
label: {
visible: true,
},
title: {
visible: true,
offset: 12,
},
},
yAxis: {
visible: true,
autoHideLabel: false,
autoRotateLabel: false,
autoRotateTitle: true,
grid: {
visible: false,
},
line: {
visible: false,
},
tickLine: {
visible: false,
},
label: {
visible: true,
},
title: {
visible: false,
offset: 12,
},
},
});
};
StackBarLayer.prototype.adjustBar = function (bar) {
bar.adjust = [
{
type: 'stack',
},
];
};
StackBarLayer.prototype.extractLabel = function () {
var props = this.options;
var label = props.label;
if (label.visible === false) {
return false;
}
var labelConfig = getComponent('label', __assign({ plot: this, labelType: 'stackBarLabel', fields: [props.xField] }, label));
return labelConfig;
};
return StackBarLayer;
}(BaseBarLayer));
export default StackBarLayer;
registerPlotType('stackBar', StackBarLayer);
//# sourceMappingURL=layer.js.map