-
Notifications
You must be signed in to change notification settings - Fork 0
/
sym-gaugeT2.js
56 lines (42 loc) · 1.4 KB
/
sym-gaugeT2.js
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
(function (PV) {
"use strict";
function symbolVis() { };
PV.deriveVisualizationFromBase(symbolVis);
var definition = {
typeName: "gaugeT2",
iconUrl: 'Scripts\\app\\editor\\symbols\\ext\\icons\\6.png',
visObjectType: symbolVis,
datasourceBehavior: PV.Extensibility.Enums.DatasourceBehaviors.Multiple,
getDefaultConfig: function () {
return {
DataShape: 'table',
Height: 150,
Width: 150,
}
},
}
symbolVis.prototype.init = function (scope, elem) {
am4core.useTheme(am4themes_animated);
var chart = am4core.create("chartContainergauget2", am4charts.GaugeChart);
chart.innerRadius = -15;
var axis = chart.xAxes.push(new am4charts.ValueAxis());
axis.min = 0;
axis.max = 100;
axis.strictMinMax = true;
var colorSet = new am4core.ColorSet();
var gradient = new am4core.LinearGradient();
gradient.stops.push({color:am4core.color("red")})
gradient.stops.push({color:am4core.color("yellow")})
gradient.stops.push({color:am4core.color("green")})
axis.renderer.line.stroke = gradient;
axis.renderer.line.strokeWidth = 15;
axis.renderer.line.strokeOpacity = 1;
axis.renderer.grid.template.disabled = true;
var hand = chart.hands.push(new am4charts.ClockHand());
hand.radius = am4core.percent(97);
setInterval(function() {
hand.showValue(40, 1000, am4core.ease.cubicOut);
}, 2000);
};
PV.symbolCatalog.register(definition);
})(window.PIVisualization);