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": "port changes from v9 to v8 using custom github agent",
"packageName": "@fluentui/react-charting",
"email": "anushgupta@microsoft.com",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "fix scatter marker issue",
"packageName": "@fluentui/react-charts",
"email": "anushgupta@microsoft.com",
"dependentChangeType": "patch"
}
1 change: 1 addition & 0 deletions packages/charts/react-charting/etc/react-charting.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -458,6 +458,7 @@ export interface ICartesianChartProps {
xAxistickSize?: number;
xAxisTitle?: string;
xMaxValue?: number;
xMinValue?: number;
xScaleType?: AxisScaleType;
yAxis?: AxisProps;
yAxisAnnotation?: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,8 @@ export class CartesianChartBase
containerWidth: this.state.containerWidth,
hideTickOverlap: this.props.hideTickOverlap,
calcMaxLabelWidth: this._calcMaxLabelWidthWithTransform,
xMinValue: this.props.xMinValue,
xMaxValue: this.props.xMaxValue,
...this.props.xAxis,
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,11 @@ export interface ICartesianChartProps {
*/
yMaxValue?: number;

/**
* minimum data value point in x-axis (for numeric x-axis)
*/
xMinValue?: number;

/**
* maximum data value point in x-axis
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,18 @@ const getYMinMaxValues = (series: Data, layout: Partial<Layout> | undefined) =>
return {};
};

const getXMinMaxValues = (series: Data, layout: Partial<Layout> | undefined) => {
const range = getXAxisProperties(series, layout)?.range;
if (range && range.length === 2) {
return {
xMinValue: range[0],
xMaxValue: range[1],
showRoundOffXTickValues: false,
};
}
return {};
};

const getYAxisProperties = (series: Data, layout: Partial<Layout> | undefined): Partial<LayoutAxis> | undefined => {
return layout?.yaxis;
};
Expand Down Expand Up @@ -1408,6 +1420,14 @@ export const transformPlotlyJsonToVSBCProps = (
.forEach((shape, shapeIdx) => {
const lineColor = shape.line?.color;
const resolveX = (val: Datum) => {
if (shape.xref === 'x domain') {
if (val === 0) {
return xCategories[0];
}
if (val === 1) {
return xCategories[xCategories.length - 1];
}
}
if (typeof val === 'number' && Array.isArray(xCategories)) {
if (xCategories[val] !== undefined) {
return xCategories[val];
Expand Down Expand Up @@ -1480,7 +1500,9 @@ export const transformPlotlyJsonToVSBCProps = (
showYAxisLables: true,
noOfCharsToTruncate: 20,
showYAxisLablesTooltip: true,
roundedTicks: true,
wrapXAxisLables: typeof vsbcData[0]?.xAxisPoint === 'string',
...getXMinMaxValues(input.data[0], input.layout),
...getTitles(input.layout),
...getAxisCategoryOrderProps(input.data, input.layout),
...getYMinMaxValues(input.data[0], input.layout),
Expand Down Expand Up @@ -1654,8 +1676,10 @@ export const transformPlotlyJsonToGVBCProps = (
hideTickOverlap: true,
hideLegend,
roundCorners: true,
roundedTicks: true,
wrapXAxisLables: true,
showYAxisLables: true,
...getXMinMaxValues(processedInput.data[0], processedInput.layout),
...getTitles(processedInput.layout),
...getAxisCategoryOrderProps(processedInput.data, processedInput.layout),
...getYMinMaxValues(processedInput.data[0], processedInput.layout),
Expand Down Expand Up @@ -1769,8 +1793,10 @@ export const transformPlotlyJsonToVBCProps = (
maxBarWidth: 50,
hideLegend,
roundCorners: true,
roundedTicks: true,
wrapXAxisLables: typeof vbcData[0]?.x === 'string',
showYAxisLables: true,
...getXMinMaxValues(input.data[0], input.layout),
...getTitles(input.layout),
...getAxisCategoryOrderProps(input.data, input.layout),
...getYMinMaxValues(input.data[0], input.layout),
Expand Down Expand Up @@ -2057,6 +2083,8 @@ const transformPlotlyJsonToScatterTraceProps = (
optimizeLargeData: numDataPoints > 1000,
wrapXAxisLables: shouldWrapLabels,
showYAxisLables: true,
roundedTicks: true,
...getXMinMaxValues(input.data[0], input.layout),
...getTitles(input.layout),
...getXAxisTickFormat(input.data[0], input.layout),
...yAxisTickFormat,
Expand All @@ -2074,7 +2102,6 @@ const transformPlotlyJsonToScatterTraceProps = (
} else {
return {
data: isScatterChart ? scatterChartProps : chartProps,
roundedTicks: true,
enableReflow: false,
...commonProps,
...yMinMax,
Expand Down Expand Up @@ -2166,6 +2193,8 @@ export const transformPlotlyJsonToHorizontalBarWithAxisProps = (
noOfCharsToTruncate: 20,
showYAxisLablesTooltip: true,
roundCorners: true,
roundedTicks: true,
...getXMinMaxValues(input.data[0], input.layout),
...getTitles(input.layout),
...getAxisCategoryOrderProps(input.data, input.layout),
...getBarProps(input.data, input.layout, true),
Expand Down Expand Up @@ -2468,6 +2497,14 @@ export const transformPlotlyJsonToSankeyProps = (
colorMap,
isDarkTheme,
);
const extractedLinkColors = extractColor(
input.layout?.template?.layout?.colorway,
colorwayType,
link?.color,
colorMap,
isDarkTheme,
);

const sankeyChartData = {
nodes: node.label?.map((label: string, index: number) => {
const color = resolveColor(
Expand All @@ -2487,8 +2524,17 @@ export const transformPlotlyJsonToSankeyProps = (
}),
// eslint-disable-next-line @typescript-eslint/no-explicit-any
links: validLinks.map((validLink: any, index: number) => {
const color = resolveColor(
extractedLinkColors,
index,
validLink.target,
colorMap,
input.layout?.template?.layout?.colorway,
isDarkTheme,
);
return {
...validLink,
color,
};
}),
} as ISankeyChartData;
Expand Down
Loading