Browse Source

Minor fixes

pull/15624/head
Maksym Tsymbarov 5 days ago
parent
commit
ff72b317cb
  1. 1
      ui-ngx/src/app/modules/home/components/widget/lib/chart/bar-chart-with-labels-widget.component.ts
  2. 4
      ui-ngx/src/app/modules/home/components/widget/lib/chart/time-series-chart-tooltip.models.ts
  3. 1
      ui-ngx/src/app/modules/home/components/widget/lib/chart/time-series-chart-widget.component.ts
  4. 22
      ui-ngx/src/app/modules/home/components/widget/lib/chart/time-series-chart.ts
  5. 1
      ui-ngx/src/assets/locale/locale.constant-en_US.json

1
ui-ngx/src/app/modules/home/components/widget/lib/chart/bar-chart-with-labels-widget.component.ts

@ -114,6 +114,7 @@ export class BarChartWithLabelsWidgetComponent implements OnInit, OnDestroy, Aft
ngAfterViewInit() {
const settings = barChartWithLabelsTimeSeriesSettings(this.settings);
this.timeSeriesChart = new TbTimeSeriesChart(this.ctx, settings, this.chartShape.nativeElement, this.renderer);
this.ctx.widgetActions = this.timeSeriesChart.getWidgetActions();
}
ngOnDestroy() {

4
ui-ngx/src/app/modules/home/components/widget/lib/chart/time-series-chart-tooltip.models.ts

@ -293,7 +293,9 @@ private static mapTooltipParams(params: CallbackDataParams[] | CallbackDataParam
TimeSeriesChartTooltip.appendTooltipItem(result, seriesParams, series);
} else if (Array.isArray(params)) {
for (seriesParams of params) {
TimeSeriesChartTooltip.appendTooltipItem(result, seriesParams, series);
if (seriesParams.value) {
TimeSeriesChartTooltip.appendTooltipItem(result, seriesParams, series);
}
}
}
return result;

1
ui-ngx/src/app/modules/home/components/widget/lib/chart/time-series-chart-widget.component.ts

@ -137,6 +137,7 @@ export class TimeSeriesChartWidgetComponent implements OnInit, OnDestroy, AfterV
ngAfterViewInit() {
this.timeSeriesChart = new TbTimeSeriesChart(this.ctx, this.settings, this.chartShape.nativeElement, this.renderer);
this.ctx.widgetActions = this.timeSeriesChart.getWidgetActions();
}
ngOnDestroy() {

22
ui-ngx/src/app/modules/home/components/widget/lib/chart/time-series-chart.ts

@ -14,7 +14,7 @@
/// limitations under the License.
///
import { WidgetContext } from '@home/models/widget-component.models';
import { WidgetAction, WidgetContext } from '@home/models/widget-component.models';
import {
adjustTimeAxisExtentToData,
calculateThresholdsOffset,
@ -433,6 +433,18 @@ export class TbTimeSeriesChart {
return this.darkMode;
}
public getWidgetActions(): WidgetAction[]{
if (this.settings.dataZoom && this.settings.dataZoomUpdateTimewindow) {
return [{
name: 'widgets.time-series-chart.reset-timewindow',
icon: 'restore',
onAction: () => this.ctx.defaultSubscription.onResetTimewindow(),
show: true
}];
}
return [];
}
private setupData(): void {
const noAggregationBarWidthSettings = this.settings.noAggregationBarWidthSettings;
const targetBarWidth = noAggregationBarWidthSettings.strategy === TimeSeriesChartNoAggregationBarWidthStrategy.group ?
@ -833,7 +845,8 @@ export class TbTimeSeriesChart {
type: 'inside',
disabled: !this.settings.dataZoom,
realtime: true,
filterMode: this.stateData ? 'none' : 'weakFilter'
filterMode: this.stateData ? 'none' : 'weakFilter',
...(this.comparisonEnabled ? { xAxisIndex: [0] } : {})
},
{
type: 'slider',
@ -841,7 +854,8 @@ export class TbTimeSeriesChart {
showDetail: false,
realtime: true,
filterMode: this.stateData ? 'none' : 'weakFilter',
bottom: 10
bottom: 10,
...(this.comparisonEnabled ? { xAxisIndex: [0] } : {})
}
],
...toAnimationOption(this.ctx, this.settings.animation)
@ -891,7 +905,7 @@ export class TbTimeSeriesChart {
}
}
}
}, 300);
}, 500);
}
});
}

1
ui-ngx/src/assets/locale/locale.constant-en_US.json

@ -9719,6 +9719,7 @@
"chart-style": "Chart style",
"data-zoom": "Data zoom",
"data-zoom-update-timewindow": "Update time window on zoom",
"reset-timewindow": "Reset time window",
"stack-mode": "Stack mode",
"stack-mode-hint": "Stacks series on the chart. The series with the same unit would be put on top of each other.",
"axes": "Axes",

Loading…
Cancel
Save