@progress/kendo-angular-gauges
Version:
Kendo UI Angular Gauges
99 lines (98 loc) • 5.01 kB
JavaScript
/**-----------------------------------------------------------------------------------------
* Copyright © 2025 Progress Software Corporation. All rights reserved.
* Licensed under commercial license. See LICENSE.md in the project root for more information
*-------------------------------------------------------------------------------------------*/
import { ChangeDetectionStrategy, Component, ContentChild, Input } from '@angular/core';
import { L10N_PREFIX, LocalizationService } from '@progress/kendo-angular-l10n';
import { CircularGauge } from '@progress/kendo-charts';
import { CircularGaugeCenterTemplateDirective } from './center-template.directive';
import { ArcGaugeComponent } from '../arc-gauge/arc-gauge.component';
import { ConfigurationService } from '../services';
import { ResizeSensorComponent } from '@progress/kendo-angular-common';
import { NgTemplateOutlet } from '@angular/common';
import * as i0 from "@angular/core";
/**
* Represents the [Kendo UI CircularGauge component for Angular]({% slug overview_circulargauge_gauges %}).
*
* @example
* ```ts
* import { Component } from '@angular/core';
*
* _@Component({
* selector: 'my-app',
* template: `
* <kendo-circulargauge [value]="value" [scale]="{ max: 100 }">
* <ng-template kendoCircularGaugeCenterTemplate let-value="value">
* {{ value }}%
* </ng-template>
* </kendo-circulargauge>
* `
* })
* class AppComponent {
* public value: number = 10;
* }
* ```
*
* @remarks
* Supported children components are: {@link CircularGaugeScaleComponent}, {@link CircularGaugeLabelsComponent}, {@link CircularGaugeAreaComponent}.
*/
export class CircularGaugeComponent extends ArcGaugeComponent {
/**
* Specifies the scale options of the Gauge.
*/
scale;
centerTemplate;
createInstance(element, options, theme, context) {
this.instance = new CircularGauge(element, options, theme, context);
this.updateElements();
}
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: CircularGaugeComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.14", type: CircularGaugeComponent, isStandalone: true, selector: "kendo-circulargauge", inputs: { scale: "scale" }, providers: [
ConfigurationService,
LocalizationService,
{
provide: L10N_PREFIX,
useValue: 'kendo.circulargauge'
}
], queries: [{ propertyName: "centerTemplate", first: true, predicate: CircularGaugeCenterTemplateDirective, descendants: true }], exportAs: ["kendoCircularGauge"], usesInheritance: true, ngImport: i0, template: `
<div #surface class='k-chart-surface'></div>
(centerTemplate) {
<div class="k-arcgauge-label" #label>
<ng-template [ngTemplateOutlet]="centerTemplate.templateRef" [ngTemplateOutletContext]="centerTemplateContext"></ng-template>
</div>
}
<kendo-resize-sensor (resize)="onResize()" [rateLimit]="resizeRateLimit"></kendo-resize-sensor>
`, isInline: true, dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: ResizeSensorComponent, selector: "kendo-resize-sensor", inputs: ["rateLimit"], outputs: ["resize"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: CircularGaugeComponent, decorators: [{
type: Component,
args: [{
changeDetection: ChangeDetectionStrategy.OnPush,
exportAs: 'kendoCircularGauge',
providers: [
ConfigurationService,
LocalizationService,
{
provide: L10N_PREFIX,
useValue: 'kendo.circulargauge'
}
],
selector: 'kendo-circulargauge',
template: `
<div #surface class='k-chart-surface'></div>
(centerTemplate) {
<div class="k-arcgauge-label" #label>
<ng-template [ngTemplateOutlet]="centerTemplate.templateRef" [ngTemplateOutletContext]="centerTemplateContext"></ng-template>
</div>
}
<kendo-resize-sensor (resize)="onResize()" [rateLimit]="resizeRateLimit"></kendo-resize-sensor>
`,
standalone: true,
imports: [NgTemplateOutlet, ResizeSensorComponent]
}]
}], propDecorators: { scale: [{
type: Input
}], centerTemplate: [{
type: ContentChild,
args: [CircularGaugeCenterTemplateDirective, { static: false }]
}] } });