2019-09-12 19:58:42 +03:00
|
|
|
///
|
2023-01-31 10:43:56 +02:00
|
|
|
/// Copyright © 2016-2023 The Thingsboard Authors
|
2019-09-12 19:58:42 +03:00
|
|
|
///
|
|
|
|
|
/// Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
|
/// you may not use this file except in compliance with the License.
|
|
|
|
|
/// You may obtain a copy of the License at
|
|
|
|
|
///
|
|
|
|
|
/// http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
|
///
|
|
|
|
|
/// Unless required by applicable law or agreed to in writing, software
|
|
|
|
|
/// distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
|
/// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
|
/// See the License for the specific language governing permissions and
|
|
|
|
|
/// limitations under the License.
|
|
|
|
|
///
|
|
|
|
|
|
2019-12-23 14:36:44 +02:00
|
|
|
// tslint:disable-next-line:no-reference
|
|
|
|
|
/// <reference path="../../../../../../../src/typings/jquery.flot.typings.d.ts" />
|
|
|
|
|
|
2022-09-13 17:01:52 +03:00
|
|
|
import { DataKey, Datasource, DatasourceData, FormattedData, JsonSettingsSchema } from '@shared/models/widget.models';
|
2021-10-19 22:22:06 +03:00
|
|
|
import { DataKeyType } from '@shared/models/telemetry/telemetry.models';
|
2021-03-18 19:45:45 +02:00
|
|
|
import { ComparisonDuration } from '@shared/models/time/time.models';
|
2019-09-12 19:58:42 +03:00
|
|
|
|
|
|
|
|
export declare type ChartType = 'line' | 'pie' | 'bar' | 'state' | 'graph';
|
|
|
|
|
|
|
|
|
|
export declare type TbFlotSettings = TbFlotBaseSettings & TbFlotGraphSettings & TbFlotBarSettings & TbFlotPieSettings;
|
|
|
|
|
|
2022-09-13 17:01:52 +03:00
|
|
|
export declare type TooltipValueFormatFunction = (value: any, latestData: FormattedData) => string;
|
2019-09-12 19:58:42 +03:00
|
|
|
|
|
|
|
|
export declare type TbFlotTicksFormatterFunction = (t: number, a?: TbFlotPlotAxis) => string;
|
|
|
|
|
|
|
|
|
|
export interface TbFlotSeries extends DatasourceData, JQueryPlotSeriesOptions {
|
|
|
|
|
dataKey: TbFlotDataKey;
|
2020-02-24 17:16:02 +02:00
|
|
|
xaxisIndex?: number;
|
2019-09-12 19:58:42 +03:00
|
|
|
yaxisIndex?: number;
|
|
|
|
|
yaxis?: number;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export interface TbFlotDataKey extends DataKey {
|
|
|
|
|
settings?: TbFlotKeySettings;
|
|
|
|
|
tooltipValueFormatFunction?: TooltipValueFormatFunction;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export interface TbFlotPlotAxis extends JQueryPlotAxis, TbFlotAxisOptions {
|
|
|
|
|
options: TbFlotAxisOptions;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export interface TbFlotAxisOptions extends JQueryPlotAxisOptions {
|
|
|
|
|
tickUnits?: string;
|
|
|
|
|
hidden?: boolean;
|
|
|
|
|
keysInfo?: Array<{hidden: boolean}>;
|
|
|
|
|
ticksFormatterFunction?: TbFlotTicksFormatterFunction;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export interface TbFlotPlotDataSeries extends JQueryPlotDataSeries {
|
2020-02-24 17:16:02 +02:00
|
|
|
datasource?: Datasource;
|
2019-09-12 19:58:42 +03:00
|
|
|
dataKey?: TbFlotDataKey;
|
|
|
|
|
percent?: number;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export interface TbFlotPlotItem extends jquery.flot.item {
|
|
|
|
|
series: TbFlotPlotDataSeries;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export interface TbFlotHoverInfo {
|
|
|
|
|
seriesHover: Array<TbFlotSeriesHoverInfo>;
|
|
|
|
|
time?: any;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export interface TbFlotSeriesHoverInfo {
|
|
|
|
|
hoverIndex: number;
|
|
|
|
|
units: string;
|
|
|
|
|
decimals: number;
|
|
|
|
|
label: string;
|
|
|
|
|
color: string;
|
|
|
|
|
index: number;
|
|
|
|
|
tooltipValueFormatFunction: TooltipValueFormatFunction;
|
|
|
|
|
value: any;
|
|
|
|
|
time: any;
|
|
|
|
|
distance: number;
|
|
|
|
|
}
|
|
|
|
|
|
2020-02-26 18:15:04 +02:00
|
|
|
export interface TbFlotThresholdMarking {
|
|
|
|
|
lineWidth?: number;
|
|
|
|
|
color?: string;
|
|
|
|
|
[key: string]: any;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export interface TbFlotThresholdKeySettings {
|
|
|
|
|
yaxis: number;
|
|
|
|
|
lineWidth: number;
|
|
|
|
|
color: string;
|
|
|
|
|
}
|
|
|
|
|
|
2019-09-12 19:58:42 +03:00
|
|
|
export interface TbFlotGridSettings {
|
|
|
|
|
color: string;
|
|
|
|
|
backgroundColor: string;
|
|
|
|
|
tickColor: string;
|
|
|
|
|
outlineWidth: number;
|
|
|
|
|
verticalLines: boolean;
|
|
|
|
|
horizontalLines: boolean;
|
2022-04-13 18:31:20 +03:00
|
|
|
minBorderMargin?: number;
|
|
|
|
|
margin?: number;
|
2019-09-12 19:58:42 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export interface TbFlotXAxisSettings {
|
|
|
|
|
showLabels: boolean;
|
|
|
|
|
title: string;
|
|
|
|
|
color: boolean;
|
|
|
|
|
}
|
|
|
|
|
|
2020-02-24 17:16:02 +02:00
|
|
|
export interface TbFlotSecondXAxisSettings {
|
|
|
|
|
axisPosition: TbFlotXAxisPosition;
|
|
|
|
|
showLabels: boolean;
|
|
|
|
|
title: string;
|
|
|
|
|
}
|
|
|
|
|
|
2019-09-12 19:58:42 +03:00
|
|
|
export interface TbFlotYAxisSettings {
|
|
|
|
|
min: number;
|
|
|
|
|
max: number;
|
|
|
|
|
showLabels: boolean;
|
|
|
|
|
title: string;
|
|
|
|
|
color: string;
|
|
|
|
|
ticksFormatter: string;
|
|
|
|
|
tickDecimals: number;
|
|
|
|
|
tickSize: number;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export interface TbFlotBaseSettings {
|
|
|
|
|
stack: boolean;
|
|
|
|
|
shadowSize: number;
|
|
|
|
|
fontColor: string;
|
|
|
|
|
fontSize: number;
|
|
|
|
|
tooltipIndividual: boolean;
|
|
|
|
|
tooltipCumulative: boolean;
|
|
|
|
|
tooltipValueFormatter: string;
|
2020-02-24 17:16:02 +02:00
|
|
|
hideZeros: boolean;
|
2019-09-12 19:58:42 +03:00
|
|
|
grid: TbFlotGridSettings;
|
|
|
|
|
xaxis: TbFlotXAxisSettings;
|
|
|
|
|
yaxis: TbFlotYAxisSettings;
|
|
|
|
|
}
|
|
|
|
|
|
2020-02-24 17:16:02 +02:00
|
|
|
export interface TbFlotComparisonSettings {
|
|
|
|
|
comparisonEnabled: boolean;
|
2021-03-18 19:45:45 +02:00
|
|
|
timeForComparison: ComparisonDuration;
|
2020-02-24 17:16:02 +02:00
|
|
|
xaxisSecond: TbFlotSecondXAxisSettings;
|
2021-07-22 15:39:57 +03:00
|
|
|
comparisonCustomIntervalValue?: number;
|
2020-02-24 17:16:02 +02:00
|
|
|
}
|
|
|
|
|
|
2020-02-26 18:15:04 +02:00
|
|
|
export interface TbFlotThresholdsSettings {
|
|
|
|
|
thresholdsLineWidth: number;
|
|
|
|
|
}
|
|
|
|
|
|
2020-07-22 11:33:22 +03:00
|
|
|
export interface TbFlotCustomLegendSettings {
|
|
|
|
|
customLegendEnabled: boolean;
|
|
|
|
|
dataKeysListForLabels: Array<TbFlotLabelPatternSettings>;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export interface TbFlotLabelPatternSettings {
|
|
|
|
|
name: string;
|
|
|
|
|
type: DataKeyType;
|
2020-07-29 21:53:46 +03:00
|
|
|
settings?: any;
|
2020-07-22 11:33:22 +03:00
|
|
|
}
|
|
|
|
|
|
2022-04-15 18:23:57 +03:00
|
|
|
export interface TbFlotGraphSettings extends TbFlotBaseSettings,
|
|
|
|
|
TbFlotThresholdsSettings, TbFlotComparisonSettings, TbFlotCustomLegendSettings {
|
2019-09-12 19:58:42 +03:00
|
|
|
smoothLines: boolean;
|
|
|
|
|
}
|
|
|
|
|
|
2020-02-26 18:15:04 +02:00
|
|
|
export declare type BarAlignment = 'left' | 'right' | 'center';
|
|
|
|
|
|
2022-04-15 18:23:57 +03:00
|
|
|
export interface TbFlotBarSettings extends TbFlotBaseSettings,
|
|
|
|
|
TbFlotThresholdsSettings, TbFlotComparisonSettings, TbFlotCustomLegendSettings {
|
2019-09-12 19:58:42 +03:00
|
|
|
defaultBarWidth: number;
|
2020-02-26 18:15:04 +02:00
|
|
|
barAlignment: BarAlignment;
|
2019-09-12 19:58:42 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export interface TbFlotPieSettings {
|
|
|
|
|
radius: number;
|
|
|
|
|
innerRadius: number;
|
|
|
|
|
tilt: number;
|
|
|
|
|
animatedPie: boolean;
|
|
|
|
|
stroke: {
|
|
|
|
|
color: string;
|
|
|
|
|
width: number;
|
|
|
|
|
};
|
2022-04-15 18:23:57 +03:00
|
|
|
showTooltip: boolean;
|
2019-09-12 19:58:42 +03:00
|
|
|
showLabels: boolean;
|
|
|
|
|
fontColor: string;
|
|
|
|
|
fontSize: number;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export declare type TbFlotYAxisPosition = 'left' | 'right';
|
2020-02-24 17:16:02 +02:00
|
|
|
export declare type TbFlotXAxisPosition = 'top' | 'bottom';
|
2019-09-12 19:58:42 +03:00
|
|
|
|
2020-02-26 18:15:04 +02:00
|
|
|
export declare type TbFlotThresholdValueSource = 'predefinedValue' | 'entityAttribute';
|
|
|
|
|
|
|
|
|
|
export interface TbFlotKeyThreshold {
|
|
|
|
|
thresholdValueSource: TbFlotThresholdValueSource;
|
|
|
|
|
thresholdEntityAlias: string;
|
|
|
|
|
thresholdAttribute: string;
|
|
|
|
|
thresholdValue: number;
|
|
|
|
|
lineWidth: number;
|
|
|
|
|
color: string;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export interface TbFlotKeyComparisonSettings {
|
|
|
|
|
showValuesForComparison: boolean;
|
|
|
|
|
comparisonValuesLabel: string;
|
|
|
|
|
color: string;
|
|
|
|
|
}
|
|
|
|
|
|
2019-09-12 19:58:42 +03:00
|
|
|
export interface TbFlotKeySettings {
|
2020-02-24 17:16:02 +02:00
|
|
|
excludeFromStacking: boolean;
|
2020-02-25 12:30:38 +02:00
|
|
|
hideDataByDefault: boolean;
|
|
|
|
|
disableDataHiding: boolean;
|
|
|
|
|
removeFromLegend: boolean;
|
2019-09-12 19:58:42 +03:00
|
|
|
showLines: boolean;
|
|
|
|
|
fillLines: boolean;
|
|
|
|
|
showPoints: boolean;
|
2020-02-24 17:16:02 +02:00
|
|
|
showPointShape: string;
|
|
|
|
|
pointShapeFormatter: string;
|
|
|
|
|
showPointsLineWidth: number;
|
|
|
|
|
showPointsRadius: number;
|
2019-09-12 19:58:42 +03:00
|
|
|
lineWidth: number;
|
|
|
|
|
tooltipValueFormatter: string;
|
|
|
|
|
showSeparateAxis: boolean;
|
|
|
|
|
axisMin: number;
|
|
|
|
|
axisMax: number;
|
|
|
|
|
axisTitle: string;
|
|
|
|
|
axisTickDecimals: number;
|
|
|
|
|
axisTickSize: number;
|
|
|
|
|
axisPosition: TbFlotYAxisPosition;
|
|
|
|
|
axisTicksFormatter: string;
|
2020-02-26 18:15:04 +02:00
|
|
|
thresholds: TbFlotKeyThreshold[];
|
|
|
|
|
comparisonSettings: TbFlotKeyComparisonSettings;
|
2019-09-12 19:58:42 +03:00
|
|
|
}
|
|
|
|
|
|
2022-03-28 13:39:26 +03:00
|
|
|
export interface TbFlotLatestKeySettings {
|
|
|
|
|
useAsThreshold: boolean;
|
|
|
|
|
thresholdLineWidth: number;
|
|
|
|
|
thresholdColor: string;
|
|
|
|
|
}
|