1 | /**
|
2 | * Module, defining Axis Renderer for vertical 3D axes.
|
3 | */
|
4 | import { __extends } from "tslib";
|
5 | /**
|
6 | * ============================================================================
|
7 | * IMPORTS
|
8 | * ============================================================================
|
9 | * @hidden
|
10 | */
|
11 | import { AxisRendererY } from "../axes/AxisRendererY";
|
12 | import { MutableValueDisposer } from "../../core/utils/Disposer";
|
13 | import * as $path from "../../core/rendering/Path";
|
14 | /**
|
15 | * ============================================================================
|
16 | * MAIN CLASS
|
17 | * ============================================================================
|
18 | * @hidden
|
19 | */
|
20 | /**
|
21 | * Renderer for vertical 3D axis.
|
22 | *
|
23 | * @see {@link IAxisRendererY3DEvents} for a list of available events
|
24 | * @see {@link IAxisRendererY3DAdapters} for a list of available Adapters
|
25 | */
|
26 | var AxisRendererY3D = /** @class */ (function (_super) {
|
27 | __extends(AxisRendererY3D, _super);
|
28 | /**
|
29 | * Constructor.
|
30 | *
|
31 | * @param axis Related axis
|
32 | */
|
33 | function AxisRendererY3D() {
|
34 | var _this = _super.call(this) || this;
|
35 | /**
|
36 | * A related chart.
|
37 | *
|
38 | * @todo Description
|
39 | */
|
40 | _this._chart = new MutableValueDisposer();
|
41 | _this.className = "AxisRendererY3D";
|
42 | _this._disposers.push(_this._chart);
|
43 | _this.applyTheme();
|
44 | return _this;
|
45 | }
|
46 | /**
|
47 | * Updates and positions a grid element.
|
48 | *
|
49 | * @ignore Exclude from docs
|
50 | * @param grid Grid element
|
51 | * @param position Starting position
|
52 | * @param endPosition End position
|
53 | */
|
54 | AxisRendererY3D.prototype.updateGridElement = function (grid, position, endPosition) {
|
55 | position = position + (endPosition - position) * grid.location;
|
56 | var point = this.positionToPoint(position);
|
57 | if (grid.element) {
|
58 | var dx = this.chart.dx3D || 0;
|
59 | var dy = this.chart.dy3D || 0;
|
60 | var w = this.getWidth();
|
61 | grid.path = $path.moveTo({ x: 0, y: 0 }) + $path.lineTo({ x: dx, y: dy }) + $path.lineTo({ x: w + dx, y: dy });
|
62 | }
|
63 | this.positionItem(grid, point);
|
64 | this.toggleVisibility(grid, position, 0, 1);
|
65 | };
|
66 | /**
|
67 | * Updates and positions the base grid element.
|
68 | *
|
69 | * @ignore Exclude from docs
|
70 | */
|
71 | AxisRendererY3D.prototype.updateBaseGridElement = function () {
|
72 | _super.prototype.updateBaseGridElement.call(this);
|
73 | var dx = this.chart.dx3D || 0;
|
74 | var dy = this.chart.dy3D || 0;
|
75 | var w = this.getWidth();
|
76 | this.baseGrid.path = $path.moveTo({ x: 0, y: 0 })
|
77 | + $path.lineTo({ x: w, y: 0 })
|
78 | + $path.lineTo({ x: w + dx, y: dy });
|
79 | };
|
80 | Object.defineProperty(AxisRendererY3D.prototype, "chart", {
|
81 | /**
|
82 | * @ignore Exclude from docs
|
83 | * @return Chart
|
84 | */
|
85 | get: function () {
|
86 | return this._chart.get();
|
87 | },
|
88 | /**
|
89 | * Chart, associated with the Axis.
|
90 | *
|
91 | * @ignore Exclude from docs
|
92 | * @param value Chart
|
93 | */
|
94 | set: function (chart) {
|
95 | if (chart) {
|
96 | this._chart.set(chart, chart.events.on("propertychanged", this.handle3DChanged, this, false));
|
97 | }
|
98 | },
|
99 | enumerable: true,
|
100 | configurable: true
|
101 | });
|
102 | /**
|
103 | * Invoked when 3D-related settings change, like depth or angle.
|
104 | *
|
105 | * @param event Event
|
106 | */
|
107 | AxisRendererY3D.prototype.handle3DChanged = function (event) {
|
108 | if (event.property == "depth" || event.property == "angle") {
|
109 | this.invalidate();
|
110 | }
|
111 | };
|
112 | return AxisRendererY3D;
|
113 | }(AxisRendererY));
|
114 | export { AxisRendererY3D };
|
115 | //# sourceMappingURL=AxisRendererY3D.js.map |
\ | No newline at end of file |