diff --git a/change/@fluentui-react-charting-5cb11ce8-3dd1-44a0-b5d6-86ab28f4e94c.json b/change/@fluentui-react-charting-5cb11ce8-3dd1-44a0-b5d6-86ab28f4e94c.json new file mode 100644 index 00000000000000..f87169c6dc8918 --- /dev/null +++ b/change/@fluentui-react-charting-5cb11ce8-3dd1-44a0-b5d6-86ab28f4e94c.json @@ -0,0 +1,7 @@ +{ + "type": "patch", + "comment": "Fixing Tree chart issues for adding the optional bodyText for parent node and adjusting the allignment of the tree in the screen", + "packageName": "@fluentui/react-charting", + "email": "ankityadav@microsoft.com", + "dependentChangeType": "patch" +} diff --git a/packages/react-charting/src/components/TreeChart/TreeChart.base.tsx b/packages/react-charting/src/components/TreeChart/TreeChart.base.tsx index a4aa47ef65756b..211b24fd2d8a32 100644 --- a/packages/react-charting/src/components/TreeChart/TreeChart.base.tsx +++ b/packages/react-charting/src/components/TreeChart/TreeChart.base.tsx @@ -20,21 +20,16 @@ const getClassNames = classNamesFunction(); // Create a parent class for common tree components class StandardTree { public treeData: ITreeChartDataPoint; - public styleClassNames: { - rectmetricText: string | undefined; - rectSubText: string | undefined; - link: string; - rectNode: string; - rectText: string; - }; - - private _nodeElements: Array | React.SVGProps> = []; - private _linkElements: Array> = []; + public styleClassNames: IProcessedStyleSet; + + private _nodeElements: JSX.Element[] = []; + private _linkElements: JSX.Element[] = []; + constructor( treeData: ITreeChartDataPoint, - styleClassNames: { link: string; rectNode: string; rectText: string; rectSubText: string; rectmetricText: string }, - _nodeElements: Array | React.SVGProps> = [], - _linkElements: Array> = [], + styleClassNames: IProcessedStyleSet, + _nodeElements: JSX.Element[] = [], + _linkElements: JSX.Element[] = [], ) { this.treeData = treeData; this.styleClassNames = styleClassNames; @@ -48,7 +43,7 @@ class StandardTree { let word: string = ''; const tspan = select('.svgTree').append('text').attr('class', 'tempText').append('tspan').text(null); - if (styleClass !== undefined) { + if (styleClass) { tspan.attr('class', styleClass); } @@ -77,8 +72,9 @@ class StandardTree { public addNodeShapetoSVG( name: string, subname: string | undefined, + bodytext: string | undefined, metricName: string | undefined, - xCoordinate: number, + xCenterCoordinate: number, yCoordinate: number, fillColor: string, rectangleWidth: number, @@ -87,31 +83,37 @@ class StandardTree { parentInfo: string, ) { const ariaLabel = `nodeId: ${nodeId} \nnodeMainText: ${name}\nsubText ${subname} ${parentInfo}`; - this._nodeElements.push( - , - ); + const xCoordinate = xCenterCoordinate - rectangleWidth / 2; + if (metricName || nodeId !== 0 || !bodytext) { + this._nodeElements.push( + , + ); + } - if (subname !== undefined) { + if (subname) { subname = this.truncateText(subname, rectangleWidth, rectangleWidth / 4, this.styleClassNames.rectSubText); } - if (metricName !== undefined) { + if (bodytext) { + bodytext = this.truncateText(bodytext, rectangleWidth, rectangleWidth / 4, this.styleClassNames.rectBodyText); + } + if (metricName) { metricName = this.truncateText( metricName, rectangleWidth, rectangleWidth / 4, - this.styleClassNames.rectmetricText, + this.styleClassNames.rectMetricText, ); } name = this.truncateText(name, rectangleWidth, rectangleWidth / 4, this.styleClassNames.rectText); @@ -120,22 +122,30 @@ class StandardTree { // Text position x = x + rectWidth/2, 2 is ratio for length // Sub-text position x = x + rectWidth/2, 2 is ratio for length - const subValue = - metricName !== undefined ? ( - - {metricName} - - ) : ( + const subValue = metricName ? ( + + {metricName} + + ) : bodytext ? ( + <> {subname} - ); + + {bodytext} + + + ) : ( + + {subname} + + ); - if (subname === undefined && metricName === undefined) { + if (!subname && !metricName && !bodytext) { this._nodeElements.push( @@ -172,12 +182,25 @@ class StandardTree { ): string { // gap adds ratio for parent.y to child.y - const path = `M${childX},${childY - gap} H${childXMax + rectWidth} M${parentX + rectWidth / 2},${childY - gap} + /*Below code is used to draw lines(___|) to show the parent child relation i.e a vertical line + emerging from the parent and + then a horzontal line encompassing all the its children which are + shown below it .so it gives a visual representation of tree branches. + + So for making this path firstly we are moving to the childX which is the mid point of the node and then + we are subtracting the half of rectwidth to move the complete width of the rectangle and + we are subtracting gap from y cordinate as we are making this line at a little gap from node. + Then we are building that line horizonatlly till childXmax, again adding half rectwidth to complete + the line till end as childXmax will be midpoint. + Then last part is for making line vertical for that we move to the parentx position and + then draw the vertical till parenty + rectHeight + gap/2 + We have seperate path for leaf node as we are using different composition like compact, long etc.*/ + + const path = `M${childX - rectWidth / 2},${childY - gap} H${childXMax + rectWidth / 2} M${parentX},${childY - gap} V${parentY + rectHeight + gap / 2}`; - const leafpath = `M${parentX + rectWidth / 2},${parentY + rectHeight + gap / 2} V${ - parentY + gap * 5 - } H${parentX} H${parentX + rectWidth}`; + const leafpath = `M${parentX},${parentY + rectHeight + gap / 2} V${parentY + gap * 5} + H${parentX - rectWidth / 2} H${parentX + rectWidth / 2}`; // based on the type of node return leafpath or path element return leaf ? leafpath : path; @@ -213,9 +236,9 @@ class LayeredTree extends StandardTree { constructor( treeData: ITreeChartDataPoint, composition: number | undefined, - styleClassNames: { link: string; rectNode: string; rectText: string; rectSubText: string; rectmetricText: string }, - _nodeElements: Array | React.SVGProps> = [], - _linkElements: Array> = [], + styleClassNames: IProcessedStyleSet, + _nodeElements: JSX.Element[] = [], + _linkElements: JSX.Element[] = [], _treeTraversal: number | undefined, ) { super(treeData, styleClassNames, _nodeElements, _linkElements); @@ -223,14 +246,7 @@ class LayeredTree extends StandardTree { this._treeTraversal = _treeTraversal; } public createTree(givenLayoutWidth: number | undefined, screenWidth: number) { - if (givenLayoutWidth !== undefined) { - if (givenLayoutWidth < 65) { - givenLayoutWidth = 65; - } - if (givenLayoutWidth > 90) { - givenLayoutWidth = 90; - } - } + givenLayoutWidth = givenLayoutWidth! < 65 ? 65 : givenLayoutWidth! > 90 ? 90 : givenLayoutWidth; const layoutWidth = givenLayoutWidth || 75; const root = hierarchy(this.treeData, d => { return d.children; @@ -240,14 +256,14 @@ class LayeredTree extends StandardTree { const treeHeight = root?.height + 1; // Create tree layout, width: layoutWidth, height: layoutWidth/1.5 and add node separation - const treemap = tree() + const treeChart = tree() .nodeSize([layoutWidth, layoutWidth / 1.5]) .separation((a, b) => { return a.parent === root && b.parent === root ? 3.5 : 1; }); // Assigns the x and y position for the nodes - const treeData = treemap(root); + const treeData = treeChart(root); // Compute the new tree layout. const nodes = treeData.descendants(); @@ -257,7 +273,7 @@ class LayeredTree extends StandardTree { // Normalise x coordinate by start coordinate 0 with screenSize/3 nodes.forEach(d => { d.y = d.depth === 0 ? 10 : d.depth * 130; - d.x += screenWidth / 3; + d.x += screenWidth / 2; }); // <------------------ Traversal section ------------------> @@ -274,6 +290,7 @@ class LayeredTree extends StandardTree { children: d.children, dataName: d.data.name, subName: d.data.subname, + bodyText: d.data.bodytext, metricName: d.data?.metric, fill: d.data.fill, x: d.x, @@ -306,8 +323,8 @@ class LayeredTree extends StandardTree { // check for leaf nodes if (!d.children && !parentSet.has(d.parentID) && treeHeight === 3) { - const newWidth = (rectWidth - gap) / 2; - const newHeight = rectHeight; + const compactNodeWidth = (rectWidth - gap) / 2; + const compactNodeHeight = rectHeight; parentSet.add(d.parentID); // <------------------ Links section ------------------> @@ -328,8 +345,9 @@ class LayeredTree extends StandardTree { // eslint-disable-next-line @typescript-eslint/no-explicit-any const children: any = treeDataStructure[d.parentID]?.children; - const dx1: number = treeDataStructure[d.parentID]?.x; - const dx2: number = treeDataStructure[d.parentID]?.x + newWidth + gap; + const compactNodeCenterX1: number = treeDataStructure[d.parentID]?.x - compactNodeWidth / 2 - gap / 2; + const compactNodeCenterX2: number = treeDataStructure[d.parentID]?.x + compactNodeWidth / 2 + gap / 2; + const longNodeCenterX: number = treeDataStructure[d.parentID]?.x; let dy: number = children[0]?.y; for (let itr = 0; itr < children.length; ++itr) { @@ -342,17 +360,20 @@ class LayeredTree extends StandardTree { this.addNodeShapetoSVG( child.data.name, child.data.subname, + child.data.bodytext, child.data.metricName, - itr % 2 === 0 ? dx1 : dx2, + // If the leaf node count is 1 , + //irrespective of provided composition we should always use long composition + itr % 2 === 0 ? (children.length === 1 ? longNodeCenterX : compactNodeCenterX1) : compactNodeCenterX2, dy, child.data.fill, - children.length === 1 ? rectWidth : newWidth, + children.length === 1 ? rectWidth : compactNodeWidth, rectHeight, child.id, parentInfo, ); if (itr % 2 === 1) { - dy += newHeight + gap; + dy += compactNodeHeight + gap; } } // For long compostion @@ -360,8 +381,9 @@ class LayeredTree extends StandardTree { this.addNodeShapetoSVG( child.data.name, child.data.subname, + child.data.bodytext, child.data.metricName, - dx1, + longNodeCenterX, dy, child.data.fill, rectWidth, @@ -369,7 +391,7 @@ class LayeredTree extends StandardTree { child.id, parentInfo, ); - dy += newHeight + gap; + dy += compactNodeHeight + gap; } } @@ -379,24 +401,26 @@ class LayeredTree extends StandardTree { this.addNodeShapetoSVG( child.data.name, child.data.subname, + child.data.bodytext, child.data.metricName, - itr % 2 === 0 ? dx1 : dx2, + itr % 2 === 0 ? compactNodeCenterX1 : compactNodeCenterX2, dy, child.data.fill, - children.length === 1 ? rectWidth : newWidth, + children.length === 1 ? rectWidth : compactNodeWidth, rectHeight, child.id, parentInfo, ); if (itr % 2 === 1) { - dy += newHeight + gap; + dy += compactNodeHeight + gap; } } else { this.addNodeShapetoSVG( child.data.name, child.data.subname, + child.data.bodytext, child.data.metricName, - dx1, + longNodeCenterX, dy, child.data.fill, rectWidth, @@ -404,7 +428,7 @@ class LayeredTree extends StandardTree { child.id, parentInfo, ); - dy += newHeight + gap; + dy += compactNodeHeight + gap; } } } @@ -412,9 +436,11 @@ class LayeredTree extends StandardTree { if (d.children || treeHeight <= 2) { // <------------------ Nodes section ------------------> + // Since the height <=2 we will be using long compositon. this.addNodeShapetoSVG( d.dataName, d.subName, + d.bodyText, d.metricName, d.x, d.y, @@ -445,8 +471,8 @@ export class TreeChartBase extends React.Component { private _composition: number | undefined; private _classNames: IProcessedStyleSet; private _margin: { left: number; right: number; top: number; bottom: number }; - private _nodeElements: Array | React.SVGProps> = []; - private _linkElements: Array> = []; + private _nodeElements: JSX.Element[] = []; + private _linkElements: JSX.Element[] = []; private _treeTraversal: number | undefined; constructor(props: ITreeProps) { @@ -498,27 +524,20 @@ export class TreeChartBase extends React.Component { } } public createTreeChart() { - const nodeElements: Array | React.SVGProps> = []; - const linkElements: Array> = []; - - // Create styleClass object to access it in parent class - const styleClassNames = { - link: this._classNames.link, - rectNode: this._classNames.rectNode, - rectText: this._classNames.rectText, - rectSubText: this._classNames.rectSubText, - rectmetricText: this._classNames.rectMetricText, - }; + const nodeElements: JSX.Element[] = []; + const linkElements: JSX.Element[] = []; + // Instantiate inherited class and call createTree function for the object const treeObject = new LayeredTree( this._treeData, this._composition, - styleClassNames, + this._classNames, nodeElements, linkElements, this._treeTraversal, ); - treeObject.createTree(this.props.layoutWidth, this._width); + const width = this.state._width - this._margin.left - this._margin.right; + treeObject.createTree(this.props.layoutWidth, width); this._nodeElements = nodeElements; this._linkElements = linkElements; } diff --git a/packages/react-charting/src/components/TreeChart/TreeChart.styles.ts b/packages/react-charting/src/components/TreeChart/TreeChart.styles.ts index 4ad561f40a65a8..45f89b733d1dd3 100644 --- a/packages/react-charting/src/components/TreeChart/TreeChart.styles.ts +++ b/packages/react-charting/src/components/TreeChart/TreeChart.styles.ts @@ -29,6 +29,10 @@ export const getStyles = (props: ITreeStyleProps): ITreeStyles => { fill: '#484644', ...props.theme!.fonts.medium, }, + rectBodyText: { + fill: '#808080', + ...props.theme!.fonts.xSmall, + }, rectMetricText: { fill: '#000000', ...props.theme!.fonts.xLarge, diff --git a/packages/react-charting/src/components/TreeChart/TreeChart.types.ts b/packages/react-charting/src/components/TreeChart/TreeChart.types.ts index 65236a2dff7de6..1217b914b0bd78 100644 --- a/packages/react-charting/src/components/TreeChart/TreeChart.types.ts +++ b/packages/react-charting/src/components/TreeChart/TreeChart.types.ts @@ -9,11 +9,15 @@ export interface ITreeChartDataPoint { /** * Subtext value (optional) */ - subname?: string | undefined; + subname?: string; + /** + * Bodytext value (optional) + */ + bodytext?: string; /** * Metric text value (optional) */ - metric?: string | undefined; + metric?: string; /** * Color of the rectangular box */ @@ -54,12 +58,12 @@ export interface ITreeProps { /** * compostion for three layer chart, long: composition = 1; compact: composition = 0 */ - composition?: NodesComposition.long | NodesComposition.compact | undefined; + composition?: NodesComposition.long | NodesComposition.compact; /** * Node Width Size for the Tree Layout * * @default 75 */ - layoutWidth?: number | undefined; + layoutWidth?: number; /** * traversal order for tree chart, preOrder = 1, levelOrder = 0 */ @@ -125,11 +129,15 @@ export interface ITreeDataStructure { /** * Subtext value (optional) */ - subName?: string | undefined; + subName?: string; + /** + * Bodytext value (optional) + */ + bodyText?: string; /** * Metric text value (optional) */ - metricName?: string | undefined; + metricName?: string; /** * Color of the rectangular box */ @@ -179,6 +187,10 @@ export interface ITreeStyles { * Style for the node sub Text */ rectSubText: IStyle; + /** + * Style for the node body Text + */ + rectBodyText: IStyle; /** * Style for the node metric value Text */ diff --git a/packages/react-charting/src/components/TreeChart/__snapshots__/TreeChart.test.tsx.snap b/packages/react-charting/src/components/TreeChart/__snapshots__/TreeChart.test.tsx.snap index 07cf8d44c71f63..d61c93dadc05e9 100644 --- a/packages/react-charting/src/components/TreeChart/__snapshots__/TreeChart.test.tsx.snap +++ b/packages/react-charting/src/components/TreeChart/__snapshots__/TreeChart.test.tsx.snap @@ -53,7 +53,7 @@ subText subtext Root Node" stroke="#0099BC" tabIndex={0} width={225} - x={500} + x={602.5} y={10} /> Root Node subtext @@ -112,7 +112,7 @@ subText subtext Parent info parentId: 0 stroke="#4F6BED" tabIndex={0} width={225} - x={106.25} + x={208.75} y={130} /> Child 1 100% @@ -171,7 +171,7 @@ subText sub Parent info parentId: 1 stroke="#4F6BED" tabIndex={0} width={102.5} - x={106.25} + x={208.75} y={260} /> leaf1 sub @@ -230,7 +230,7 @@ subText undefined Parent info parentId: 1 stroke="#4F6BED" tabIndex={0} width={102.5} - x={228.75} + x={331.25} y={260} /> leaf2 @@ -273,7 +273,7 @@ subText The subtext is as follows: sub Parent info parentId: 1 stroke="#4F6BED" tabIndex={0} width={102.5} - x={106.25} + x={208.75} y={345.2173913043478} /> leaf3 The subtext is as follows: sub @@ -332,7 +332,7 @@ subText sub Parent info parentId: 1 stroke="#4F6BED" tabIndex={0} width={102.5} - x={228.75} + x={331.25} y={345.2173913043478} /> leaf4 sub @@ -391,7 +391,7 @@ subText undefined Parent info parentId: 0 stroke="#881798" tabIndex={0} width={225} - x={368.75} + x={471.25} y={130} /> Child 2 is the child name @@ -434,7 +434,7 @@ subText sub Parent info parentId: 6 stroke="#881798" tabIndex={0} width={102.5} - x={368.75} + x={471.25} y={260} /> leaf5 sub @@ -493,7 +493,7 @@ subText sub Parent info parentId: 6 stroke="#881798" tabIndex={0} width={102.5} - x={491.25} + x={593.75} y={260} /> leaf6 sub @@ -552,7 +552,7 @@ subText The subtext is as follows: subtext Parent info parentId: 0 stroke="#AE8C00" tabIndex={0} width={225} - x={631.25} + x={733.75} y={130} /> Child 3 The subtext is as follows: subtext @@ -611,7 +611,7 @@ subText sub Parent info parentId: 9 stroke="#AE8C00" tabIndex={0} width={102.5} - x={631.25} + x={733.75} y={260} /> leaf7 sub @@ -670,7 +670,7 @@ subText sub Parent info parentId: 9 stroke="#AE8C00" tabIndex={0} width={102.5} - x={753.75} + x={856.25} y={260} /> leaf8 sub @@ -729,7 +729,7 @@ subText sub Parent info parentId: 9 stroke="#AE8C00" tabIndex={0} width={102.5} - x={631.25} + x={733.75} y={345.2173913043478} /> leaf9 sub @@ -788,7 +788,7 @@ subText subtext Parent info parentId: 0 stroke="#FF00FF" tabIndex={0} width={225} - x={893.75} + x={996.25} y={130} /> Child 4 90% @@ -847,7 +847,7 @@ subText sub Parent info parentId: 13 stroke="#FF00FF" tabIndex={0} width={225} - x={893.75} + x={996.25} y={260} /> leaf10 sub @@ -895,7 +895,7 @@ subText sub Parent info parentId: 13 stroke-width: 2px; stroke: #A1A1A1; } - d="M106.25,110 H1118.75 M612.5,110 + d="M208.75,110 H1221.25 M715,110 V85.21739130434783" /> @@ -997,7 +1001,7 @@ subText subtext Root Node" stroke="#0099BC" tabIndex={0} width={225} - x={500} + x={602.5} y={10} /> Root Node subtext @@ -1056,7 +1060,7 @@ subText subtext Parent info parentId: 0 stroke="#4F6BED" tabIndex={0} width={225} - x={106.25} + x={208.75} y={130} /> Child 1 100% @@ -1115,7 +1119,7 @@ subText sub Parent info parentId: 1 stroke="#4F6BED" tabIndex={0} width={225} - x={106.25} + x={208.75} y={260} /> leaf1 sub @@ -1174,7 +1178,7 @@ subText undefined Parent info parentId: 1 stroke="#4F6BED" tabIndex={0} width={225} - x={106.25} + x={208.75} y={345.2173913043478} /> leaf2 @@ -1217,7 +1221,7 @@ subText The subtext is as follows: sub Parent info parentId: 1 stroke="#4F6BED" tabIndex={0} width={225} - x={106.25} + x={208.75} y={430.4347826086956} /> leaf3 The subtext is as follows: sub @@ -1276,7 +1280,7 @@ subText sub Parent info parentId: 1 stroke="#4F6BED" tabIndex={0} width={225} - x={106.25} + x={208.75} y={515.6521739130435} /> leaf4 sub @@ -1335,7 +1339,7 @@ subText undefined Parent info parentId: 0 stroke="#881798" tabIndex={0} width={225} - x={368.75} + x={471.25} y={130} /> Child 2 is the child name @@ -1378,7 +1382,7 @@ subText sub Parent info parentId: 6 stroke="#881798" tabIndex={0} width={225} - x={368.75} + x={471.25} y={260} /> leaf5 sub @@ -1437,7 +1441,7 @@ subText sub Parent info parentId: 6 stroke="#881798" tabIndex={0} width={225} - x={368.75} + x={471.25} y={345.2173913043478} /> leaf6 sub @@ -1496,7 +1500,7 @@ subText The subtext is as follows: subtext Parent info parentId: 0 stroke="#AE8C00" tabIndex={0} width={225} - x={631.25} + x={733.75} y={130} /> Child 3 The subtext is as follows: subtext @@ -1555,7 +1559,7 @@ subText sub Parent info parentId: 9 stroke="#AE8C00" tabIndex={0} width={225} - x={631.25} + x={733.75} y={260} /> leaf7 sub @@ -1614,7 +1618,7 @@ subText sub Parent info parentId: 9 stroke="#AE8C00" tabIndex={0} width={225} - x={631.25} + x={733.75} y={345.2173913043478} /> leaf8 sub @@ -1673,7 +1677,7 @@ subText sub Parent info parentId: 9 stroke="#AE8C00" tabIndex={0} width={225} - x={631.25} + x={733.75} y={430.4347826086956} /> leaf9 sub @@ -1732,7 +1736,7 @@ subText subtext Parent info parentId: 0 stroke="#FF00FF" tabIndex={0} width={225} - x={893.75} + x={996.25} y={130} /> Child 4 90% @@ -1791,7 +1795,7 @@ subText sub Parent info parentId: 13 stroke="#FF00FF" tabIndex={0} width={225} - x={893.75} + x={996.25} y={260} /> leaf10 sub @@ -1839,7 +1843,7 @@ subText sub Parent info parentId: 13 stroke-width: 2px; stroke: #A1A1A1; } - d="M106.25,110 H1118.75 M612.5,110 + d="M208.75,110 H1221.25 M715,110 V85.21739130434783" /> @@ -1941,7 +1949,7 @@ subText subtext Root Node" stroke="#0099BC" tabIndex={0} width={225} - x={500} + x={602.5} y={10} /> Root Node subtext @@ -2000,7 +2008,7 @@ subText subtext Parent info parentId: 0 stroke="#4F6BED" tabIndex={0} width={225} - x={106.25} + x={208.75} y={130} /> Child 1 100% @@ -2059,7 +2067,7 @@ subText sub Parent info parentId: 1 stroke="#4F6BED" tabIndex={0} width={102.5} - x={106.25} + x={208.75} y={260} /> leaf1 sub @@ -2118,7 +2126,7 @@ subText undefined Parent info parentId: 1 stroke="#4F6BED" tabIndex={0} width={102.5} - x={228.75} + x={331.25} y={260} /> leaf2 @@ -2161,7 +2169,7 @@ subText The subtext is as follows: sub Parent info parentId: 1 stroke="#4F6BED" tabIndex={0} width={102.5} - x={106.25} + x={208.75} y={345.2173913043478} /> leaf3 The subtext is as follows: sub @@ -2220,7 +2228,7 @@ subText sub Parent info parentId: 1 stroke="#4F6BED" tabIndex={0} width={102.5} - x={228.75} + x={331.25} y={345.2173913043478} /> leaf4 sub @@ -2279,7 +2287,7 @@ subText undefined Parent info parentId: 0 stroke="#881798" tabIndex={0} width={225} - x={368.75} + x={471.25} y={130} /> Child 2 is the child name @@ -2322,7 +2330,7 @@ subText sub Parent info parentId: 6 stroke="#881798" tabIndex={0} width={225} - x={368.75} + x={471.25} y={260} /> leaf5 sub @@ -2381,7 +2389,7 @@ subText sub Parent info parentId: 6 stroke="#881798" tabIndex={0} width={225} - x={368.75} + x={471.25} y={345.2173913043478} /> leaf6 sub @@ -2440,7 +2448,7 @@ subText The subtext is as follows: subtext Parent info parentId: 0 stroke="#AE8C00" tabIndex={0} width={225} - x={631.25} + x={733.75} y={130} /> Child 3 The subtext is as follows: subtext @@ -2499,7 +2507,7 @@ subText sub Parent info parentId: 9 stroke="#AE8C00" tabIndex={0} width={102.5} - x={631.25} + x={733.75} y={260} /> leaf7 sub @@ -2558,7 +2566,7 @@ subText sub Parent info parentId: 9 stroke="#AE8C00" tabIndex={0} width={102.5} - x={753.75} + x={856.25} y={260} /> leaf8 sub @@ -2617,7 +2625,7 @@ subText sub Parent info parentId: 9 stroke="#AE8C00" tabIndex={0} width={102.5} - x={631.25} + x={733.75} y={345.2173913043478} /> leaf9 sub @@ -2676,7 +2684,7 @@ subText subtext Parent info parentId: 0 stroke="#FF00FF" tabIndex={0} width={225} - x={893.75} + x={996.25} y={130} /> Child 4 90% @@ -2735,7 +2743,7 @@ subText sub Parent info parentId: 13 stroke="#FF00FF" tabIndex={0} width={225} - x={893.75} + x={996.25} y={260} /> leaf10 sub @@ -2783,7 +2791,7 @@ subText sub Parent info parentId: 13 stroke-width: 2px; stroke: #A1A1A1; } - d="M106.25,110 H1118.75 M612.5,110 + d="M208.75,110 H1221.25 M715,110 V85.21739130434783" /> @@ -2885,7 +2897,7 @@ subText subtext Root Node" stroke="#0099BC" tabIndex={0} width={225} - x={500} + x={602.5} y={10} /> Root Node subtext @@ -2944,7 +2956,7 @@ subText Subtext val is subtext Parent info parentId: 0 stroke="#4F6BED" tabIndex={0} width={225} - x={106.25} + x={208.75} y={130} /> Child 1 Subtext val is subtext @@ -3003,7 +3015,7 @@ subText Subtext val is subtext Parent info parentId: 0 stroke="#881798" tabIndex={0} width={225} - x={368.75} + x={471.25} y={130} /> Child 2 Subtext val is subtext @@ -3062,7 +3074,7 @@ subText Subtext val is subtext Parent info parentId: 0 stroke="#AE8C00" tabIndex={0} width={225} - x={631.25} + x={733.75} y={130} /> Child 3 Subtext val is subtext @@ -3121,7 +3133,7 @@ subText Subtext val is subtext Parent info parentId: 0 stroke="#FF00FF" tabIndex={0} width={225} - x={893.75} + x={996.25} y={130} /> Child 4 Subtext val is subtext @@ -3169,7 +3181,7 @@ subText Subtext val is subtext Parent info parentId: 0 stroke-width: 2px; stroke: #A1A1A1; } - d="M106.25,110 H1118.75 M612.5,110 + d="M208.75,110 H1221.25 M715,110 V85.21739130434783" /> diff --git a/packages/react-examples/src/react-charting/TreeChart/TreeChart.ThreeLayer.Example.tsx b/packages/react-examples/src/react-charting/TreeChart/TreeChart.ThreeLayer.Example.tsx index 11a281a1556bc2..b38aa9070b74c0 100644 --- a/packages/react-examples/src/react-charting/TreeChart/TreeChart.ThreeLayer.Example.tsx +++ b/packages/react-examples/src/react-charting/TreeChart/TreeChart.ThreeLayer.Example.tsx @@ -4,6 +4,7 @@ import { TreeChart, ITreeProps, ITreeState } from '@fluentui/react-charting'; const threeLayerChart = { name: 'Root Node', subname: 'subtext', + bodytext: 'bodytext', fill: '#0099BC', children: [ {