Skip to content

Commit c0ffac2

Browse files
skyfongskylarfong
andauthored
Pass Legend Shape prop to Overflow State (microsoft#31057)
Co-authored-by: skylarfong <[email protected]>
1 parent 25cfd4d commit c0ffac2

File tree

4 files changed

+15
-2
lines changed

4 files changed

+15
-2
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"type": "patch",
3+
"comment": "Add shape prop to ILegendsProps to pass to Overflow items",
4+
"packageName": "@fluentui/react-charting",
5+
"email": "[email protected]",
6+
"dependentChangeType": "patch"
7+
}

packages/react-charting/etc/react-charting.api.md

+1
Original file line numberDiff line numberDiff line change
@@ -810,6 +810,7 @@ export interface ILegendsProps {
810810
onLegendHoverCardLeave?: VoidFunction;
811811
overflowProps?: Partial<IOverflowSetProps>;
812812
overflowText?: string;
813+
shape?: LegendShape;
813814
styles?: IStyleFunctionOrObject<ILegendStyleProps, ILegendsStyles>;
814815
theme?: ITheme;
815816
}

packages/react-charting/src/components/Legends/Legends.base.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ export class LegendsBase extends React.Component<ILegendsProps, ILegendState> {
8888
}
8989

9090
private _generateData(): ILegendOverflowData {
91-
const { allowFocusOnLegends = true } = this.props;
91+
const { allowFocusOnLegends = true, shape } = this.props;
9292
const dataItems: ILegendItem[] = this.props.legends.map((legend: ILegend, index: number) => {
9393
return {
9494
...(allowFocusOnLegends && {
@@ -103,7 +103,7 @@ export class LegendsBase extends React.Component<ILegendsProps, ILegendState> {
103103
hoverAction: legend.hoverAction!,
104104
onMouseOutAction: legend.onMouseOutAction!,
105105
color: legend.color,
106-
shape: legend.shape,
106+
shape: shape ? shape : legend.shape,
107107
stripePattern: legend.stripePattern,
108108
isLineLegendInBarChart: legend.isLineLegendInBarChart,
109109
opacity: legend.opacity,

packages/react-charting/src/components/Legends/Legends.types.ts

+5
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,11 @@ export interface ILegendsProps {
237237
* This prop is used for singleSelect scenarios.
238238
*/
239239
defaultSelectedLegend?: string;
240+
241+
/**
242+
* The shape for the legend.
243+
*/
244+
shape?: LegendShape;
240245
}
241246

242247
/**

0 commit comments

Comments
 (0)