@microsoft/windows-admin-center-sdk
Version:
Microsoft - Windows Admin Center Shell
111 lines (110 loc) • 4.19 kB
TypeScript
import { AfterViewInit, ChangeDetectorRef, Injector, OnDestroy, OnInit } from '@angular/core';
import { ChartData, ChartOptions } from 'chart.js';
import { ChartComponent } from '../chart/chart.component';
import { CoreBaseComponent } from '../common/base.component';
import { LegendEntryData } from '../legend/legend-entry/legend-entry.component';
import * as i0 from "@angular/core";
export declare enum LineChartType {
/**
* Line chart takes in data as number[]
*/
Line = 1,
/**
* Scatter chart takes in data as ChartPoint[] with x and y coordinates
*/
Scatter = 2,
/**
* Historical chart takes in data at ChartPoint[] with x and y coordinates
* x coordinates or historical chart are in the format of an integer timestamp
* so that the tooltips can format the appropriate date
*/
Historical = 3
}
export interface LineChartData {
title: string;
chartData: ChartData;
currentValueLabel?: string;
firstCurrentValueLabel?: string;
secondCurrentValueLabel?: string;
totalCurrentValueLabel?: string;
firstLabel?: string;
secondLabel?: string;
totalLabel?: string;
yAxisMinLabel?: string;
yAxisMaxLabel?: string;
xAxisMaxLabel?: string;
xAxisMinLabel?: string;
ymaxValue?: number;
type?: LineChartType;
xAxisMin?: number;
xAxisMax?: number;
unitLabel?: string;
isLoading?: boolean;
}
export declare class LineChartComponent extends CoreBaseComponent implements OnInit, AfterViewInit, OnDestroy {
private changeDetectorRef;
/**
* The source name to use for logging
*/
protected get logSourceName(): string;
chart: ChartComponent;
/**
* Function to apply to tooltip data for pretty-printing the value
*/
tooltipFormatter: Function;
lineChartData: LineChartData;
useCustomSettings?: boolean;
chartLegendData: LegendEntryData[];
chartOptions: ChartOptions;
generatedLegendData: LegendEntryData[];
private readonly primaryLineColor;
private readonly primaryBackgroundColor;
private readonly secondaryLineColor;
private readonly secondaryBackgroundColor;
private readonly tertiaryLineColor;
private readonly tertiaryBackgroundColor;
private readonly defaultSettings;
get showLegend(): boolean;
/**
* Constructs a new instance of @see LineChartComponent
* @param injector the injector service for the base class of this component
* @param changeDetectorRef provides data change detection to the line chart
*/
constructor(injector: Injector, changeDetectorRef: ChangeDetectorRef);
/**
* Angular lifecycle hook, called after the component is initialized
*/
ngOnInit(): void;
private getDefaultOptions;
/**
* Angular lifecycle hook, called after the view is initialized
*/
ngAfterViewInit(): void;
ngOnDestroy(): void;
private useDefaultSettings;
/**
* generate legend data if currentValueLabelData is given
*/
generateLegendData(): void;
/**
* Throw error if consumer is trying to graph a scatter plot without x y coordinates
*/
private validateChartType;
/**
* return the string for the type of line chart
* @param type the type of line chart
*/
getTypeString(type: LineChartType): string;
/**
* Returns tool tip label according to the type of chart being used
* @param tooltipItem - the specific item that needs a tooltip
* @param data - the linearchartdata object
*/
private getTooltipLabel;
/**
* Refresh the chart when new data is added to lineChartData input
*/
refresh(): void;
static ɵfac: i0.ɵɵFactoryDeclaration<LineChartComponent, never>;
static ɵcmp: i0.ɵɵComponentDeclaration<LineChartComponent, "sme-line-chart", never, { "tooltipFormatter": "tooltipFormatter"; "lineChartData": "lineChartData"; "useCustomSettings": "useCustomSettings"; "chartLegendData": "chartLegendData"; "chartOptions": "chartOptions"; }, {}, never, never, false, never>;
}