BoldSignEasily embed eSignatures in your .NET applications. Free sandbox with native SDK available.
<ejs-circulargauge style='display:block;' #circulargauge enablePointerDrag=true (load)='load($event)' (dragMove)='dragMove($event)'>
<e-axis>
-----------
------------ // Other Customization
<e-annotations>
<e-annotation zIndex='1' content='<div style="color: white">Priority1: <span style="color: yellow;">68.32</span></div>' radius='135%'>
</e-annotation>
<e-annotation zIndex='1' content='<div style="color: white">Priority3: <span style="color: green;">94.50</span></div>' radius='155%'>
</e-annotation>
<e-annotation zIndex='1' content='<div style="color: white">Priority2: <span style="color: red;">39.53</span></div>' radius='135%'>
</e-annotation>
<e-annotation zIndex='1' content='<div style="color: white">Priority3: <span style="color: red;">18.00</span></div>' radius='140%'>
</e-annotation>
</e-annotations>
</e-axis>
</ejs-circulargauge>
export class DefaultComponent {
@ViewChild('circulargauge')
public circulargauge: CircularGaugeComponent;
public markerHeight: number = 10;
public markerWidth: number = 30;
public startAngle: number = 270;
public endAngle: number = 90;
public minimum: number = 0;
public maximum: number = 100;
public angleDiff: number;
public pointerAngle: number;
public valueAngle: number;
public valueDiff: number;
public perValueRadius: number;
public initialAnnotationRadius: number = 140;
// custom code start
--------------
public load(args: ILoadedEventArgs): void {
args.gauge.theme = "HighContrast";
this.angleDiff = Math.abs(this.startAngle - this.endAngle);
this.valueDiff = this.maximum - this.minimum;
this.valueAngle = this.angleDiff / this.valueDiff;
this.perValueRadius = 10 / this.valueDiff;
for(let i = 0; i < args.gauge.axes[0].annotations.length; i++) {
this.pointerAngle = (((args.gauge.axes[0].pointers[i].value - this.minimum) * this.valueAngle) + this.startAngle);
args.gauge.axes[0].annotations[i].angle = (this.pointerAngle > 360) ? (this.pointerAngle - 360) : this.pointerAngle;
}
}
public dragMove(args: IPointerDragEventArgs): void {
let index: number = args.pointerIndex;
this.pointerAngle = (((args.currentValue - this.minimum) * this.valueAngle) + this.startAngle);
this.circulargauge.activeAxis.annotations[index].angle = (this.pointerAngle > 360) ? (this.pointerAngle - 360) : this.pointerAngle;
if (args.currentValue < 20) { this.circulargauge.activeAxis.annotations[index].radius = '140%'; }
else if (args.currentValue > 70) { this.circulargauge.activeAxis.annotations[index].radius = '150%'; }
else { this.circulargauge.activeAxis.annotations[index].radius = '130%'; }
if (args.currentValue >= 0 && args.currentValue <= 50) {
args.pointer.color = 'red';
} else if (args.currentValue > 50 && args.currentValue < 90) {
args.pointer.color = 'yellow';
} else {
args.pointer.color = 'green';
}
args.pointer.value = args.currentValue;
args.pointer.animation.enable = false;
if(index === 0) {
this.circulargauge.setAnnotationValue(0, index, '<div style="color: white"> Priority1: <span style="color:' + args.pointer.color + '">' + args.currentValue.toFixed(2) + '</span></div>');
} else if (index === 2 ) {
this.circulargauge.setAnnotationValue(0, index, '<div style="color: white"> Priority2: <span style="color:' + args.pointer.color + '">' + args.currentValue.toFixed(2) + '</span></div>');
} else {
this.circulargauge.setAnnotationValue(0, index, '<div style="color: white"> Priority3: <span style="color:' + args.pointer.color + '">' + args.currentValue.toFixed(2) + '</span></div>');
}
this.circulargauge.refresh();
};
} |