From d07e1541f0aa2a9bc2c69dfce2ab26de55494aee Mon Sep 17 00:00:00 2001 From: Anush Gupta <74965306+Anush2303@users.noreply.github.com> Date: Thu, 12 Dec 2024 13:25:12 +0000 Subject: [PATCH] enable chart selection based on legends in declarative charts --- .../src/components/AreaChart/AreaChart.base.tsx | 2 +- .../src/components/DonutChart/DonutChart.base.tsx | 2 +- .../src/components/GaugeChart/GaugeChart.base.tsx | 2 +- .../GroupedVerticalBarChart/GroupedVerticalBarChart.base.tsx | 2 +- .../src/components/HeatMapChart/HeatMapChart.base.tsx | 2 +- .../HorizontalBarChartWithAxis.base.tsx | 4 ++-- .../src/components/LineChart/LineChart.base.tsx | 2 +- .../components/StackedBarChart/MultiStackedBarChart.base.tsx | 2 +- .../src/components/StackedBarChart/StackedBarChart.base.tsx | 2 +- .../src/components/VerticalBarChart/VerticalBarChart.base.tsx | 2 +- .../VerticalStackedBarChart/VerticalStackedBarChart.base.tsx | 2 +- 11 files changed, 12 insertions(+), 12 deletions(-) diff --git a/packages/charts/react-charting/src/components/AreaChart/AreaChart.base.tsx b/packages/charts/react-charting/src/components/AreaChart/AreaChart.base.tsx index fef7e6965c59d7..686fe0babe863b 100644 --- a/packages/charts/react-charting/src/components/AreaChart/AreaChart.base.tsx +++ b/packages/charts/react-charting/src/components/AreaChart/AreaChart.base.tsx @@ -124,7 +124,7 @@ export class AreaChartBase extends React.Component this._createNewDataSet(data, xDate, xNum, yDate, yNum), ); this.state = { - selectedLegend: '', + selectedLegend: props.legendProps?.selectedLegend ?? '', activeLegend: '', isCalloutVisible: false, target: null, diff --git a/packages/charts/react-charting/src/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.tsx b/packages/charts/react-charting/src/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.tsx index 8e5562ebe55bbf..0f2925b0d7a774 100644 --- a/packages/charts/react-charting/src/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.tsx +++ b/packages/charts/react-charting/src/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.tsx @@ -84,10 +84,10 @@ export class HorizontalBarChartWithAxisBase extends React.Component< color: '', dataForHoverCard: 0, isCalloutVisible: false, - isLegendSelected: false, + isLegendSelected: true, isLegendHovered: false, refSelected: null, - selectedLegendTitle: '', + selectedLegendTitle: props.legendProps?.selectedLegend ?? '', xCalloutValue: '', yCalloutValue: '', activeXdataPoint: null, diff --git a/packages/charts/react-charting/src/components/LineChart/LineChart.base.tsx b/packages/charts/react-charting/src/components/LineChart/LineChart.base.tsx index 65d04ab60e1d23..0e55be45edac90 100644 --- a/packages/charts/react-charting/src/components/LineChart/LineChart.base.tsx +++ b/packages/charts/react-charting/src/components/LineChart/LineChart.base.tsx @@ -186,7 +186,7 @@ export class LineChartBase extends React.Component