Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "Fix for bug 9136 and 7997 Fixing the issue of Going from stack callout to single callout and back to stack callout still shows the single callout. Also this consist of Fix for if the bar y value is same, the single callout does not move from the first instance where the callout was shown",
"packageName": "@fluentui/react-charting",
"email": "[email protected]",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,11 @@ enum CircleVisbility {
hide = 'hidden',
}

type CalloutAnchorPointData = {
xAxisDataPoint: string;
chartDataPoint: IVSChartDataPoint;
};

export interface IVerticalStackedBarChartState extends IBasestate {
dataPointCalloutProps?: IVSChartDataPoint;
stackCalloutProps?: IVerticalStackedChartProps;
Expand All @@ -87,7 +92,7 @@ export class VerticalStackedBarChartBase extends React.Component<
private _lineObject: LineObject;
private _tooltipId: string;
private _yMax: number;
private _calloutAnchorPoint: IVSChartDataPoint | null;
private _calloutAnchorPoint: CalloutAnchorPointData | null;
private _domainMargin: number;
private _classNames: IProcessedStyleSet<IVerticalStackedBarChartStyles>;
private _emptyChartId: string;
Expand Down Expand Up @@ -593,8 +598,11 @@ export class VerticalStackedBarChartBase extends React.Component<
color: string,
refSelected: React.MouseEvent<SVGElement> | SVGGElement,
): void {
if (this._calloutAnchorPoint !== point) {
this._calloutAnchorPoint = point;
if (this._calloutAnchorPoint?.chartDataPoint !== point || this._calloutAnchorPoint?.xAxisDataPoint !== xAxisPoint) {
this._calloutAnchorPoint = {
chartDataPoint: point,
xAxisDataPoint: xAxisPoint,
};
this.setState({
refSelected,
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -195,16 +195,18 @@ export class VerticalStackedBarChartStyledExample extends React.Component<{}, IV
},
}}
// eslint-disable-next-line react/jsx-no-bind
onRenderCalloutPerDataPoint={props =>
props ? (
<ChartHoverCard
XValue={props.xAxisCalloutData}
Legend={props.legend}
YValue={`${props.yAxisCalloutData || props.data} h`}
color={props.color}
/>
) : null
}
{...(this.state.selectedCallout === 'singleCallout' && {
onRenderCalloutPerDataPoint: (props: IVSChartDataPoint) => {
return props ? (
<ChartHoverCard
XValue={props.xAxisCalloutData}
Legend={props.legend}
YValue={`${props.yAxisCalloutData || props.data} h`}
color={props.color}
/>
) : null;
},
})}
svgProps={{
'aria-label': 'Example chart with metadata per month',
}}
Expand Down