Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(react-charting): resolve bugs in declarative chart #33564

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
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 @@
{
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🕵🏾‍♀️ visual regressions to review in the fluentuiv8 Visual Regression Report

Callout 5 screenshots
Image Name Diff(in Pixels) Image Type
Callout.Bottom Left Edge RTL.chromium.png 2178 Changed
Callout.No callout width specified.chromium.png 2319 Changed
Callout.Beak 25.chromium.png 2186 Changed
Callout.Left center.chromium.png 2616 Changed
Callout.Root.chromium.png 2309 Changed
react-charting-HeatMapChart 1 screenshots
Image Name Diff(in Pixels) Image Type
react-charting-HeatMapChart.Basic RTL.chromium.png 372 Changed
react-charting-VerticalBarChart 1 screenshots
Image Name Diff(in Pixels) Image Type
react-charting-VerticalBarChart.Basic - Secondary Y Axis.chromium.png 4 Changed

"type": "patch",
"comment": "fix: resolve bugs in declarative chart",
"packageName": "@fluentui/react-charting",
"email": "[email protected]",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ export const DeclarativeChart: React.FunctionComponent<DeclarativeChartProps> =
(opts?: IImageExportOptions) => {
return toImage(chartRef.current?.chartContainer, {
background: theme.semanticColors.bodyBackground,
scale: 3,
...opts,
});
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,14 +167,14 @@ export const transformPlotlyJsonToVSBCProps = (
mapXToDataPoints[x] = { xAxisPoint: x, chartData: [], lineData: [] };
}
const legend: string = series.name || `Series ${index1 + 1}`;
if (series.type === 'bar' || series.type === 'scatter') {
if (series.type === 'bar') {
const color = getColor(legend, colorMap, isDarkTheme);
mapXToDataPoints[x].chartData.push({
legend,
data: series.y?.[index2],
color,
});
} else if (series.type === 'line') {
} else if (typeof series.type !== 'string' || series.type === 'scatter') {
const color = getColor(legend, colorMap, isDarkTheme);
mapXToDataPoints[x].lineData!.push({
legend,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2505,7 +2505,7 @@ exports[`Vertical bar chart re-rendering Should re-render the vertical bar chart
fill="currentColor"
y="16"
>
10,000
10000
</text>
</g>
<g
Expand All @@ -2523,7 +2523,7 @@ exports[`Vertical bar chart re-rendering Should re-render the vertical bar chart
fill="currentColor"
y="16"
>
25,000
25000
</text>
</g>
</g>
Expand Down
11 changes: 2 additions & 9 deletions packages/charts/react-charting/src/utilities/utilities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -312,19 +312,12 @@ export function createStringXAxis(
.range([domainNRangeValues.rStartValue, domainNRangeValues.rEndValue])
.paddingInner(typeof xAxisInnerPadding !== 'undefined' ? xAxisInnerPadding : xAxisPadding)
.paddingOuter(typeof xAxisOuterPadding !== 'undefined' ? xAxisOuterPadding : xAxisPadding);
const xAxis = d3AxisBottom(xAxisScale)
.tickSize(xAxistickSize)
.tickPadding(tickPadding)
.ticks(xAxisCount)
.tickFormat((x: string, index: number) => {
return convertToLocaleString(dataset[index], culture) as string;
});
const xAxis = d3AxisBottom(xAxisScale).tickSize(xAxistickSize).tickPadding(tickPadding).ticks(xAxisCount);

if (xAxisParams.xAxisElement) {
d3Select(xAxisParams.xAxisElement).call(xAxis).selectAll('text').attr('aria-hidden', 'true');
}
const tickValues = dataset.map(xAxis.tickFormat()!);
return { xScale: xAxisScale, tickValues };
return { xScale: xAxisScale, tickValues: dataset };
}

/**
Expand Down
Loading