Skip to content

Commit a645475

Browse files
Anush2303Anush
andauthored
fix(react-charts): fix reference lines bug (#35406)
Co-authored-by: Anush <anushgupta@microsoft.com>
1 parent 71acfbd commit a645475

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"type": "patch",
3+
"comment": "fix reference lines bug",
4+
"packageName": "@fluentui/react-charts",
5+
"email": "anushgupta@microsoft.com",
6+
"dependentChangeType": "patch"
7+
}

packages/charts/react-charts/library/src/components/DeclarativeChart/PlotlySchemaAdapter.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -724,6 +724,14 @@ export const transformPlotlyJsonToVSBCProps = (
724724
.forEach((shape, shapeIdx) => {
725725
const lineColor = shape.line?.color;
726726
const resolveX = (val: Datum) => {
727+
if (shape.xref === 'x domain') {
728+
if (val === 0) {
729+
return xCategories[0];
730+
}
731+
if (val === 1) {
732+
return xCategories[xCategories.length - 1];
733+
}
734+
}
727735
if (typeof val === 'number' && Array.isArray(xCategories)) {
728736
if (xCategories[val] !== undefined) {
729737
return xCategories[val];

0 commit comments

Comments
 (0)