@qn-pandora/pandora-visualization
Version:
Pandora 通用可视化库
192 lines (191 loc) • 8.74 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 base_1 = __importDefault(require("./base"));
var base_2 = require("../base");
var PieRingBaseStyleService = /** @class */ (function (_super) {
__extends(PieRingBaseStyleService, _super);
function PieRingBaseStyleService(chart) {
var _this = _super.call(this, chart) || this;
// 标题字体
_this.titleFont = chart_style_1.InitTitleFont;
// 标题的数值字体
_this.titleDataFont = chart_style_1.InitDataFontStyle;
_this.showTitleBucket = false;
// 标题数值显示格式
_this.titleDataFormat = "hide" /* Hide */;
// 环图宽度
_this.circularWidth = 30;
// 环图轮播是否开启
_this.circularPlay = "off" /* Off */;
// 环图轮播时间间隔
_this.circularPlayInterval = 2;
// 数值百分比模式显示时, 百分比精确的位数
_this.titleDataPercentDecimals = 2;
_this.circularWidth = chart.circularWidth || 30;
_this.circularPlay = chart.circularPlay || "off" /* Off */;
_this.circularPlayInterval = chart.circularPlayInterval || 2;
// 兼容老数据
_this.showTitleBucket =
chart.showTitleBucket ||
(chart.circularPlay === "on" /* On */ && !!chart.showTitle);
_this.titleFont = chart.titleFont || chart_style_1.InitTitleFont;
_this.titleDataFont = chart.titleDataFont || chart_style_1.InitDataFontStyle;
// 兼容老数据
_this.titleDataFormat =
chart.showTitle === false
? "hide" /* Hide */
: chart.titleDataFormat || "hide" /* Hide */;
_this.sectorOffset = chart.sectorOffset;
return _this;
}
PieRingBaseStyleService.prototype.setTitleDataFont = function (font) {
this.titleDataFont = font;
};
PieRingBaseStyleService.prototype.setTitleFont = function (font) {
this.titleFont = font;
};
PieRingBaseStyleService.prototype.setCircularWidth = function (circularWidth) {
this.circularWidth = circularWidth;
};
PieRingBaseStyleService.prototype.setCircularPlayInterval = function (circularPlayInterval) {
this.circularPlayInterval = circularPlayInterval;
};
PieRingBaseStyleService.prototype.setTitleDataPercentDecimals = function (titleDataPercentDecimals) {
this.titleDataPercentDecimals = titleDataPercentDecimals;
};
PieRingBaseStyleService.prototype.setTitleDataFormat = function (titleDataFormat) {
this.titleDataFormat = titleDataFormat;
};
PieRingBaseStyleService.prototype.setEnableCircularPiePlay = function (circularPlay) {
this.circularPlay = circularPlay;
};
PieRingBaseStyleService.prototype.getOptions = function () {
return __assign(__assign({}, _super.prototype.getOptions.call(this)), { circularWidth: this.circularWidth, circularPlay: this.circularPlay, circularPlayInterval: this.circularPlayInterval, showTitleBucket: this.showTitleBucket, titleFont: this.titleFont, titleDataFont: this.titleDataFont, titleDataFormat: this.titleDataFormat });
};
__decorate([
base_2.styleOption(),
__metadata("design:type", Object)
], PieRingBaseStyleService.prototype, "titleFont", void 0);
__decorate([
base_2.styleOption(),
__metadata("design:type", Object)
], PieRingBaseStyleService.prototype, "titleDataFont", void 0);
__decorate([
base_2.styleOption(),
__metadata("design:type", Boolean)
], PieRingBaseStyleService.prototype, "showTitleBucket", void 0);
__decorate([
base_2.styleOption(),
__metadata("design:type", String)
], PieRingBaseStyleService.prototype, "titleDataFormat", void 0);
__decorate([
base_2.styleOption(),
__metadata("design:type", Number)
], PieRingBaseStyleService.prototype, "circularWidth", void 0);
__decorate([
base_2.styleOption(),
__metadata("design:type", String)
], PieRingBaseStyleService.prototype, "circularPlay", void 0);
__decorate([
base_2.styleOption(),
__metadata("design:type", Number)
], PieRingBaseStyleService.prototype, "circularPlayInterval", void 0);
__decorate([
base_2.styleOption(),
__metadata("design:type", Number)
], PieRingBaseStyleService.prototype, "titleDataPercentDecimals", void 0);
__decorate([
base_2.styleOption(),
__metadata("design:type", Number)
], PieRingBaseStyleService.prototype, "sectorOffset", void 0);
__decorate([
bind_1.default,
mobx_1.action,
__metadata("design:type", Function),
__metadata("design:paramtypes", [Object]),
__metadata("design:returntype", void 0)
], PieRingBaseStyleService.prototype, "setTitleDataFont", null);
__decorate([
bind_1.default,
mobx_1.action,
__metadata("design:type", Function),
__metadata("design:paramtypes", [Object]),
__metadata("design:returntype", void 0)
], PieRingBaseStyleService.prototype, "setTitleFont", null);
__decorate([
bind_1.default,
mobx_1.action,
__metadata("design:type", Function),
__metadata("design:paramtypes", [Number]),
__metadata("design:returntype", void 0)
], PieRingBaseStyleService.prototype, "setCircularWidth", null);
__decorate([
bind_1.default,
mobx_1.action,
__metadata("design:type", Function),
__metadata("design:paramtypes", [Number]),
__metadata("design:returntype", void 0)
], PieRingBaseStyleService.prototype, "setCircularPlayInterval", null);
__decorate([
bind_1.default,
mobx_1.action,
__metadata("design:type", Function),
__metadata("design:paramtypes", [Number]),
__metadata("design:returntype", void 0)
], PieRingBaseStyleService.prototype, "setTitleDataPercentDecimals", null);
__decorate([
bind_1.default,
mobx_1.action,
__metadata("design:type", Function),
__metadata("design:paramtypes", [String]),
__metadata("design:returntype", void 0)
], PieRingBaseStyleService.prototype, "setTitleDataFormat", null);
__decorate([
bind_1.default,
mobx_1.action,
__metadata("design:type", Function),
__metadata("design:paramtypes", [String]),
__metadata("design:returntype", void 0)
], PieRingBaseStyleService.prototype, "setEnableCircularPiePlay", null);
return PieRingBaseStyleService;
}(base_1.default));
exports.default = PieRingBaseStyleService;