@qn-pandora/pandora-visualization
Version:
Pandora 通用可视化库
200 lines (199 loc) • 7.72 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 __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);
};
import { action, computed } from 'mobx';
import { ELayoutTYpe } from '@qn-pandora/pandora-component';
import bind from '../../../../../utils/bind';
import { defaultLevels } from '../../../../../constants/metric-panel-style';
import { ChartType } from '../../../../../constants';
import ChartStyleService, { styleOption } from '../base';
var NODE_COUNT = 50;
var TimeLineStyleService = /** @class */ (function (_super) {
__extends(TimeLineStyleService, _super);
function TimeLineStyleService(chart) {
var _this = _super.call(this, chart) || this;
_this.chartType = ChartType.TopoLogy;
_this.levels = defaultLevels;
_this.nodeRules = [];
_this.edgeRules = [];
_this.nodeCount = NODE_COUNT;
_this.layout = ELayoutTYpe.Fruchterman;
_this.showLabel = true;
_this.from = {};
_this.to = {};
_this.edgeRules = chart.edgeRules || [];
_this.nodeCount = chart.nodeCount || NODE_COUNT;
_this.layout = chart.layout || ELayoutTYpe.Fruchterman;
_this.levels = chart.levels || [];
_this.nodeRules = chart.nodeRules || [];
_this.showLabel = chart.showLabel || false;
_this.from = chart.from || {};
_this.to = chart.to || {};
return _this;
}
TimeLineStyleService.getChartInitStyle = function (option) {
return option;
};
Object.defineProperty(TimeLineStyleService.prototype, "contextOption", {
get: function () {
return {
buckets: [],
metrics: []
};
},
enumerable: false,
configurable: true
});
TimeLineStyleService.prototype.getOptions = function () {
return {
chartType: this.chartType,
levels: this.levels,
nodeRules: this.nodeRules,
edgeRules: this.edgeRules,
nodeCount: this.nodeCount,
nodeLayout: this.layout,
showLabel: this.showLabel,
layout: this.layout,
from: this.from,
to: this.to
};
};
TimeLineStyleService.prototype.setLevels = function (levels) {
this.levels = levels;
};
TimeLineStyleService.prototype.setNodeRules = function (nodeRules) {
this.nodeRules = nodeRules;
};
TimeLineStyleService.prototype.setEdgeRules = function (edgeRules) {
this.edgeRules = edgeRules;
};
TimeLineStyleService.prototype.setLayout = function (layout) {
this.layout = layout;
};
TimeLineStyleService.prototype.setShowLabel = function (showLabel) {
this.showLabel = showLabel;
};
TimeLineStyleService.prototype.setNodeCount = function (nodeCount) {
this.nodeCount = nodeCount;
};
TimeLineStyleService.prototype.setTo = function (to) {
this.to = to;
};
TimeLineStyleService.prototype.setFrom = function (from) {
this.from = from;
};
__decorate([
styleOption(),
__metadata("design:type", Array)
], TimeLineStyleService.prototype, "levels", void 0);
__decorate([
styleOption(),
__metadata("design:type", Array)
], TimeLineStyleService.prototype, "nodeRules", void 0);
__decorate([
styleOption(),
__metadata("design:type", Array)
], TimeLineStyleService.prototype, "edgeRules", void 0);
__decorate([
styleOption(),
__metadata("design:type", Number)
], TimeLineStyleService.prototype, "nodeCount", void 0);
__decorate([
styleOption(),
__metadata("design:type", String)
], TimeLineStyleService.prototype, "layout", void 0);
__decorate([
styleOption(),
__metadata("design:type", Boolean)
], TimeLineStyleService.prototype, "showLabel", void 0);
__decorate([
styleOption(),
__metadata("design:type", Object)
], TimeLineStyleService.prototype, "from", void 0);
__decorate([
styleOption(),
__metadata("design:type", Object)
], TimeLineStyleService.prototype, "to", void 0);
__decorate([
computed,
__metadata("design:type", Object),
__metadata("design:paramtypes", [])
], TimeLineStyleService.prototype, "contextOption", null);
__decorate([
bind,
action,
__metadata("design:type", Function),
__metadata("design:paramtypes", [Array]),
__metadata("design:returntype", void 0)
], TimeLineStyleService.prototype, "setLevels", null);
__decorate([
bind,
action,
__metadata("design:type", Function),
__metadata("design:paramtypes", [Array]),
__metadata("design:returntype", void 0)
], TimeLineStyleService.prototype, "setNodeRules", null);
__decorate([
bind,
action,
__metadata("design:type", Function),
__metadata("design:paramtypes", [Array]),
__metadata("design:returntype", void 0)
], TimeLineStyleService.prototype, "setEdgeRules", null);
__decorate([
bind,
action,
__metadata("design:type", Function),
__metadata("design:paramtypes", [String]),
__metadata("design:returntype", void 0)
], TimeLineStyleService.prototype, "setLayout", null);
__decorate([
bind,
action,
__metadata("design:type", Function),
__metadata("design:paramtypes", [Boolean]),
__metadata("design:returntype", void 0)
], TimeLineStyleService.prototype, "setShowLabel", null);
__decorate([
bind,
action,
__metadata("design:type", Function),
__metadata("design:paramtypes", [Number]),
__metadata("design:returntype", void 0)
], TimeLineStyleService.prototype, "setNodeCount", null);
__decorate([
bind,
action,
__metadata("design:type", Function),
__metadata("design:paramtypes", [Object]),
__metadata("design:returntype", void 0)
], TimeLineStyleService.prototype, "setTo", null);
__decorate([
bind,
action,
__metadata("design:type", Function),
__metadata("design:paramtypes", [Object]),
__metadata("design:returntype", void 0)
], TimeLineStyleService.prototype, "setFrom", null);
return TimeLineStyleService;
}(ChartStyleService));
export default TimeLineStyleService;