@qn-pandora/pandora-visualization
Version:
Pandora 通用可视化库
222 lines (221 loc) • 10.2 kB
JavaScript
;
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var mobx_1 = require("mobx");
var bind_1 = __importDefault(require("../../../../../utils/bind"));
var chart_style_1 = require("../../../../../constants/chart-style");
var one_d_1 = __importDefault(require("../one-d"));
var capsule_bar_style_1 = require("../../../../../constants/capsule-bar-style");
var base_1 = require("../base");
var defaultConstantValue = 100;
var defaultLabelWidth = 10;
var defaultValueWidth = 15;
var CapsuleBarChartStyleService = /** @class */ (function (_super) {
__extends(CapsuleBarChartStyleService, _super);
function CapsuleBarChartStyleService(options) {
var _this = _super.call(this, options) || this;
// 图表类型
_this.chartType = chart_style_1.ChartType.CapsuleBar;
// label 展示
_this.valueTypes = [capsule_bar_style_1.ValueType.Rate];
// 比例计算方式
_this.subtotalType = capsule_bar_style_1.SubtotalType.Sum;
_this.constantValue = defaultConstantValue;
_this.barColor = '';
_this.barShape = capsule_bar_style_1.BarShape.Capsule;
// 右边展示字体
_this.dataFont = chart_style_1.InitNormalFont;
_this.labelFont = chart_style_1.InitNormalFont;
_this.labelWidth = defaultLabelWidth;
_this.valueWidth = defaultValueWidth;
_this.labelPosition = capsule_bar_style_1.LabelPosition.Left;
_this.valueTypes = options.valueTypes || [capsule_bar_style_1.ValueType.Rate];
_this.subtotalType = options.subtotalType || capsule_bar_style_1.SubtotalType.Sum;
_this.constantValue = options.constantValue || defaultConstantValue;
_this.barColor = options.barColor || '';
_this.barShape = options.barShape || capsule_bar_style_1.BarShape.Capsule;
_this.dataFont = options.dataFont || chart_style_1.InitNormalFont;
_this.labelFont = options.labelFont || chart_style_1.InitNormalFont;
_this.labelPosition = options.labelPosition || capsule_bar_style_1.LabelPosition.Left;
_this.labelWidth = options.labelWidth || defaultLabelWidth;
_this.valueWidth = options.valueWidth || defaultValueWidth;
return _this;
}
CapsuleBarChartStyleService.prototype.getOptions = function () {
return __assign(__assign({}, _super.prototype.getOptions.call(this)), { valueTypes: this.valueTypes, subtotalType: this.subtotalType, constantValue: this.constantValue, barColor: this.barColor, barShape: this.barShape, dataFont: this.dataFont, labelFont: this.labelFont, labelPosition: this.labelPosition, labelWidth: this.labelWidth, valueWidth: this.valueWidth });
};
CapsuleBarChartStyleService.prototype.setValueTypes = function (valueTypes) {
this.valueTypes = valueTypes;
};
CapsuleBarChartStyleService.prototype.setSubtotalType = function (subtotalType) {
this.subtotalType = subtotalType;
};
CapsuleBarChartStyleService.prototype.setConstantValue = function (constantValue) {
this.constantValue = constantValue;
};
CapsuleBarChartStyleService.prototype.setBarColor = function (barColor) {
this.barColor = barColor;
};
CapsuleBarChartStyleService.prototype.setBarShape = function (barShape) {
this.barShape = barShape;
};
CapsuleBarChartStyleService.prototype.setDataFont = function (dataFont) {
this.dataFont = dataFont;
};
CapsuleBarChartStyleService.prototype.setLabelFont = function (labelFont) {
this.labelFont = labelFont;
};
CapsuleBarChartStyleService.prototype.setLabelPosition = function (labelPosition) {
this.labelPosition = labelPosition;
};
CapsuleBarChartStyleService.prototype.setLabelWidth = function (labelWidth) {
this.labelWidth = labelWidth;
};
CapsuleBarChartStyleService.prototype.setValueWidth = function (valueWidth) {
this.valueWidth = valueWidth;
};
__decorate([
base_1.styleOption(),
__metadata("design:type", Array)
], CapsuleBarChartStyleService.prototype, "valueTypes", void 0);
__decorate([
base_1.styleOption(),
__metadata("design:type", String)
], CapsuleBarChartStyleService.prototype, "subtotalType", void 0);
__decorate([
base_1.styleOption(),
__metadata("design:type", Number)
], CapsuleBarChartStyleService.prototype, "constantValue", void 0);
__decorate([
base_1.styleOption(),
__metadata("design:type", String)
], CapsuleBarChartStyleService.prototype, "barColor", void 0);
__decorate([
base_1.styleOption(),
__metadata("design:type", String)
], CapsuleBarChartStyleService.prototype, "barShape", void 0);
__decorate([
base_1.styleOption(),
__metadata("design:type", Object)
], CapsuleBarChartStyleService.prototype, "dataFont", void 0);
__decorate([
base_1.styleOption(),
__metadata("design:type", Object)
], CapsuleBarChartStyleService.prototype, "labelFont", void 0);
__decorate([
base_1.styleOption(),
__metadata("design:type", Number)
], CapsuleBarChartStyleService.prototype, "labelWidth", void 0);
__decorate([
base_1.styleOption(),
__metadata("design:type", Number)
], CapsuleBarChartStyleService.prototype, "valueWidth", void 0);
__decorate([
base_1.styleOption(),
__metadata("design:type", String)
], CapsuleBarChartStyleService.prototype, "labelPosition", void 0);
__decorate([
bind_1.default,
mobx_1.action,
__metadata("design:type", Function),
__metadata("design:paramtypes", [Array]),
__metadata("design:returntype", void 0)
], CapsuleBarChartStyleService.prototype, "setValueTypes", null);
__decorate([
bind_1.default,
mobx_1.action,
__metadata("design:type", Function),
__metadata("design:paramtypes", [String]),
__metadata("design:returntype", void 0)
], CapsuleBarChartStyleService.prototype, "setSubtotalType", null);
__decorate([
bind_1.default,
mobx_1.action,
__metadata("design:type", Function),
__metadata("design:paramtypes", [Number]),
__metadata("design:returntype", void 0)
], CapsuleBarChartStyleService.prototype, "setConstantValue", null);
__decorate([
bind_1.default,
mobx_1.action,
__metadata("design:type", Function),
__metadata("design:paramtypes", [String]),
__metadata("design:returntype", void 0)
], CapsuleBarChartStyleService.prototype, "setBarColor", null);
__decorate([
bind_1.default,
mobx_1.action,
__metadata("design:type", Function),
__metadata("design:paramtypes", [String]),
__metadata("design:returntype", void 0)
], CapsuleBarChartStyleService.prototype, "setBarShape", null);
__decorate([
bind_1.default,
mobx_1.action,
__metadata("design:type", Function),
__metadata("design:paramtypes", [Object]),
__metadata("design:returntype", void 0)
], CapsuleBarChartStyleService.prototype, "setDataFont", null);
__decorate([
bind_1.default,
mobx_1.action,
__metadata("design:type", Function),
__metadata("design:paramtypes", [Object]),
__metadata("design:returntype", void 0)
], CapsuleBarChartStyleService.prototype, "setLabelFont", null);
__decorate([
bind_1.default,
__metadata("design:type", Function),
__metadata("design:paramtypes", [String]),
__metadata("design:returntype", void 0)
], CapsuleBarChartStyleService.prototype, "setLabelPosition", null);
__decorate([
bind_1.default,
__metadata("design:type", Function),
__metadata("design:paramtypes", [Number]),
__metadata("design:returntype", void 0)
], CapsuleBarChartStyleService.prototype, "setLabelWidth", null);
__decorate([
bind_1.default,
__metadata("design:type", Function),
__metadata("design:paramtypes", [Number]),
__metadata("design:returntype", void 0)
], CapsuleBarChartStyleService.prototype, "setValueWidth", null);
return CapsuleBarChartStyleService;
}(one_d_1.default));
exports.default = CapsuleBarChartStyleService;