Skip to content

Commit

Permalink
Fix wrong position of hover callout in case of single data AreaChart (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
Shubhabrata08 committed Apr 23, 2024
1 parent 5fb544f commit 21ae4f9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "Set axisType for single data point in case of AreaChart",
"packageName": "@fluentui/react-charting",
"email": "shubhabrata08@gmail.com",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
Expand Up @@ -246,17 +246,17 @@ export class AreaChartBase extends React.Component<IAreaChartProps, IAreaChartSt
const i = bisect(lineChartData![0].data, xOffset);
const d0 = lineChartData![0].data[i - 1] as ILineChartDataPoint;
const d1 = lineChartData![0].data[i] as ILineChartDataPoint;
let axisType: XAxisTypes | null = null;
let pointToHighlight: string | Date | number | null = null;
let index: null | number = null;
const axisType =
lineChartData![0].data.length > 0 ? (getTypeOfAxis(lineChartData![0].data[0].x, true) as XAxisTypes) : null;
if (d0 === undefined && d1 !== undefined) {
pointToHighlight = d1.x;
index = i;
} else if (d0 !== undefined && d1 === undefined) {
pointToHighlight = d0.x;
index = i - 1;
} else {
axisType = getTypeOfAxis(lineChartData![0].data[0].x, true) as XAxisTypes;
let x0;
let point0;
let point1;
Expand Down

0 comments on commit 21ae4f9

Please sign in to comment.