This repository was archived by the owner on Jul 30, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathdirection.js
More file actions
140 lines (140 loc) · 8.67 KB
/
direction.js
File metadata and controls
140 lines (140 loc) · 8.67 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
"use strict";
var __extends = (this && this.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
/**
* Sample for direction compass
*/
var React = require("react");
var property_pane_1 = require("../common/property-pane");
var ej2_react_circulargauge_1 = require("@syncfusion/ej2-react-circulargauge");
var sample_base_1 = require("../common/sample-base");
var ej2_dropdowns_1 = require("@syncfusion/ej2-dropdowns");
var SAMPLE_CSS = "\n .control-fluid {\n\t\tpadding: 0px !important;\n }";
var Direction = (function (_super) {
__extends(Direction, _super);
function Direction() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.loaded = false;
return _this;
}
Direction.prototype.onLabelRender = function (args) {
args.text = ['N', 'NE', 'E', 'SE', 'S', 'SW', 'W', 'NW', ''][args.value];
};
;
Direction.prototype.load = function (args) {
var selectedTheme = location.hash.split('/')[1];
selectedTheme = selectedTheme ? selectedTheme : 'Material';
args.gauge.theme = (selectedTheme.charAt(0).toUpperCase() + selectedTheme.slice(1));
};
Direction.prototype.onChartLoad = function (args) {
var _this = this;
if (!this.loaded) {
this.loaded = true;
this.pointerColor = new ej2_dropdowns_1.DropDownList({
index: 0,
placeholder: 'Select Range Bar Color',
width: 100,
change: function () {
var rangeColor = _this.pointerColor.value.toString();
_this.gauge.axes[0].pointers[0].color = rangeColor;
_this.gauge.setPointerValue(0, 0, _this.gauge.axes[0].pointers[0].value);
}
});
this.pointerColor.appendTo('#poiterColor');
this.labelColor = new ej2_dropdowns_1.DropDownList({
index: 0,
placeholder: 'Select Range Bar Color',
width: 100,
change: function () {
var rangeColor = _this.labelColor.value.toString();
_this.gauge.axes[0].ranges[0].color = rangeColor;
_this.gauge.refresh();
}
});
this.labelColor.appendTo('#labelColor');
}
};
Direction.prototype.render = function () {
var _this = this;
return (React.createElement("div", { className: 'control-pane' },
React.createElement("div", { className: 'control-section row' },
React.createElement("div", { className: 'col-lg-8' },
React.createElement(ej2_react_circulargauge_1.CircularGaugeComponent, { load: this.load.bind(this), id: 'direction-gauge', ref: function (gauge) { return _this.gauge = gauge; }, axisLabelRender: this.onLabelRender.bind(this), loaded: this.onChartLoad.bind(this) },
React.createElement(ej2_react_circulargauge_1.AxesDirective, null,
React.createElement(ej2_react_circulargauge_1.AxisDirective, { radius: '70%', startAngle: 0, endAngle: 360, minimum: 0, maximum: 8, majorTicks: {
height: 15,
interval: 1,
color: '#9E9E9E'
}, lineStyle: { width: 10, color: '#E0E0E0' }, minorTicks: {
height: 10,
interval: 0.5,
color: '#9E9E9E'
}, labelStyle: {
font: {
size: '12px', fontFamily: 'Roboto'
},
useRangeColor: true,
autoAngle: true,
hiddenLabel: 'Last'
} },
React.createElement(ej2_react_circulargauge_1.PointersDirective, null,
React.createElement(ej2_react_circulargauge_1.PointerDirective, { value: 7, radius: '50%', color: '#f03e3e', pointerWidth: 20, cap: {
radius: 0
}, animation: {
enable: false
} }),
React.createElement(ej2_react_circulargauge_1.PointerDirective, { value: 3, radius: '50%', color: '#9E9E9E', pointerWidth: 20, cap: {
radius: 0
}, animation: {
enable: false
} })),
React.createElement(ej2_react_circulargauge_1.RangesDirective, null,
React.createElement(ej2_react_circulargauge_1.RangeDirective, { start: 7, end: 7, color: '#f03e3e' })))))),
React.createElement("div", { className: 'col-lg-4 property-section' },
React.createElement(property_pane_1.PropertyPane, { title: 'Properties' },
React.createElement("table", { id: 'property', title: 'Properties', className: 'property-panel-table', style: { width: '100%' } },
React.createElement("tbody", null,
React.createElement("tr", { style: { height: '50px' } },
React.createElement("td", null,
React.createElement("div", { id: '' }, "Pointer Color")),
React.createElement("td", null,
React.createElement("div", null,
React.createElement("select", { id: "poiterColor", className: "form-control" },
React.createElement("option", { value: "#f03e3e" }, "#f03e3e"),
React.createElement("option", { value: "#4472c4" }, "#4472c4"),
React.createElement("option", { value: "#ed7d31" }, "#ed7d31"))))),
React.createElement("tr", { style: { height: '50px' } },
React.createElement("td", null,
React.createElement("div", { id: '' }, "Label Color")),
React.createElement("td", null,
React.createElement("div", null,
React.createElement("select", { id: "labelColor", className: "form-control" },
React.createElement("option", { value: "#f03e3e" }, "#f03e3e"),
React.createElement("option", { value: "#4472c4" }, "#4472c4"),
React.createElement("option", { value: "#ed7d31" }, "#ed7d31")))))))))),
React.createElement("div", { id: "action-description" },
React.createElement("p", null, "This sample illustrates how to make a direction compass by using the features in gauge. Color of the needle and direction labels can be customized by using options.")),
React.createElement("div", { id: "description" },
React.createElement("p", null,
"Circular gauge can be customized as per a user requirement. In this example, a direction compass has been depicted by adding ",
React.createElement("code", null, "needles"),
" and by customizing the ",
React.createElement("code", null, "labels"),
" to show the direction."),
React.createElement("p", null,
"More information on the needle and labels can be found in this",
React.createElement("a", { target: "_blank", href: "http://ej2.syncfusion.com/documentation" }, " documentation section"),
"."))));
};
return Direction;
}(sample_base_1.SampleBase));
exports.Direction = Direction;