@c8y/ngx-components
Version:
Angular modules for Cumulocity IoT applications
143 lines • 6.1 kB
TypeScript
import { DatePipe } from '@c8y/ngx-components';
import type { EChartsOption, SeriesOption } from 'echarts';
import { ECharts } from 'echarts';
import { DatapointChartRenderType, DpWithValues } from '../models';
import { YAxisService } from './y-axis.service';
import { ChartTypesService } from './chart-types.service';
import type { CallbackDataParams } from 'echarts/types/src/util/types';
import { IAlarm, IEvent } from '@c8y/client';
import { CustomSeriesOptions } from '../models/chart.model';
import { Router } from '@angular/router';
import { AlarmSeverityToIconPipe, AlarmSeverityToLabelPipe } from '@c8y/ngx-components/alarms';
import { Interval } from '@c8y/ngx-components/interval-picker';
import * as i0 from "@angular/core";
export declare class EchartsOptionsService {
private datePipe;
private yAxisService;
private chartTypesService;
private severityIconPipe;
private severityLabelPipe;
private router;
echartsInstance: ECharts | undefined;
private TOOLTIP_WIDTH;
private tooltipPositionCallback;
constructor(datePipe: DatePipe, yAxisService: YAxisService, chartTypesService: ChartTypesService, severityIconPipe: AlarmSeverityToIconPipe, severityLabelPipe: AlarmSeverityToLabelPipe, router: Router);
getChartOptions(datapointsWithValues: DpWithValues[], timeRange: {
dateFrom: string;
dateTo: string;
interval: Interval['id'];
}, showSplitLines: {
YAxis: boolean;
XAxis: boolean;
}, events: IEvent[], alarms: IAlarm[], displayOptions: {
displayMarkedLine: boolean;
displayMarkedPoint: boolean;
mergeMatchingDatapoints: boolean;
showLabelAndUnit: boolean;
showSlider: boolean;
}, selectedTimeRange?: {
dateFrom: string;
dateTo: string;
interval: Interval['id'];
} | null, aggregatedDatapoints?: DpWithValues[], sliderZoomUsed?: boolean): EChartsOption;
calculateExtendedIntervalInMs(interval: Interval['id'], selectedTimeRange: any): number;
getAggregatedSeries(aggregatedDatapoints: DpWithValues[]): SeriesOption[];
/**
* This method is used to get the series for alarms and events.
* @param dp - The data point.
* @param renderType - The render type.
* @param isMinMaxChart - If the chart is min max chart.
* @param items - All alarms or events which should be displayed on the chart.
* @param itemType - The item type.
* @param id - The id of the device
*/
getAlarmOrEventSeries(dp: DpWithValues, renderType: DatapointChartRenderType, isMinMaxChart?: boolean, items?: IAlarm[] | IEvent[], itemType?: 'alarm' | 'event', displayOptions?: {
displayMarkedLine: boolean;
displayMarkedPoint: boolean;
}, id?: string | number, idx?: number, realtime?: boolean): CustomSeriesOptions[];
/**
* This method is used to get tooltip formatter for alarms and events.
* @param tooltipParams - The tooltip parameters.
* @param params - The parameters data.
* @param allEvents - All events.
* @param allAlarms - All alarms.
* @returns The formatted string for the tooltip.
*/
getTooltipFormatterForAlarmAndEvents(tooltipParams: CallbackDataParams, params: {
data: {
itemType: string;
};
}, allEvents: IEvent[], allAlarms: IAlarm[]): string;
private tooltipPosition;
/**
* This method is used to add the data point info to the tooltip.
* @param allDataPointSeries - All the data point series.
* @param XAxisValue - The X Axis value.
* @param YAxisReadings - The Y Axis readings.
*/
private processSeries;
/**
* This method is used to process the min series.
* @param series - The series.
* @param allDataPointSeries - All the data point series.
* @param XAxisValue - The X Axis value.
* @returns The processed value.
*/
private processMinSeries;
/**
* This method is used to process the regular series.
* @param series - The series.
* @param XAxisValue - The X Axis value.
* @returns The processed value.
*/
private processRegularSeries;
/**
* This method is used to process the event tooltip.
* @param event - The event object.
* @returns The processed value.
*/
private processEvent;
/**
* This method is used to process the alarm tooltip.
* @param alarm - The alarm object.
* @returns The processed value.
*/
private processAlarm;
private alarmRouteExists;
private getChartSeries;
private groupByType;
/**
* This method interpolates between two data points. The goal is to place the markPoint on the chart in the right place.
* @param dpValuesArray array of data points
* @param targetTime time of the alarm or event
* @returns interpolated data point
*/
private interpolateBetweenTwoDps;
private getClosestDpValueToTargetTime;
/**
* This method creates a markPoint on the chart which represents the icon of the alarm or event.
* @param item Single alarm or event
* @param dp Data point
* @param isCleared If the alarm is cleared in case of alarm
* @param isEvent If the item is an event
* @param realtime If the chart is in realtime mode
* @returns MarkPointDataItemOption[]
*/
private createMarkPoint;
/**
* This method creates a markLine on the chart which represents the line between every alarm or event on the chart.
* @param items Array of alarms or events
* @returns MarkLineDataItemOptionBase[]
*/
private createMarkLine;
private getSingleSeries;
/**
* This method creates a general tooltip formatter for the chart.
* @returns TooltipFormatterCallback<TopLevelFormatterParams>
*/
private getTooltipFormatter;
private findValueForExactOrEarlierTimestamp;
static ɵfac: i0.ɵɵFactoryDeclaration<EchartsOptionsService, never>;
static ɵprov: i0.ɵɵInjectableDeclaration<EchartsOptionsService>;
}
//# sourceMappingURL=echarts-options.service.d.ts.map