jqwidgets-framework
Version:
jQWidgets is an advanced Angular, Vue, Blazor, React, Web Components, jquery, ASP .NET MVC, Custom Elements and HTML5 UI framework.
169 lines (140 loc) • 5.97 kB
text/typescript
import { Component, ViewChild } from '@angular/core';
import { jqxBulletChartComponent } from 'jqwidgets-ng/jqxbulletchart';
import { jqxCheckBoxComponent } from 'jqwidgets-ng/jqxcheckbox';
import { jqxDropDownListComponent } from 'jqwidgets-ng/jqxdropdownlist';
import { jqxExpanderComponent } from 'jqwidgets-ng/jqxexpander';
import { jqxRadioButtonComponent } from 'jqwidgets-ng/jqxradiobutton';
import { jqxSliderComponent } from 'jqwidgets-ng/jqxslider';
export class AppComponent {
myBulletChart: jqxBulletChartComponent;
showLabelsCheckbox: jqxCheckBoxComponent;
disabledCheckbox: jqxCheckBoxComponent;
rtlCheckbox: jqxCheckBoxComponent;
enableAnimationCheckbox: jqxCheckBoxComponent;
nearRadio: jqxRadioButtonComponent;
farRadio: jqxRadioButtonComponent;
bothRadio: jqxRadioButtonComponent;
currencyRadio: jqxRadioButtonComponent;
percentRadio: jqxRadioButtonComponent;
noneRadio: jqxRadioButtonComponent;
valueSlider: jqxSliderComponent;
pointerDropDownList: jqxDropDownListComponent;
targetDropDownList: jqxDropDownListComponent;
ranges: any[] =
[
{ startValue: 0, endValue: 200, color: '#000000', opacity: 0.5 },
{ startValue: 200, endValue: 250, color: '#000000', opacity: 0.3 },
{ startValue: 250, endValue: 300, color: '#000000', opacity: 0.1 }
];
pointer: any = { value: 270, label: 'Revenue 2019 YTD', size: '25%', color: '' };
target: any = { value: 260, label: 'Revenue 2018 YTD', size: 4, color: '' };
ticks: any = { position: 'both', interval: 50, size: 10 };
colorChoices: string[] = ['Black', 'Red', 'Green', 'Blue', 'From theme'];
showLabelsCheckboxChange(event: any): void {
if (this.myBulletChart && this.nearRadio && this.farRadio && this.bothRadio) {
if (event.args.checked) {
this.nearRadio.enable();
this.farRadio.enable();
this.bothRadio.enable();
if (this.nearRadio.checked() === true) {
this.myBulletChart.ticks({ position: 'near' });
} else if (this.farRadio.checked() === true) {
this.myBulletChart.ticks({ position: 'far' });
} else {
this.myBulletChart.ticks({ position: 'both' });
}
} else {
this.myBulletChart.ticks({ position: 'none' });
this.nearRadio.disable();
this.farRadio.disable();
this.bothRadio.disable();
}
}
}
nearRadioChecked(): void {
if (this.myBulletChart) {
this.myBulletChart.ticks({ position: 'near' });
}
}
farRadioChecked(): void {
if (this.myBulletChart) {
this.myBulletChart.ticks({ position: 'far' });
}
}
bothRadioChecked(): void {
if (this.myBulletChart) {
this.myBulletChart.ticks({ position: 'both' });
}
}
currencyRadioChecked(): void {
if (this.myBulletChart) {
this.myBulletChart.labelsFormat('c');
}
}
percentRadioChecked(): void {
if (this.myBulletChart) {
this.myBulletChart.labelsFormat('p');
}
}
noneRadioChecked(): void {
if (this.myBulletChart) {
this.myBulletChart.labelsFormat(null);
}
}
enableAnimationCheckboxChange(event: any): void {
if (this.myBulletChart) {
if (event.args.checked) {
this.myBulletChart.animationDuration(400);
} else {
this.myBulletChart.animationDuration(0);
}
}
}
valueSliderChange(event: any): void {
if (this.myBulletChart) {
this.myBulletChart.val(event.args.value);
}
}
pointerDropDownListChange(event: any): void {
if (this.myBulletChart) {
const choice = event.args.item.label;
let newColor = '';
if (choice !== 'From theme') {
newColor = choice;
}
this.myBulletChart.pointer({ color: newColor });
}
}
targetDropDownListChange(event: any): void {
if (this.myBulletChart) {
const choice = event.args.item.label;
let newColor = '';
if (choice !== 'From theme') {
newColor = choice;
}
this.myBulletChart.target({ color: newColor });
}
}
disabledCheckboxChange(event: any): void {
if (this.myBulletChart) {
if (event.args.checked) {
this.myBulletChart.disabled(true);
} else {
this.myBulletChart.disabled(false);
}
}
}
rtlCheckboxChange(event: any): void {
if (this.myBulletChart) {
if (event.args.checked) {
this.myBulletChart.rtl(true);
} else {
this.myBulletChart.rtl(false);
}
}
}
}