jqwidgets-scripts-custom
Version:
jQWidgets is an advanced jQuery, Angular 7, Vue, React, ASP .NET MVC, Custom Elements and HTML5 UI framework.
44 lines (36 loc) • 1.16 kB
text/typescript
import { Component, ViewChild } from '@angular/core';
import { jqxBarGaugeComponent } from 'jqwidgets-scripts/jqwidgets-ts/angular_jqxbargauge';
({
selector: 'app-root',
templateUrl: './app.component.html'
})
export class AppComponent {
('myBarGauge') myBarGauge: jqxBarGaugeComponent;
formatFunction(value: number, index: number, color: string): string {
let barGaugePalette = ['#307DD7', '#AA4643', '#89A54E', '#71588F', '#4198AF'];
if (value < 20) {
return barGaugePalette[0];
}
if (value < 40) {
return barGaugePalette[1];
}
if (value < 60) {
return barGaugePalette[2];
}
if (value < 80) {
return barGaugePalette[3];
}
if (value <= 100) {
return barGaugePalette[4];
}
}
getRandomInt(min: number, max: number): number {
return Math.floor(Math.random() * (max - min)) + min;
}
onDrawEnd(): void {
let values = [this.getRandomInt(1, 99)];
setTimeout(() => {
this.myBarGauge.val(values);
}, 1000);
}
}