Skip to content

Commit 221f617

Browse files
fix(bug): brush should not be there for cartesian chart if there is no selection handler (#1406)
* fix(bug): brush should not be there for cartesian chart if there is no selection handler * Update projects/observability/src/shared/components/cartesian/cartesian-chart.component.ts Co-authored-by: Aaron Steinfeld <45047841+aaron-steinfeld@users.noreply.github.com> * Update projects/observability/src/shared/components/cartesian/cartesian-chart.component.ts Co-authored-by: Aaron Steinfeld <45047841+aaron-steinfeld@users.noreply.github.com> * Update projects/observability/src/shared/dashboard/widgets/charts/cartesian-widget/cartesian-widget-renderer.component.ts Co-authored-by: Aaron Steinfeld <45047841+aaron-steinfeld@users.noreply.github.com> * Update projects/observability/src/shared/components/cartesian/cartesian-chart.component.ts Co-authored-by: Aaron Steinfeld <45047841+aaron-steinfeld@users.noreply.github.com> * Update projects/observability/src/shared/components/cartesian/cartesian-chart.component.ts Co-authored-by: Aaron Steinfeld <45047841+aaron-steinfeld@users.noreply.github.com> * Update projects/observability/src/shared/components/cartesian/cartesian-chart.component.ts Co-authored-by: Aaron Steinfeld <45047841+aaron-steinfeld@users.noreply.github.com> * Update projects/observability/src/shared/dashboard/widgets/charts/cartesian-widget/cartesian-widget-renderer.component.ts Co-authored-by: Aaron Steinfeld <45047841+aaron-steinfeld@users.noreply.github.com> Co-authored-by: Aaron Steinfeld <45047841+aaron-steinfeld@users.noreply.github.com>
1 parent 3e9ee77 commit 221f617

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

projects/observability/src/shared/components/cartesian/cartesian-chart.component.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,9 @@ export class CartesianChartComponent<TData> implements OnChanges, OnDestroy {
5757
@Input()
5858
public timeRange?: TimeRange;
5959

60+
@Input()
61+
public rangeSelectionEnabled: boolean = false;
62+
6063
@Input()
6164
public intervalOptions?: IntervalValue[];
6265

@@ -100,10 +103,13 @@ export class CartesianChartComponent<TData> implements OnChanges, OnDestroy {
100103
this.chartTooltipBuilderService.constructTooltip<TData, Series<TData>>(data =>
101104
this.convertToDefaultTooltipRenderData(data)
102105
)
103-
)
104-
.withEventListener(ChartEvent.Select, selectedData => {
106+
);
107+
108+
if (this.rangeSelectionEnabled) {
109+
this.chart.withEventListener(ChartEvent.Select, selectedData => {
105110
this.selectionChange.emit(selectedData);
106111
});
112+
}
107113

108114
if (this.bands) {
109115
this.chart.withBands(...this.bands);

projects/observability/src/shared/dashboard/widgets/charts/cartesian-widget/cartesian-widget-renderer.component.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import { CartesianDataFetcher, CartesianResult, CartesianWidgetModel } from './c
2727
[showXAxis]="this.model.showXAxis"
2828
[showYAxis]="this.model.showYAxis"
2929
[timeRange]="this.timeRange"
30+
[rangeSelectionEnabled]="!!this.model.selectionHandler"
3031
[selectedInterval]="this.selectedInterval"
3132
[intervalOptions]="this.intervalOptions"
3233
[legend]="this.model.legendPosition"

0 commit comments

Comments
 (0)