-
- {{ 'widgets.range-chart.fill-area' | translate }}
-
+
+
+
@@ -139,16 +285,22 @@
-
-
diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/settings/chart/range-chart-widget-settings.component.ts b/ui-ngx/src/app/modules/home/components/widget/lib/settings/chart/range-chart-widget-settings.component.ts
index 4ef2971467..b9a058af24 100644
--- a/ui-ngx/src/app/modules/home/components/widget/lib/settings/chart/range-chart-widget-settings.component.ts
+++ b/ui-ngx/src/app/modules/home/components/widget/lib/settings/chart/range-chart-widget-settings.component.ts
@@ -16,17 +16,24 @@
import { Component, Injector } from '@angular/core';
import {
+ Datasource,
legendPositions,
legendPositionTranslationMap,
WidgetSettings,
WidgetSettingsComponent
} from '@shared/models/widget.models';
-import { UntypedFormBuilder, UntypedFormGroup } from '@angular/forms';
+import { UntypedFormBuilder, UntypedFormGroup, Validators } from '@angular/forms';
import { Store } from '@ngrx/store';
import { AppState } from '@core/core.state';
import { formatValue } from '@core/utils';
import { rangeChartDefaultSettings } from '@home/components/widget/lib/chart/range-chart-widget.models';
import { DateFormatProcessor, DateFormatSettings } from '@shared/models/widget-settings.models';
+import {
+ lineSeriesStepTypes, lineSeriesStepTypeTranslations,
+ seriesLabelPositions, seriesLabelPositionTranslations,
+ timeSeriesLineTypes, timeSeriesLineTypeTranslations
+} from '@home/components/widget/lib/chart/time-series-chart.models';
+import { echartsShapes, echartsShapeTranslations } from '@home/components/widget/lib/chart/echarts-widget.models';
@Component({
selector: 'tb-range-chart-widget-settings',
@@ -35,12 +42,39 @@ import { DateFormatProcessor, DateFormatSettings } from '@shared/models/widget-s
})
export class RangeChartWidgetSettingsComponent extends WidgetSettingsComponent {
+ public get datasource(): Datasource {
+ const datasources: Datasource[] = this.widgetConfig.config.datasources;
+ if (datasources && datasources.length) {
+ return datasources[0];
+ } else {
+ return null;
+ }
+ }
+
+ lineSeriesStepTypes = lineSeriesStepTypes;
+
+ lineSeriesStepTypeTranslations = lineSeriesStepTypeTranslations;
+
+ timeSeriesLineTypes = timeSeriesLineTypes;
+
+ timeSeriesLineTypeTranslations = timeSeriesLineTypeTranslations;
+
+ seriesLabelPositions = seriesLabelPositions;
+
+ seriesLabelPositionTranslations = seriesLabelPositionTranslations;
+
+ echartsShapes = echartsShapes;
+
+ echartsShapeTranslations = echartsShapeTranslations;
+
legendPositions = legendPositions;
legendPositionTranslationMap = legendPositionTranslationMap;
rangeChartWidgetSettingsForm: UntypedFormGroup;
+ pointLabelPreviewFn = this._pointLabelPreviewFn.bind(this);
+
tooltipValuePreviewFn = this._tooltipValuePreviewFn.bind(this);
tooltipDatePreviewFn = this._tooltipDatePreviewFn.bind(this);
@@ -64,7 +98,34 @@ export class RangeChartWidgetSettingsComponent extends WidgetSettingsComponent {
dataZoom: [settings.dataZoom, []],
rangeColors: [settings.rangeColors, []],
outOfRangeColor: [settings.outOfRangeColor, []],
+ showRangeThresholds: [settings.showRangeThresholds, []],
+ rangeThreshold: [settings.rangeThreshold, []],
fillArea: [settings.fillArea, []],
+ fillAreaOpacity: [settings.fillAreaOpacity, [Validators.min(0), Validators.max(1)]],
+
+ showLine: [settings.showLine, []],
+ step: [settings.step, []],
+ stepType: [settings.stepType, []],
+ smooth: [settings.smooth, []],
+ lineType: [settings.lineType, []],
+ lineWidth: [settings.lineWidth, [Validators.min(0)]],
+
+ showPoints: [settings.showPoints, []],
+ showPointLabel: [settings.showPointLabel, []],
+ pointLabelPosition: [settings.pointLabelPosition, []],
+ pointLabelFont: [settings.pointLabelFont, []],
+ pointLabelColor: [settings.pointLabelColor, []],
+ enablePointLabelBackground: [settings.enablePointLabelBackground, []],
+ pointLabelBackground: [settings.pointLabelBackground, []],
+ pointShape: [settings.pointShape, []],
+ pointSize: [settings.pointSize, [Validators.min(0)]],
+
+ yAxis: [settings.yAxis, []],
+ xAxis: [settings.xAxis, []],
+
+ thresholds: [settings.thresholds, []],
+
+ animation: [settings.animation, []],
showLegend: [settings.showLegend, []],
legendPosition: [settings.legendPosition, []],
@@ -89,14 +150,69 @@ export class RangeChartWidgetSettingsComponent extends WidgetSettingsComponent {
}
protected validatorTriggers(): string[] {
- return ['showLegend', 'showTooltip', 'tooltipShowDate'];
+ return ['showRangeThresholds', 'fillArea', 'showLine', 'step', 'showPointLabel', 'enablePointLabelBackground',
+ 'showLegend', 'showTooltip', 'tooltipShowDate'];
}
protected updateValidators(emitEvent: boolean) {
+ const showRangeThresholds: boolean = this.rangeChartWidgetSettingsForm.get('showRangeThresholds').value;
+ const fillArea: boolean = this.rangeChartWidgetSettingsForm.get('fillArea').value;
+ const showLine: boolean = this.rangeChartWidgetSettingsForm.get('showLine').value;
+ const step: boolean = this.rangeChartWidgetSettingsForm.get('step').value;
+ const showPointLabel: boolean = this.rangeChartWidgetSettingsForm.get('showPointLabel').value;
+ const enablePointLabelBackground: boolean = this.rangeChartWidgetSettingsForm.get('enablePointLabelBackground').value;
const showLegend: boolean = this.rangeChartWidgetSettingsForm.get('showLegend').value;
const showTooltip: boolean = this.rangeChartWidgetSettingsForm.get('showTooltip').value;
const tooltipShowDate: boolean = this.rangeChartWidgetSettingsForm.get('tooltipShowDate').value;
+ if (showRangeThresholds) {
+ this.rangeChartWidgetSettingsForm.get('rangeThreshold').enable();
+ } else {
+ this.rangeChartWidgetSettingsForm.get('rangeThreshold').disable();
+ }
+
+ if (fillArea) {
+ this.rangeChartWidgetSettingsForm.get('fillAreaOpacity').enable();
+ } else {
+ this.rangeChartWidgetSettingsForm.get('fillAreaOpacity').disable();
+ }
+
+ if (showLine) {
+ this.rangeChartWidgetSettingsForm.get('step').enable({emitEvent: false});
+ if (step) {
+ this.rangeChartWidgetSettingsForm.get('stepType').enable();
+ this.rangeChartWidgetSettingsForm.get('smooth').disable();
+ } else {
+ this.rangeChartWidgetSettingsForm.get('stepType').disable();
+ this.rangeChartWidgetSettingsForm.get('smooth').enable();
+ }
+ this.rangeChartWidgetSettingsForm.get('lineType').enable();
+ this.rangeChartWidgetSettingsForm.get('lineWidth').enable();
+ } else {
+ this.rangeChartWidgetSettingsForm.get('step').disable({emitEvent: false});
+ this.rangeChartWidgetSettingsForm.get('stepType').disable();
+ this.rangeChartWidgetSettingsForm.get('smooth').disable();
+ this.rangeChartWidgetSettingsForm.get('lineType').disable();
+ this.rangeChartWidgetSettingsForm.get('lineWidth').disable();
+ }
+ if (showPointLabel) {
+ this.rangeChartWidgetSettingsForm.get('pointLabelPosition').enable();
+ this.rangeChartWidgetSettingsForm.get('pointLabelFont').enable();
+ this.rangeChartWidgetSettingsForm.get('pointLabelColor').enable();
+ this.rangeChartWidgetSettingsForm.get('enablePointLabelBackground').enable({emitEvent: false});
+ if (enablePointLabelBackground) {
+ this.rangeChartWidgetSettingsForm.get('pointLabelBackground').enable();
+ } else {
+ this.rangeChartWidgetSettingsForm.get('pointLabelBackground').disable();
+ }
+ } else {
+ this.rangeChartWidgetSettingsForm.get('pointLabelPosition').disable();
+ this.rangeChartWidgetSettingsForm.get('pointLabelFont').disable();
+ this.rangeChartWidgetSettingsForm.get('pointLabelColor').disable();
+ this.rangeChartWidgetSettingsForm.get('enablePointLabelBackground').disable({emitEvent: false});
+ this.rangeChartWidgetSettingsForm.get('pointLabelBackground').disable();
+ }
+
if (showLegend) {
this.rangeChartWidgetSettingsForm.get('legendPosition').enable();
this.rangeChartWidgetSettingsForm.get('legendLabelFont').enable();
@@ -137,6 +253,12 @@ export class RangeChartWidgetSettingsComponent extends WidgetSettingsComponent {
}
}
+ private _pointLabelPreviewFn(): string {
+ const units: string = this.widgetConfig.config.units;
+ const decimals: number = this.widgetConfig.config.decimals;
+ return formatValue(22, decimals, units, false);
+ }
+
private _tooltipValuePreviewFn(): string {
const units: string = this.widgetConfig.config.units;
const decimals: number = this.widgetConfig.config.decimals;
@@ -149,5 +271,4 @@ export class RangeChartWidgetSettingsComponent extends WidgetSettingsComponent {
processor.update(Date.now());
return processor.formatted;
}
-
}
diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/settings/chart/time-series-chart-bar-settings.component.html b/ui-ngx/src/app/modules/home/components/widget/lib/settings/chart/time-series-chart-bar-settings.component.html
index 447784091e..ddbeaf2480 100644
--- a/ui-ngx/src/app/modules/home/components/widget/lib/settings/chart/time-series-chart-bar-settings.component.html
+++ b/ui-ngx/src/app/modules/home/components/widget/lib/settings/chart/time-series-chart-bar-settings.component.html
@@ -59,6 +59,15 @@