igniteui-angular-charts
Version:
Ignite UI Angular charting components for building rich data visualizations for modern web apps.
79 lines (78 loc) • 4.47 kB
JavaScript
/*
THIS INFRAGISTICS ULTIMATE SOFTWARE LICENSE AGREEMENT ("AGREEMENT") LOCATED HERE:
https://www.infragistics.com/legal/license/igultimate-la
https://www.infragistics.com/legal/license/igultimate-eula
GOVERNS THE LICENSING, INSTALLATION AND USE OF INFRAGISTICS SOFTWARE. BY DOWNLOADING AND/OR INSTALLING AND USING INFRAGISTICS SOFTWARE: you are indicating that you have read and understand this Agreement, and agree to be legally bound by it on behalf of the yourself and your company.
*/
import { Component, EventEmitter, Output, ViewChild, ChangeDetectionStrategy, TemplateRef, ChangeDetectorRef } from '@angular/core';
import { CommonModule } from '@angular/common';
import { TypeRegistrar } from "igniteui-angular-core";
import * as i0 from "@angular/core";
export class IgxDoughnutChartDefaultTooltipsComponent {
constructor(_changeDetectorRef) {
this._changeDetectorRef = _changeDetectorRef;
this.onContentReady = new EventEmitter();
}
ensureDefaultTooltip(series) {
if (series.showDefaultTooltip) {
series.tooltipTemplate = this.doughnutSliceTooltip;
}
else {
if (series.tooltipTemplate === this.doughnutSliceTooltip) {
series.tooltipTemplate = null;
}
}
}
getSliceLabel(series, item) {
return item[series.labelMemberPath];
}
getValue(series, item) {
return item[this.getValueMemberPath(series)];
}
getValueMemberPath(series) {
return series.valueMemberPath;
}
getBrush(i) {
if (i.slice.background)
return i.slice.background.fill;
return "black";
}
static { this._registered = false; }
static register() {
if (IgxDoughnutChartDefaultTooltipsComponent._registered)
return;
IgxDoughnutChartDefaultTooltipsComponent._registered = true;
TypeRegistrar.registerCons("IgxDoughnutChartDefaultTooltipsComponent", IgxDoughnutChartDefaultTooltipsComponent);
}
static { IgxDoughnutChartDefaultTooltipsComponent.register(); }
ngAfterContentInit() {
this.onContentReady.emit({});
}
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.0-rc.1", ngImport: i0, type: IgxDoughnutChartDefaultTooltipsComponent, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component }); }
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "22.0.0-rc.1", type: IgxDoughnutChartDefaultTooltipsComponent, isStandalone: true, selector: "igx-dougnut-chart-default-tooltips", outputs: { onContentReady: "onContentReady" }, viewQueries: [{ propertyName: "doughnutSliceTooltip", first: true, predicate: ["doughnutSliceTooltip"], descendants: true, static: true }], ngImport: i0, template: `
<ng-template #doughnutSliceTooltip let-series="series" let-item="item" let-implementation="i">
<div class='ui-chart-default-tooltip-content'>
<span [style.color]="getBrush(implementation)">{{getSliceLabel(series, item)}}</span>
<br/>
<span class="ui-tooltip-priority">{{getValueMemberPath(series)}} : {{getValue(series, item)}}</span>
</div>
</ng-template>
`, isInline: true, dependencies: [{ kind: "ngmodule", type: CommonModule }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.0-rc.1", ngImport: i0, type: IgxDoughnutChartDefaultTooltipsComponent, decorators: [{
type: Component,
args: [{ selector: 'igx-dougnut-chart-default-tooltips', changeDetection: ChangeDetectionStrategy.OnPush, imports: [CommonModule], template: `
<ng-template #doughnutSliceTooltip let-series="series" let-item="item" let-implementation="i">
<div class='ui-chart-default-tooltip-content'>
<span [style.color]="getBrush(implementation)">{{getSliceLabel(series, item)}}</span>
<br/>
<span class="ui-tooltip-priority">{{getValueMemberPath(series)}} : {{getValue(series, item)}}</span>
</div>
</ng-template>
` }]
}], ctorParameters: () => [{ type: i0.ChangeDetectorRef }], propDecorators: { doughnutSliceTooltip: [{
type: ViewChild,
args: ["doughnutSliceTooltip", { static: true }]
}], onContentReady: [{
type: Output
}] } });