UNPKG

2.86 kBJavaScriptView Raw
1/**
2 * Axis Label module
3 */
4import { __extends } from "tslib";
5/**
6 * ============================================================================
7 * IMPORTS
8 * ============================================================================
9 * @hidden
10 */
11import { Label } from "../../core/elements/Label";
12import { registry } from "../../core/Registry";
13/**
14 * ============================================================================
15 * MAIN CLASS
16 * ============================================================================
17 * @hidden
18 */
19/**
20 * Use to create labels on Axis.
21 *
22 * @see {@link IAxisLabelEvents} for a list of available events
23 * @see {@link IAxisLabelAdapters} for a list of available Adapters
24 * @important
25 */
26var AxisLabel = /** @class */ (function (_super) {
27 __extends(AxisLabel, _super);
28 /**
29 * Constructor
30 */
31 function AxisLabel() {
32 var _this = _super.call(this) || this;
33 _this.className = "AxisLabel";
34 _this.isMeasured = false;
35 _this.padding(10, 10, 10, 10);
36 _this.location = 0.5;
37 //this.nonScaling = true; // not good for perf
38 _this.applyTheme();
39 return _this;
40 }
41 Object.defineProperty(AxisLabel.prototype, "location", {
42 /**
43 * @return Location (0-1)
44 */
45 get: function () {
46 return this.getPropertyValue("location");
47 },
48 /**
49 * Relative location of the label. (0-1)
50 *
51 * @param value Location (0-1)
52 */
53 set: function (value) {
54 this.setPropertyValue("location", value, true);
55 },
56 enumerable: true,
57 configurable: true
58 });
59 Object.defineProperty(AxisLabel.prototype, "inside", {
60 /**
61 * Returns if label is set to be drawn inside axis.
62 *
63 * @return Inside?
64 */
65 get: function () {
66 return this.getPropertyValue("inside");
67 },
68 /**
69 * Sets if label should be drawn inside axis.
70 *
71 * @param value Inside?
72 */
73 set: function (value) {
74 this.setPropertyValue("inside", value, true);
75 },
76 enumerable: true,
77 configurable: true
78 });
79 /**
80 * @ignore
81 */
82 AxisLabel.prototype.setDisabled = function (value) {
83 var changed = _super.prototype.setDisabled.call(this, value);
84 if (this.axis) {
85 this.axis.invalidateDataItems();
86 }
87 return changed;
88 };
89 return AxisLabel;
90}(Label));
91export { AxisLabel };
92/**
93 * Register class in system, so that it can be instantiated using its name from
94 * anywhere.
95 *
96 * @ignore
97 */
98registry.registeredClasses["AxisLabel"] = AxisLabel;
99//# sourceMappingURL=AxisLabel.js.map
\No newline at end of file