|
this.legendData.keys[legendKey.dataIndex].dataKey.inLegend);
}
}
diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/flot-widget.models.ts b/ui-ngx/src/app/modules/home/components/widget/lib/flot-widget.models.ts
index 1818e87ef0..def651d22b 100644
--- a/ui-ngx/src/app/modules/home/components/widget/lib/flot-widget.models.ts
+++ b/ui-ngx/src/app/modules/home/components/widget/lib/flot-widget.models.ts
@@ -160,6 +160,9 @@ export declare type TbFlotXAxisPosition = 'top' | 'bottom';
export interface TbFlotKeySettings {
excludeFromStacking: boolean;
+ hideDataByDefault: boolean;
+ disableDataHiding: boolean;
+ removeFromLegend: boolean;
showLines: boolean;
fillLines: boolean;
showPoints: boolean;
@@ -612,6 +615,36 @@ export const flotPieSettingsSchema: JsonSettingsSchema = {
]
};
+export const flotPieDatakeySettingsSchema: JsonSettingsSchema = {
+ schema: {
+ type: 'object',
+ title: 'DataKeySettings',
+ properties: {
+ hideDataByDefault: {
+ title: 'Data is hidden by default',
+ type: 'boolean',
+ default: false
+ },
+ disableDataHiding: {
+ title: 'Disable data hiding',
+ type: 'boolean',
+ default: false
+ },
+ removeFromLegend: {
+ title: 'Remove datakey from legend',
+ type: 'boolean',
+ default: false
+ }
+ },
+ required: []
+ },
+ form: [
+ 'hideDataByDefault',
+ 'disableDataHiding',
+ 'removeFromLegend'
+ ]
+};
+
export function flotDatakeySettingsSchema(defaultShowLines: boolean, chartType: ChartType): JsonSettingsSchema {
const schema: JsonSettingsSchema = {
schema: {
@@ -623,6 +656,21 @@ export function flotDatakeySettingsSchema(defaultShowLines: boolean, chartType:
type: 'boolean',
default: false
},
+ hideDataByDefault: {
+ title: 'Data is hidden by default',
+ type: 'boolean',
+ default: false
+ },
+ disableDataHiding: {
+ title: 'Disable data hiding',
+ type: 'boolean',
+ default: false
+ },
+ removeFromLegend: {
+ title: 'Remove datakey from legend',
+ type: 'boolean',
+ default: false
+ },
showLines: {
title: 'Show lines',
type: 'boolean',
@@ -711,6 +759,9 @@ export function flotDatakeySettingsSchema(defaultShowLines: boolean, chartType:
required: ['showLines', 'fillLines', 'showPoints']
},
form: [
+ 'hideDataByDefault',
+ 'disableDataHiding',
+ 'removeFromLegend',
'excludeFromStacking',
'showLines',
'fillLines',
diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/flot-widget.ts b/ui-ngx/src/app/modules/home/components/widget/lib/flot-widget.ts
index c042a8f5cf..292956b1b7 100644
--- a/ui-ngx/src/app/modules/home/components/widget/lib/flot-widget.ts
+++ b/ui-ngx/src/app/modules/home/components/widget/lib/flot-widget.ts
@@ -21,7 +21,7 @@ import { IWidgetSubscription } from '@core/api/widget-api.models';
import { DatasourceData, JsonSettingsSchema } from '@app/shared/models/widget.models';
import {
ChartType,
- flotDatakeySettingsSchema,
+ flotDatakeySettingsSchema, flotPieDatakeySettingsSchema,
flotPieSettingsSchema,
flotSettingsSchema,
TbFlotAxisOptions,
@@ -47,6 +47,7 @@ const tinycolor = tinycolor_;
const moment = moment_;
const flotPieSettingsSchemaValue = flotPieSettingsSchema;
+const flotPieDatakeySettingsSchemaValue = flotPieDatakeySettingsSchema;
export class TbFlot {
@@ -103,7 +104,7 @@ export class TbFlot {
}
static pieDatakeySettingsSchema(): JsonSettingsSchema {
- return {};
+ return flotPieDatakeySettingsSchemaValue;
}
static settingsSchema(chartType: ChartType): JsonSettingsSchema {
@@ -814,12 +815,7 @@ export class TbFlot {
return seriesHover.index === seriesIndex;
});
if (found && found.length) {
- let timestamp: number;
- if (!isNumber(hoverInfo[0].time) || (found[0].time < hoverInfo[0].time)) {
- timestamp = parseInt(hoverInfo[1].time, 10);
- } else {
- timestamp = parseInt(hoverInfo[0].time, 10);
- }
+ const timestamp = parseInt(found[0].time, 10);
const date = moment(timestamp).format('YYYY-MM-DD HH:mm:ss');
const dateDiv = $(' ' + date + ' ');
dateDiv.css({
diff --git a/ui-ngx/src/app/shared/models/widget.models.ts b/ui-ngx/src/app/shared/models/widget.models.ts
index bfd3f23e9c..fb4ac3401d 100644
--- a/ui-ngx/src/app/shared/models/widget.models.ts
+++ b/ui-ngx/src/app/shared/models/widget.models.ts
@@ -231,6 +231,7 @@ export interface DataKey extends KeyInfo {
settings?: any;
usePostProcessing?: boolean;
hidden?: boolean;
+ inLegend?: boolean;
_hash?: number;
}
|