diff --git a/404.html b/404.html index 976892dff9..169822979e 100644 --- a/404.html +++ b/404.html @@ -5,8 +5,8 @@ Page Not Found | FluentUI Charting Contrib Docsite - - + +
Skip to main content

Page Not Found

We could not find what you were looking for.

Please contact the owner of the site that linked you to the original URL and let them know their link is broken.

diff --git a/assets/images/DonutChart1-9f10b2df3479f2d893fa20709ae72eb0.png b/assets/images/DonutChart1-9f10b2df3479f2d893fa20709ae72eb0.png new file mode 100644 index 0000000000..97ec2f4571 Binary files /dev/null and b/assets/images/DonutChart1-9f10b2df3479f2d893fa20709ae72eb0.png differ diff --git a/assets/images/DonutChart2-8fa01069f0af01a5a142c8909c588c1f.png b/assets/images/DonutChart2-8fa01069f0af01a5a142c8909c588c1f.png new file mode 100644 index 0000000000..4aeddc0735 Binary files /dev/null and b/assets/images/DonutChart2-8fa01069f0af01a5a142c8909c588c1f.png differ diff --git a/assets/images/DonutChart3-43bb764e6b1372961370da02b2f7196b.png b/assets/images/DonutChart3-43bb764e6b1372961370da02b2f7196b.png new file mode 100644 index 0000000000..329e1c9163 Binary files /dev/null and b/assets/images/DonutChart3-43bb764e6b1372961370da02b2f7196b.png differ diff --git a/assets/images/GVBC1-bfb960362b8a441805cd138056a2f8f6.png b/assets/images/GVBC1-bfb960362b8a441805cd138056a2f8f6.png new file mode 100644 index 0000000000..d13d165632 Binary files /dev/null and b/assets/images/GVBC1-bfb960362b8a441805cd138056a2f8f6.png differ diff --git a/assets/images/GVBC2-d4cbda92ad72f6f1a2f85f9e2341b6e0.png b/assets/images/GVBC2-d4cbda92ad72f6f1a2f85f9e2341b6e0.png new file mode 100644 index 0000000000..0e0c073c7b Binary files /dev/null and b/assets/images/GVBC2-d4cbda92ad72f6f1a2f85f9e2341b6e0.png differ diff --git a/assets/images/GVBC3-15789353c5cef662c6d0f971540ad844.png b/assets/images/GVBC3-15789353c5cef662c6d0f971540ad844.png new file mode 100644 index 0000000000..774ef70258 Binary files /dev/null and b/assets/images/GVBC3-15789353c5cef662c6d0f971540ad844.png differ diff --git a/assets/images/Sparkline1-a8ff43c85309eba19385b762775ce8af.png b/assets/images/Sparkline1-a8ff43c85309eba19385b762775ce8af.png new file mode 100644 index 0000000000..9a33d706c7 Binary files /dev/null and b/assets/images/Sparkline1-a8ff43c85309eba19385b762775ce8af.png differ diff --git a/assets/images/Sparkline2-3d71bcc13bdec5365ffc0802a3515f57.png b/assets/images/Sparkline2-3d71bcc13bdec5365ffc0802a3515f57.png new file mode 100644 index 0000000000..f3433b3927 Binary files /dev/null and b/assets/images/Sparkline2-3d71bcc13bdec5365ffc0802a3515f57.png differ diff --git a/assets/images/VBC1-bb6595c22f4de60c6aebc16359482663.png b/assets/images/VBC1-bb6595c22f4de60c6aebc16359482663.png new file mode 100644 index 0000000000..6d726a0110 Binary files /dev/null and b/assets/images/VBC1-bb6595c22f4de60c6aebc16359482663.png differ diff --git a/assets/images/VBC2-8ab8b2b71a752a09e6160710baaab17a.png b/assets/images/VBC2-8ab8b2b71a752a09e6160710baaab17a.png new file mode 100644 index 0000000000..ac9705b894 Binary files /dev/null and b/assets/images/VBC2-8ab8b2b71a752a09e6160710baaab17a.png differ diff --git a/assets/images/VBC3-0446d2d3c1c321827e398d8ecd1c9057.png b/assets/images/VBC3-0446d2d3c1c321827e398d8ecd1c9057.png new file mode 100644 index 0000000000..03555a6e67 Binary files /dev/null and b/assets/images/VBC3-0446d2d3c1c321827e398d8ecd1c9057.png differ diff --git a/assets/images/VBC_f1-86ad6759ab4ed50b9f22c761d9645973.png b/assets/images/VBC_f1-86ad6759ab4ed50b9f22c761d9645973.png new file mode 100644 index 0000000000..58071a565b Binary files /dev/null and b/assets/images/VBC_f1-86ad6759ab4ed50b9f22c761d9645973.png differ diff --git a/assets/images/VBC_f2-2d56c3cf1651669a96c6ba1570f477df.png b/assets/images/VBC_f2-2d56c3cf1651669a96c6ba1570f477df.png new file mode 100644 index 0000000000..f8de798cba Binary files /dev/null and b/assets/images/VBC_f2-2d56c3cf1651669a96c6ba1570f477df.png differ diff --git a/assets/images/VBC_f3-30c3db0ac6ae137e267c52d6b3a43746.png b/assets/images/VBC_f3-30c3db0ac6ae137e267c52d6b3a43746.png new file mode 100644 index 0000000000..219a7b8e31 Binary files /dev/null and b/assets/images/VBC_f3-30c3db0ac6ae137e267c52d6b3a43746.png differ diff --git a/assets/images/VBC_f4-ffb3da2424b492b04995aab01fb70afa.png b/assets/images/VBC_f4-ffb3da2424b492b04995aab01fb70afa.png new file mode 100644 index 0000000000..3e6e230bdc Binary files /dev/null and b/assets/images/VBC_f4-ffb3da2424b492b04995aab01fb70afa.png differ diff --git a/assets/images/VBC_f5-5815e87496c11f471d243c808a86a082.png b/assets/images/VBC_f5-5815e87496c11f471d243c808a86a082.png new file mode 100644 index 0000000000..8a7c801f91 Binary files /dev/null and b/assets/images/VBC_f5-5815e87496c11f471d243c808a86a082.png differ diff --git a/assets/images/VBC_f6-12092fc4a1cd14cd8196d102472960ab.png b/assets/images/VBC_f6-12092fc4a1cd14cd8196d102472960ab.png new file mode 100644 index 0000000000..a5f26112a1 Binary files /dev/null and b/assets/images/VBC_f6-12092fc4a1cd14cd8196d102472960ab.png differ diff --git a/assets/images/VBC_f7-78ec7172b86cb7cd832f6025adad8fef.png b/assets/images/VBC_f7-78ec7172b86cb7cd832f6025adad8fef.png new file mode 100644 index 0000000000..dae42e9425 Binary files /dev/null and b/assets/images/VBC_f7-78ec7172b86cb7cd832f6025adad8fef.png differ diff --git a/assets/images/VSBC1-de2ee9ef0194f703abc7f8806bc869e7.png b/assets/images/VSBC1-de2ee9ef0194f703abc7f8806bc869e7.png new file mode 100644 index 0000000000..e58ebc4e10 Binary files /dev/null and b/assets/images/VSBC1-de2ee9ef0194f703abc7f8806bc869e7.png differ diff --git a/assets/images/VSBC2-3decd6986a55117047292cb20444e7c1.png b/assets/images/VSBC2-3decd6986a55117047292cb20444e7c1.png new file mode 100644 index 0000000000..6f637b3eee Binary files /dev/null and b/assets/images/VSBC2-3decd6986a55117047292cb20444e7c1.png differ diff --git a/assets/images/VSBC3-01489e0f79d82ab97318b9dc49952bae.png b/assets/images/VSBC3-01489e0f79d82ab97318b9dc49952bae.png new file mode 100644 index 0000000000..2cc624c2ee Binary files /dev/null and b/assets/images/VSBC3-01489e0f79d82ab97318b9dc49952bae.png differ diff --git a/assets/js/1d29b0d8.77873fa9.js b/assets/js/1d29b0d8.77873fa9.js deleted file mode 100644 index ac229a3f98..0000000000 --- a/assets/js/1d29b0d8.77873fa9.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkdocsite=self.webpackChunkdocsite||[]).push([[3861],{6001:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>h,contentTitle:()=>o,default:()=>c,frontMatter:()=>r,metadata:()=>s,toc:()=>d});var i=t(5893),a=t(1151);const r={},o="Contributor Guide: Sankey Chart",s={id:"Charting-Concepts/SankeyChart",title:"Contributor Guide: Sankey Chart",description:"Sankey charts are a type of data visualization that are particularly useful for showing the flow of resources, energy, or information through a system. They are characterized by their flowing, interconnected arrows that represent the quantity or value of something as it moves from one stage or category to another.",source:"@site/../../docs/Charting-Concepts/SankeyChart.md",sourceDirName:"Charting-Concepts",slug:"/Charting-Concepts/SankeyChart",permalink:"/fluentui-charting-contrib/docs/Charting-Concepts/SankeyChart",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{},sidebar:"tutorialSidebar",previous:{title:"Contributor guide: Line Chart",permalink:"/fluentui-charting-contrib/docs/Charting-Concepts/LineChart"},next:{title:"Contributor guide: Stacked Bar Chart",permalink:"/fluentui-charting-contrib/docs/Charting-Concepts/StackedBarChart"}},h={},d=[{value:"Use cases:",id:"use-cases",level:2},{value:"Dev Design details",id:"dev-design-details",level:2},{value:"1. Nodes",id:"1-nodes",level:3},{value:"2.Links",id:"2links",level:3},{value:"Flow Direction",id:"flow-direction",level:4},{value:"Width",id:"width",level:4},{value:"Color",id:"color",level:4},{value:"Interactivity",id:"interactivity",level:4},{value:"Mathematical/Geometrical concepts",id:"mathematicalgeometrical-concepts",level:2},{value:"Dynamic node padding in Fluent Sankey chart",id:"dynamic-node-padding-in-fluent-sankey-chart",level:3},{value:"Minimum height of the node for Fluent Sankey charts will be 1% of the total column height.",id:"minimum-height-of-the-node-for-fluent-sankey-charts-will-be-1-of-the-total-column-height",level:3},{value:"Performance",id:"performance",level:2},{value:"Accessibility",id:"accessibility",level:2},{value:"Variants",id:"variants",level:2},{value:"Error scenarios",id:"error-scenarios",level:2},{value:"Chart is not rendered properly if for a link source and target node will be same.",id:"chart-is-not-rendered-properly-if-for-a-link-source-and-target-node-will-be-same",level:3},{value:"Chart is not rendered properly if consistent names are not used properly while configuring links.",id:"chart-is-not-rendered-properly-if-consistent-names--are-not-used-properly-while-configuring-links",level:3},{value:"The chart cannot be loaded because of one or more reasons:",id:"the-chart-cannot-be-loaded-because-of-one-or-more-reasons",level:3},{value:"The chart is in a loading state because of one or more reasons below.",id:"the-chart-is-in-a-loading-state-because-of-one-or-more-reasons-below",level:3},{value:"Extremely high density:",id:"extremely-high-density",level:3},{value:"Some notable PRs and their brief description",id:"some-notable-prs-and-their-brief-description",level:2},{value:"Design figma",id:"design-figma",level:2},{value:"Rendering details",id:"rendering-details",level:2},{value:"Interactions",id:"interactions",level:2},{value:"Hover Over Nodes",id:"hover-over-nodes",level:4},{value:"Hover Over links",id:"hover-over-links",level:4}];function l(e){const n={a:"a",code:"code",h1:"h1",h2:"h2",h3:"h3",h4:"h4",img:"img",li:"li",p:"p",ul:"ul",...(0,a.a)(),...e.components};return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(n.h1,{id:"contributor-guide-sankey-chart",children:"Contributor Guide: Sankey Chart"}),"\n",(0,i.jsx)(n.p,{children:"Sankey charts are a type of data visualization that are particularly useful for showing the flow of resources, energy, or information through a system. They are characterized by their flowing, interconnected arrows that represent the quantity or value of something as it moves from one stage or category to another."}),"\n",(0,i.jsx)(n.h2,{id:"use-cases",children:"Use cases:"}),"\n",(0,i.jsx)(n.p,{children:"Sankey charts are used for various use cases which involve Energy Flows, Material Flow Analysis, Website User Flow, Customer Journey Mapping, Water Usage and Conservation, Financial Flows, Environmental Impact, Project Management etc."}),"\n",(0,i.jsx)(n.p,{children:"###Fluent Sankey charts offer various functionalities, including node descriptions, diverse hover actions triggered when interacting with nodes and links."}),"\n",(0,i.jsx)(n.p,{children:(0,i.jsx)(n.img,{alt:"image.png",src:t(7994).Z+"",width:"1210",height:"728"})}),"\n",(0,i.jsx)(n.h2,{id:"dev-design-details",children:"Dev Design details"}),"\n",(0,i.jsx)(n.p,{children:"Following are the major components that contribute towards creating a complete Sankey Chart"}),"\n",(0,i.jsx)(n.h3,{id:"1-nodes",children:"1. Nodes"}),"\n",(0,i.jsx)(n.p,{children:'In a Sankey chart, "nodes" represent the distinct categories or stages within a system where resources, energy, or information flow. These nodes are usually depicted as rectangles or blocks, and they are interconnected by arrows or lines that indicate the flow between them. Each node represents a specific entity or group, and the width of the arrows or lines is proportional to the quantity or value of what is flowing from one node to another.\n_createNodes() is used for creating Sankey nodes .This function creates an array of React nodes based on the SankeyChartData property of the data object passed in as a prop. For each node in the SankeyChartData.nodes array, the method calculates the height of the node based on the difference between the y1 and y0 properties of the node. If the height is less than a certain minimum height, an extra padding of 6 pixels is added between the node description and the node weight. The method then truncates the node name to fit within the available space, and creates a tooltip with the full node name.The method then creates a React node for the current node, which consists of a rectangle and two text elements. The rectangle is positioned based on the x0, y0, x1, and y1 properties of the node, and is filled with a color based on the fillNodeColors method. The rectangle also has event handlers for mouseover, mouseout, and focus events.The two text elements are positioned based on the height of the node and the length of the node weight text. The first text element contains the node name, and the second text element contains the node weight. Both text elements have event handlers for mouseover and mouseout events that show and hide the tooltip, respectively.'}),"\n",(0,i.jsx)(n.h3,{id:"2links",children:"2.Links"}),"\n",(0,i.jsx)(n.p,{children:'In a Sankey chart, "links" represent the connections or flows of resources, energy, or information between nodes. Links are typically depicted as lines or arrows that connect one node to another, indicating the quantity or value of what is flowing from the source node to the target node. Here are some key characteristics of links in Sankey charts:'}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\n",(0,i.jsx)(n.h4,{id:"flow-direction",children:"Flow Direction"}),"\n"]}),"\n"]}),"\n",(0,i.jsx)(n.p,{children:"Links have a direction, moving from a source node to a target node. The direction of the link illustrates how resources or information is flowing within the system."}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\n",(0,i.jsx)(n.h4,{id:"width",children:"Width"}),"\n"]}),"\n"]}),"\n",(0,i.jsx)(n.p,{children:"The width of the link is proportional to the quantity or value of the flow it represents. Wider links indicate larger flows, while narrower links represent smaller flows."}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\n",(0,i.jsx)(n.h4,{id:"color",children:"Color"}),"\n"]}),"\n"]}),"\n",(0,i.jsx)(n.p,{children:"Links can be colored to provide additional information or to differentiate between different types of flows or categories. For example, different colors might represent different materials, energy sources, or information types."}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\n",(0,i.jsx)(n.h4,{id:"interactivity",children:"Interactivity"}),"\n"]}),"\n"]}),"\n",(0,i.jsx)(n.p,{children:"In some Sankey charts, links can be interactive. For instance, hovering over a link may display additional information, such as the exact value of the flow or other related data."}),"\n",(0,i.jsxs)(n.p,{children:["Links are created using createLInks() function. The method takes no arguments. For each link, the method creates a linear gradient that goes from the color of the source node to the color of the target node. The method then calculates the data points for the link area using the ",(0,i.jsx)(n.code,{children:"data"})," function, which takes a single link object and returns an array of two points that define the shape of the link. the ",(0,i.jsx)(n.code,{children:"d3CurveBasis"})," curve type to create a smooth curve for the link area. The method then creates a React node for the link, which consists of a ",(0,i.jsx)(n.code,{children:"path"})," element that uses the link area to define its shape. The ",(0,i.jsx)(n.code,{children:"path"})," element is filled with the linear gradient created earlier, and has a stroke color and width that are determined by the",(0,i.jsx)(n.code,{children:"_fillStreamBorder"})," and ",(0,i.jsx)(n.code,{children:"_getOpacityStreamBorder"})," methods, respectively."]}),"\n",(0,i.jsx)(n.h2,{id:"mathematicalgeometrical-concepts",children:"Mathematical/Geometrical concepts"}),"\n",(0,i.jsxs)(n.p,{children:[(0,i.jsx)(n.a,{href:"https://github.com/d3/d3-sankey",children:"d3-sankey"})," is a JavaScript library that extends the capabilities of the popular data visualization library D3.js to create Sankey charts easily. The primary role of ",(0,i.jsx)(n.a,{href:"https://github.com/d3/d3-sankey",children:"d3-sankey"})," in creating Sankey charts is to simplify the process of generating these complex diagrams by providing a set of functions and methods tailored specifically for Sankey diagrams.\nThe _preRenderLayout method initializes a d3Sankey object that is used to calculate the layout of the Sankey diagram. The d3Sankey object is configured with various properties, such as the width of the nodes, the extent of the diagram, and the alignment of the nodes.The d3Sankey object is then used to calculate the layout of the Sankey diagram in the _createNodes and _createLinks methods. The d3Sankey object takes in the nodes and links arrays and calculates the positions of the nodes and the paths of the links based on the properties of the nodes and links.\n\u2022\tNodes will contain an array of node objects, each with properties like name, x0, x1, y0, and y1.\n\u2022\tLinks will contain an array of link objects, each with properties like source, target, and value."]}),"\n",(0,i.jsx)(n.h3,{id:"dynamic-node-padding-in-fluent-sankey-chart",children:"Dynamic node padding in Fluent Sankey chart"}),"\n",(0,i.jsxs)(n.p,{children:["We have also introduced dynamic padding concept for Sankey charts .This is used for cases where the number of nodes in a column is huge.so that we maintain a node to space ratio for such columns as if we fail to do so the chart is devoid of nodes and only shows links. See the code for dynamic at ",(0,i.jsx)(n.a,{href:"https://github.com/microsoft/fluentui/blob/f9ef593dd07abb0341e7be09f60cb841d577135d/packages/react-charting/src/components/SankeyChart/SankeyChart.base.tsx#L295",children:"githublink"}),". This is necessary because D3 Sankey reduces the node height when there are more nodes within a constrained chart height while maintaining the same node padding as specified."]}),"\n",(0,i.jsx)(n.h3,{id:"minimum-height-of-the-node-for-fluent-sankey-charts-will-be-1-of-the-total-column-height",children:"Minimum height of the node for Fluent Sankey charts will be 1% of the total column height."}),"\n",(0,i.jsx)(n.h2,{id:"performance",children:"Performance"}),"\n",(0,i.jsx)(n.p,{children:"The performance aspect of a chart refers to how efficiently and effectively it conveys information to the viewer. Here are some key considerations regarding the performance of a area chart:"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"Data Visualization Efficiency"}),"\n",(0,i.jsx)(n.li,{children:"Clarity and Simplicity"}),"\n",(0,i.jsx)(n.li,{children:"Responsiveness"}),"\n",(0,i.jsx)(n.li,{children:"Handling Large Datasets"}),"\n",(0,i.jsx)(n.li,{children:"Interactive Features"}),"\n"]}),"\n",(0,i.jsx)(n.p,{children:"We use Lighthouse tool for measuring the performance of our charts. Currently we are working on improving the performance . We are currently working on improving 3 of the performance lighthouse metrics FCP, TBT, TTI.\nThe current implementation of the Sankey chart is already performing well. However, as part of our future plans, we aim to assess the Lighthouse performance score, particularly when dealing with extensive datasets for the chart. We are committed to enhancing the performance further by identifying and capitalizing on any opportunities for improvement that may arise."}),"\n",(0,i.jsx)(n.h2,{id:"accessibility",children:"Accessibility"}),"\n",(0,i.jsxs)(n.p,{children:["Chart ",(0,i.jsx)(n.code,{children:""}),"The role is set as presentation, and the aria-label attribute is set as a string to describe its contents. This is readable by screen reader if user has given chartTitle prop\nHorizontal bar chart provides a bunch of props to enable custom accessibility messages. UsexAxisCalloutAccessibilityData and callOutAccessibilityData to configure x axis and y axis accessibility messages respectively."]}),"\n",(0,i.jsx)(n.h2,{id:"variants",children:"Variants"}),"\n",(0,i.jsxs)(n.p,{children:["Different variants of Sankey chart are available at below location:\n",(0,i.jsx)(n.a,{href:"https://developer.microsoft.com/en-us/fluentui#/controls/web/sankeychart",children:"Fluent UI React Charting Examples - Sankey Charts"}),"\nThe Variants in the above consisting of different functionalities:"]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"Nodes can have customized colors, or else the default colors will be assigned. The node border also follows the same approach."}),"\n",(0,i.jsxs)(n.li,{children:["The color of links depends on the action taken on the chart. In the default state, the link color is grey. However, when hovering over the link, it transitions into a gradient between the source and target nodes, creating a visually appealing effect.\n",(0,i.jsx)(n.img,{alt:"image.png",src:t(2323).Z+"",width:"1164",height:"444"})]}),"\n",(0,i.jsxs)(n.li,{children:["The details inside nodes, such as node name and weight, depend on the size of the node. If the node's height is less than 24px, no details will appear inside the node. This is because with such limited width, reading any details within the node becomes challenging. We will cover an alternative method for accessing this information in the interaction section of the contributor guide.\n",(0,i.jsx)(n.img,{alt:"image.png",src:t(1435).Z+"",width:"240",height:"48"})]}),"\n",(0,i.jsxs)(n.li,{children:["There are two ways to display the node name and weight. To have the node name and weight displayed on two separate lines, a minimum height of 36px is required.\n",(0,i.jsx)(n.img,{alt:"image.png",src:t(3593).Z+"",width:"898",height:"210"})]}),"\n"]}),"\n",(0,i.jsx)(n.h2,{id:"error-scenarios",children:"Error scenarios"}),"\n",(0,i.jsx)(n.h3,{id:"chart-is-not-rendered-properly-if-for-a-link-source-and-target-node-will-be-same",children:"Chart is not rendered properly if for a link source and target node will be same."}),"\n",(0,i.jsx)(n.h3,{id:"chart-is-not-rendered-properly-if-consistent-names--are-not-used-properly-while-configuring-links",children:"Chart is not rendered properly if consistent names are not used properly while configuring links."}),"\n",(0,i.jsx)(n.h3,{id:"the-chart-cannot-be-loaded-because-of-one-or-more-reasons",children:"The chart cannot be loaded because of one or more reasons:"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"Empty data passed such that chart does not have visual to show."}),"\n",(0,i.jsx)(n.li,{children:"One of the datapoint passed to the chart is corrupted. The corrupted datapoint can be for a continuous chart like line or area, or a discrete chart like bar chart, donut chart."}),"\n",(0,i.jsx)(n.li,{children:"The type of data passed to the chart is not supported."}),"\n",(0,i.jsx)(n.li,{children:"The user has not provided the required property."}),"\n"]}),"\n",(0,i.jsx)(n.h3,{id:"the-chart-is-in-a-loading-state-because-of-one-or-more-reasons-below",children:"The chart is in a loading state because of one or more reasons below."}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"The chart data is too heavy."}),"\n",(0,i.jsx)(n.li,{children:"Chart is waiting for data from a webservice."}),"\n"]}),"\n",(0,i.jsx)(n.h3,{id:"extremely-high-density",children:"Extremely high density:"}),"\n",(0,i.jsx)(n.p,{children:"The number of nodes in the chart are more considering the height and width of the canvas provided."}),"\n",(0,i.jsx)(n.h2,{id:"some-notable-prs-and-their-brief-description",children:"Some notable PRs and their brief description"}),"\n",(0,i.jsx)(n.p,{children:(0,i.jsx)(n.a,{href:"https://github.com/microsoft/fluentui/pull/25455",children:"PR"})}),"\n",(0,i.jsx)(n.h2,{id:"design-figma",children:"Design figma"}),"\n",(0,i.jsxs)(n.p,{children:["Sankey Chart Figma : ",(0,i.jsx)(n.a,{href:"https://www.figma.com/file/WOoCs0CmNYZhYl9xXeCGpi/Data-viz-(Archive)?type=design&node-id=21212-72120&mode=design&t=uSjYIeUd9e3vBPuc-0",children:"Data viz (Archive) \u2013 Figma"})]}),"\n",(0,i.jsx)(n.h2,{id:"rendering-details",children:"Rendering details"}),"\n",(0,i.jsx)(n.p,{children:"The Sankey chart in SankeyChart.base.tsx is rendered using D3.js, a popular JavaScript library for data visualization. The chart is created by rendering a series of SVG elements, including rectangles for the nodes and paths for the links between the nodes.\nThe chart is created in the _createSankey function, which initializes the D3 Sankey layout and sets the chart's dimensions and margins. The function then creates the nodes and links for the chart using the d3.sankey layout and the chart's data.\nThe nodes are rendered as rectangles using the rect SVG element, with the position and size of each rectangle determined by the x, y, width, and height properties of the node. The links between the nodes are rendered as paths using the path SVG element, with the position and shape of each path determined by the x0, y0, x1, y1, and width properties of the link.\nThe chart also includes event handlers for mouseover and mouseout events on the nodes and links, which highlight the corresponding elements and display tooltips with additional information."}),"\n",(0,i.jsx)(n.h2,{id:"interactions",children:"Interactions"}),"\n",(0,i.jsx)(n.p,{children:"There are various interactions that a user experiences in Line Chart which are"}),"\n",(0,i.jsx)(n.h4,{id:"hover-over-nodes",children:"Hover Over Nodes"}),"\n",(0,i.jsxs)(n.p,{children:["When the user hovers over nodes, the entire flow associated with that node will be highlighted, encompassing both the links and nodes within the entire flow. Furthermore, the entire flow will be colored to match the node upon which the user has hovered. To enhance visibility, all other nodes will be rendered in white with reduced opacity.Below is an example. Here user has hovered over node with value 62 .\n",(0,i.jsx)(n.img,{alt:"image.png",src:t(488).Z+"",width:"998",height:"472"})]}),"\n",(0,i.jsx)(n.p,{children:"Hovering on the node with height less than 24px will display a callout with details of node name and weight."}),"\n",(0,i.jsx)(n.h4,{id:"hover-over-links",children:"Hover Over links"}),"\n",(0,i.jsx)(n.p,{children:"When the user hovers over a link, the entire flow will be highlighted. All nodes will retain their original colors, while the links themselves will adopt a gradient color derived from the source and target nodes. Additionally, a callout will appear, displaying details about the link, such as the source node's name, weight, and the target node's name. To enhance the visual appeal, the link border will also transition into a gradient when the link is hovered over. Below is an example of a link being hovered over, in this case, between node 4 and node 12."}),"\n",(0,i.jsx)(n.p,{children:(0,i.jsx)(n.img,{alt:"image.png",src:t(4010).Z+"",width:"1032",height:"628"})})]})}function c(e={}){const{wrapper:n}={...(0,a.a)(),...e.components};return n?(0,i.jsx)(n,{...e,children:(0,i.jsx)(l,{...e})}):l(e)}},7994:(e,n,t)=>{t.d(n,{Z:()=>i});const i=t.p+"assets/images/SankeyChartPic1-21938ac4624ca9c0b2e7a81642895f54.png"},2323:(e,n,t)=>{t.d(n,{Z:()=>i});const i=t.p+"assets/images/SankeyChartPic2-f8b20217db956a3f15db72749f483f96.png"},3593:(e,n,t)=>{t.d(n,{Z:()=>i});const i=t.p+"assets/images/SankeyChartPic4-94529d27a2a3b60dc3a8eb5bbe3da5c6.png"},488:(e,n,t)=>{t.d(n,{Z:()=>i});const i=t.p+"assets/images/SankeyChartPic5-981250d62a5438d1f49a7189100e63c0.png"},4010:(e,n,t)=>{t.d(n,{Z:()=>i});const i=t.p+"assets/images/SankeyChartPic6-af110dd78bfea90678297931ac13a72f.png"},1435:(e,n,t)=>{t.d(n,{Z:()=>i});const i="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAPAAAAAwCAYAAAAvvfcmAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAAHYcAAB2HAY/l8WUAAABfaVRYdFNuaXBNZXRhZGF0YQAAAAAAeyJjbGlwUG9pbnRzIjpbeyJ4IjowLCJ5IjowfSx7IngiOjIzOSwieSI6MH0seyJ4IjoyMzksInkiOjQ3fSx7IngiOjAsInkiOjQ3fV19jVsYmgAAAjdJREFUeF7t3c1qE1EYh/F3JnZrKdoplmiySqyIrqRgaBFlaKgrpYuKbrqpS115Bd6D9+JGdOtGdNMvreIHkhYqtYFUOhPPmQyl2ya1zD8+P3jJIZPVwJMZknASdB0DICdwwnwNQBABA8IIGBBGwIAwAgaEETAgjIABYQQMCCNgQBgBA8Jkf0r541vLnj97YR/XvtrIyJn8WaCIAjddS5LUZuau2fStKfPZ+YnjuPeSPvifUsoHvLH6xcbOjtvEWNWdpt6JAgojCKzzp23ft9ezgO8uNOz+o/gw4HK5nL/w+IYi4PWVzzY5XrUrlZtWCkouXwJGcbjEbOd3y959emXJQerivWPLTxbzo4MZmoAvnK/Y5UvTBIzC8QH/2tuy95tvsoDvPbxtj58+yI8OxvfLh1iAMAIGhBEwIIyAAWEEDAgjYEAYAQPCCBgQRsCAMAIGhBEwIIyAAWEEDAgjYEAYAQPCCBgQRsCAMAIGhBEwIGwoAva7UYZhiWGKOUd2rvJ7ZJ2kodhW9tzohJWjuns34oYCBeN6bXd2bfPnh2xTu/mFhi0uzecHzaIoylfH5ze1Y2N34JT4faEb8VW7MVvP9oT2ms1m9tgP36/sJcufgDRNrZv6x96aYYo6SZJk49dh6O4V8xmU7BV4u7Vjr1++tb3dtgUncCKAfyVJDmy/s2+pS+1iNbL69crhH4jUarXeog/St9DA/076FhoA3wMD0ggYEEbAgDACBoQRMCCMgAEAOH1mfwGdx7oHd1aLQgAAAABJRU5ErkJggg=="},1151:(e,n,t)=>{t.d(n,{Z:()=>s,a:()=>o});var i=t(7294);const a={},r=i.createContext(a);function o(e){const n=i.useContext(r);return i.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function s(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(a):e.components||a:o(e.components),i.createElement(r.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/1d29b0d8.8fa1bc20.js b/assets/js/1d29b0d8.8fa1bc20.js new file mode 100644 index 0000000000..a2dbb29a00 --- /dev/null +++ b/assets/js/1d29b0d8.8fa1bc20.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkdocsite=self.webpackChunkdocsite||[]).push([[3861],{6001:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>h,contentTitle:()=>o,default:()=>c,frontMatter:()=>r,metadata:()=>s,toc:()=>d});var i=t(5893),a=t(1151);const r={},o="Contributor Guide: Sankey Chart",s={id:"Charting-Concepts/SankeyChart",title:"Contributor Guide: Sankey Chart",description:"Sankey charts are a type of data visualization that are particularly useful for showing the flow of resources, energy, or information through a system. They are characterized by their flowing, interconnected arrows that represent the quantity or value of something as it moves from one stage or category to another.",source:"@site/../../docs/Charting-Concepts/SankeyChart.md",sourceDirName:"Charting-Concepts",slug:"/Charting-Concepts/SankeyChart",permalink:"/fluentui-charting-contrib/docs/Charting-Concepts/SankeyChart",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{},sidebar:"tutorialSidebar",previous:{title:"Contributor guide: Line Chart",permalink:"/fluentui-charting-contrib/docs/Charting-Concepts/LineChart"},next:{title:"Contributor guide: Sparkline Chart",permalink:"/fluentui-charting-contrib/docs/Charting-Concepts/SparklineChart"}},h={},d=[{value:"Use cases:",id:"use-cases",level:2},{value:"Dev Design details",id:"dev-design-details",level:2},{value:"1. Nodes",id:"1-nodes",level:3},{value:"2.Links",id:"2links",level:3},{value:"Flow Direction",id:"flow-direction",level:4},{value:"Width",id:"width",level:4},{value:"Color",id:"color",level:4},{value:"Interactivity",id:"interactivity",level:4},{value:"Mathematical/Geometrical concepts",id:"mathematicalgeometrical-concepts",level:2},{value:"Dynamic node padding in Fluent Sankey chart",id:"dynamic-node-padding-in-fluent-sankey-chart",level:3},{value:"Minimum height of the node for Fluent Sankey charts will be 1% of the total column height.",id:"minimum-height-of-the-node-for-fluent-sankey-charts-will-be-1-of-the-total-column-height",level:3},{value:"Performance",id:"performance",level:2},{value:"Accessibility",id:"accessibility",level:2},{value:"Variants",id:"variants",level:2},{value:"Error scenarios",id:"error-scenarios",level:2},{value:"Chart is not rendered properly if for a link source and target node will be same.",id:"chart-is-not-rendered-properly-if-for-a-link-source-and-target-node-will-be-same",level:3},{value:"Chart is not rendered properly if consistent names are not used properly while configuring links.",id:"chart-is-not-rendered-properly-if-consistent-names--are-not-used-properly-while-configuring-links",level:3},{value:"The chart cannot be loaded because of one or more reasons:",id:"the-chart-cannot-be-loaded-because-of-one-or-more-reasons",level:3},{value:"The chart is in a loading state because of one or more reasons below.",id:"the-chart-is-in-a-loading-state-because-of-one-or-more-reasons-below",level:3},{value:"Extremely high density:",id:"extremely-high-density",level:3},{value:"Some notable PRs and their brief description",id:"some-notable-prs-and-their-brief-description",level:2},{value:"Design figma",id:"design-figma",level:2},{value:"Rendering details",id:"rendering-details",level:2},{value:"Interactions",id:"interactions",level:2},{value:"Hover Over Nodes",id:"hover-over-nodes",level:4},{value:"Hover Over links",id:"hover-over-links",level:4}];function l(e){const n={a:"a",code:"code",h1:"h1",h2:"h2",h3:"h3",h4:"h4",img:"img",li:"li",p:"p",ul:"ul",...(0,a.a)(),...e.components};return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(n.h1,{id:"contributor-guide-sankey-chart",children:"Contributor Guide: Sankey Chart"}),"\n",(0,i.jsx)(n.p,{children:"Sankey charts are a type of data visualization that are particularly useful for showing the flow of resources, energy, or information through a system. They are characterized by their flowing, interconnected arrows that represent the quantity or value of something as it moves from one stage or category to another."}),"\n",(0,i.jsx)(n.h2,{id:"use-cases",children:"Use cases:"}),"\n",(0,i.jsx)(n.p,{children:"Sankey charts are used for various use cases which involve Energy Flows, Material Flow Analysis, Website User Flow, Customer Journey Mapping, Water Usage and Conservation, Financial Flows, Environmental Impact, Project Management etc."}),"\n",(0,i.jsx)(n.p,{children:"###Fluent Sankey charts offer various functionalities, including node descriptions, diverse hover actions triggered when interacting with nodes and links."}),"\n",(0,i.jsx)(n.p,{children:(0,i.jsx)(n.img,{alt:"image.png",src:t(7994).Z+"",width:"1210",height:"728"})}),"\n",(0,i.jsx)(n.h2,{id:"dev-design-details",children:"Dev Design details"}),"\n",(0,i.jsx)(n.p,{children:"Following are the major components that contribute towards creating a complete Sankey Chart"}),"\n",(0,i.jsx)(n.h3,{id:"1-nodes",children:"1. Nodes"}),"\n",(0,i.jsx)(n.p,{children:'In a Sankey chart, "nodes" represent the distinct categories or stages within a system where resources, energy, or information flow. These nodes are usually depicted as rectangles or blocks, and they are interconnected by arrows or lines that indicate the flow between them. Each node represents a specific entity or group, and the width of the arrows or lines is proportional to the quantity or value of what is flowing from one node to another.\n_createNodes() is used for creating Sankey nodes .This function creates an array of React nodes based on the SankeyChartData property of the data object passed in as a prop. For each node in the SankeyChartData.nodes array, the method calculates the height of the node based on the difference between the y1 and y0 properties of the node. If the height is less than a certain minimum height, an extra padding of 6 pixels is added between the node description and the node weight. The method then truncates the node name to fit within the available space, and creates a tooltip with the full node name.The method then creates a React node for the current node, which consists of a rectangle and two text elements. The rectangle is positioned based on the x0, y0, x1, and y1 properties of the node, and is filled with a color based on the fillNodeColors method. The rectangle also has event handlers for mouseover, mouseout, and focus events.The two text elements are positioned based on the height of the node and the length of the node weight text. The first text element contains the node name, and the second text element contains the node weight. Both text elements have event handlers for mouseover and mouseout events that show and hide the tooltip, respectively.'}),"\n",(0,i.jsx)(n.h3,{id:"2links",children:"2.Links"}),"\n",(0,i.jsx)(n.p,{children:'In a Sankey chart, "links" represent the connections or flows of resources, energy, or information between nodes. Links are typically depicted as lines or arrows that connect one node to another, indicating the quantity or value of what is flowing from the source node to the target node. Here are some key characteristics of links in Sankey charts:'}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\n",(0,i.jsx)(n.h4,{id:"flow-direction",children:"Flow Direction"}),"\n"]}),"\n"]}),"\n",(0,i.jsx)(n.p,{children:"Links have a direction, moving from a source node to a target node. The direction of the link illustrates how resources or information is flowing within the system."}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\n",(0,i.jsx)(n.h4,{id:"width",children:"Width"}),"\n"]}),"\n"]}),"\n",(0,i.jsx)(n.p,{children:"The width of the link is proportional to the quantity or value of the flow it represents. Wider links indicate larger flows, while narrower links represent smaller flows."}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\n",(0,i.jsx)(n.h4,{id:"color",children:"Color"}),"\n"]}),"\n"]}),"\n",(0,i.jsx)(n.p,{children:"Links can be colored to provide additional information or to differentiate between different types of flows or categories. For example, different colors might represent different materials, energy sources, or information types."}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\n",(0,i.jsx)(n.h4,{id:"interactivity",children:"Interactivity"}),"\n"]}),"\n"]}),"\n",(0,i.jsx)(n.p,{children:"In some Sankey charts, links can be interactive. For instance, hovering over a link may display additional information, such as the exact value of the flow or other related data."}),"\n",(0,i.jsxs)(n.p,{children:["Links are created using createLInks() function. The method takes no arguments. For each link, the method creates a linear gradient that goes from the color of the source node to the color of the target node. The method then calculates the data points for the link area using the ",(0,i.jsx)(n.code,{children:"data"})," function, which takes a single link object and returns an array of two points that define the shape of the link. the ",(0,i.jsx)(n.code,{children:"d3CurveBasis"})," curve type to create a smooth curve for the link area. The method then creates a React node for the link, which consists of a ",(0,i.jsx)(n.code,{children:"path"})," element that uses the link area to define its shape. The ",(0,i.jsx)(n.code,{children:"path"})," element is filled with the linear gradient created earlier, and has a stroke color and width that are determined by the",(0,i.jsx)(n.code,{children:"_fillStreamBorder"})," and ",(0,i.jsx)(n.code,{children:"_getOpacityStreamBorder"})," methods, respectively."]}),"\n",(0,i.jsx)(n.h2,{id:"mathematicalgeometrical-concepts",children:"Mathematical/Geometrical concepts"}),"\n",(0,i.jsxs)(n.p,{children:[(0,i.jsx)(n.a,{href:"https://github.com/d3/d3-sankey",children:"d3-sankey"})," is a JavaScript library that extends the capabilities of the popular data visualization library D3.js to create Sankey charts easily. The primary role of ",(0,i.jsx)(n.a,{href:"https://github.com/d3/d3-sankey",children:"d3-sankey"})," in creating Sankey charts is to simplify the process of generating these complex diagrams by providing a set of functions and methods tailored specifically for Sankey diagrams.\nThe _preRenderLayout method initializes a d3Sankey object that is used to calculate the layout of the Sankey diagram. The d3Sankey object is configured with various properties, such as the width of the nodes, the extent of the diagram, and the alignment of the nodes.The d3Sankey object is then used to calculate the layout of the Sankey diagram in the _createNodes and _createLinks methods. The d3Sankey object takes in the nodes and links arrays and calculates the positions of the nodes and the paths of the links based on the properties of the nodes and links.\n\u2022\tNodes will contain an array of node objects, each with properties like name, x0, x1, y0, and y1.\n\u2022\tLinks will contain an array of link objects, each with properties like source, target, and value."]}),"\n",(0,i.jsx)(n.h3,{id:"dynamic-node-padding-in-fluent-sankey-chart",children:"Dynamic node padding in Fluent Sankey chart"}),"\n",(0,i.jsxs)(n.p,{children:["We have also introduced dynamic padding concept for Sankey charts .This is used for cases where the number of nodes in a column is huge.so that we maintain a node to space ratio for such columns as if we fail to do so the chart is devoid of nodes and only shows links. See the code for dynamic at ",(0,i.jsx)(n.a,{href:"https://github.com/microsoft/fluentui/blob/f9ef593dd07abb0341e7be09f60cb841d577135d/packages/react-charting/src/components/SankeyChart/SankeyChart.base.tsx#L295",children:"githublink"}),". This is necessary because D3 Sankey reduces the node height when there are more nodes within a constrained chart height while maintaining the same node padding as specified."]}),"\n",(0,i.jsx)(n.h3,{id:"minimum-height-of-the-node-for-fluent-sankey-charts-will-be-1-of-the-total-column-height",children:"Minimum height of the node for Fluent Sankey charts will be 1% of the total column height."}),"\n",(0,i.jsx)(n.h2,{id:"performance",children:"Performance"}),"\n",(0,i.jsx)(n.p,{children:"The performance aspect of a chart refers to how efficiently and effectively it conveys information to the viewer. Here are some key considerations regarding the performance of a area chart:"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"Data Visualization Efficiency"}),"\n",(0,i.jsx)(n.li,{children:"Clarity and Simplicity"}),"\n",(0,i.jsx)(n.li,{children:"Responsiveness"}),"\n",(0,i.jsx)(n.li,{children:"Handling Large Datasets"}),"\n",(0,i.jsx)(n.li,{children:"Interactive Features"}),"\n"]}),"\n",(0,i.jsx)(n.p,{children:"We use Lighthouse tool for measuring the performance of our charts. Currently we are working on improving the performance . We are currently working on improving 3 of the performance lighthouse metrics FCP, TBT, TTI.\nThe current implementation of the Sankey chart is already performing well. However, as part of our future plans, we aim to assess the Lighthouse performance score, particularly when dealing with extensive datasets for the chart. We are committed to enhancing the performance further by identifying and capitalizing on any opportunities for improvement that may arise."}),"\n",(0,i.jsx)(n.h2,{id:"accessibility",children:"Accessibility"}),"\n",(0,i.jsxs)(n.p,{children:["Chart ",(0,i.jsx)(n.code,{children:""}),"The role is set as presentation, and the aria-label attribute is set as a string to describe its contents. This is readable by screen reader if user has given chartTitle prop\nHorizontal bar chart provides a bunch of props to enable custom accessibility messages. UsexAxisCalloutAccessibilityData and callOutAccessibilityData to configure x axis and y axis accessibility messages respectively."]}),"\n",(0,i.jsx)(n.h2,{id:"variants",children:"Variants"}),"\n",(0,i.jsxs)(n.p,{children:["Different variants of Sankey chart are available at below location:\n",(0,i.jsx)(n.a,{href:"https://developer.microsoft.com/en-us/fluentui#/controls/web/sankeychart",children:"Fluent UI React Charting Examples - Sankey Charts"}),"\nThe Variants in the above consisting of different functionalities:"]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"Nodes can have customized colors, or else the default colors will be assigned. The node border also follows the same approach."}),"\n",(0,i.jsxs)(n.li,{children:["The color of links depends on the action taken on the chart. In the default state, the link color is grey. However, when hovering over the link, it transitions into a gradient between the source and target nodes, creating a visually appealing effect.\n",(0,i.jsx)(n.img,{alt:"image.png",src:t(2323).Z+"",width:"1164",height:"444"})]}),"\n",(0,i.jsxs)(n.li,{children:["The details inside nodes, such as node name and weight, depend on the size of the node. If the node's height is less than 24px, no details will appear inside the node. This is because with such limited width, reading any details within the node becomes challenging. We will cover an alternative method for accessing this information in the interaction section of the contributor guide.\n",(0,i.jsx)(n.img,{alt:"image.png",src:t(1435).Z+"",width:"240",height:"48"})]}),"\n",(0,i.jsxs)(n.li,{children:["There are two ways to display the node name and weight. To have the node name and weight displayed on two separate lines, a minimum height of 36px is required.\n",(0,i.jsx)(n.img,{alt:"image.png",src:t(3593).Z+"",width:"898",height:"210"})]}),"\n"]}),"\n",(0,i.jsx)(n.h2,{id:"error-scenarios",children:"Error scenarios"}),"\n",(0,i.jsx)(n.h3,{id:"chart-is-not-rendered-properly-if-for-a-link-source-and-target-node-will-be-same",children:"Chart is not rendered properly if for a link source and target node will be same."}),"\n",(0,i.jsx)(n.h3,{id:"chart-is-not-rendered-properly-if-consistent-names--are-not-used-properly-while-configuring-links",children:"Chart is not rendered properly if consistent names are not used properly while configuring links."}),"\n",(0,i.jsx)(n.h3,{id:"the-chart-cannot-be-loaded-because-of-one-or-more-reasons",children:"The chart cannot be loaded because of one or more reasons:"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"Empty data passed such that chart does not have visual to show."}),"\n",(0,i.jsx)(n.li,{children:"One of the datapoint passed to the chart is corrupted. The corrupted datapoint can be for a continuous chart like line or area, or a discrete chart like bar chart, donut chart."}),"\n",(0,i.jsx)(n.li,{children:"The type of data passed to the chart is not supported."}),"\n",(0,i.jsx)(n.li,{children:"The user has not provided the required property."}),"\n"]}),"\n",(0,i.jsx)(n.h3,{id:"the-chart-is-in-a-loading-state-because-of-one-or-more-reasons-below",children:"The chart is in a loading state because of one or more reasons below."}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"The chart data is too heavy."}),"\n",(0,i.jsx)(n.li,{children:"Chart is waiting for data from a webservice."}),"\n"]}),"\n",(0,i.jsx)(n.h3,{id:"extremely-high-density",children:"Extremely high density:"}),"\n",(0,i.jsx)(n.p,{children:"The number of nodes in the chart are more considering the height and width of the canvas provided."}),"\n",(0,i.jsx)(n.h2,{id:"some-notable-prs-and-their-brief-description",children:"Some notable PRs and their brief description"}),"\n",(0,i.jsx)(n.p,{children:(0,i.jsx)(n.a,{href:"https://github.com/microsoft/fluentui/pull/25455",children:"PR"})}),"\n",(0,i.jsx)(n.h2,{id:"design-figma",children:"Design figma"}),"\n",(0,i.jsxs)(n.p,{children:["Sankey Chart Figma : ",(0,i.jsx)(n.a,{href:"https://www.figma.com/file/WOoCs0CmNYZhYl9xXeCGpi/Data-viz-(Archive)?type=design&node-id=21212-72120&mode=design&t=uSjYIeUd9e3vBPuc-0",children:"Data viz (Archive) \u2013 Figma"})]}),"\n",(0,i.jsx)(n.h2,{id:"rendering-details",children:"Rendering details"}),"\n",(0,i.jsx)(n.p,{children:"The Sankey chart in SankeyChart.base.tsx is rendered using D3.js, a popular JavaScript library for data visualization. The chart is created by rendering a series of SVG elements, including rectangles for the nodes and paths for the links between the nodes.\nThe chart is created in the _createSankey function, which initializes the D3 Sankey layout and sets the chart's dimensions and margins. The function then creates the nodes and links for the chart using the d3.sankey layout and the chart's data.\nThe nodes are rendered as rectangles using the rect SVG element, with the position and size of each rectangle determined by the x, y, width, and height properties of the node. The links between the nodes are rendered as paths using the path SVG element, with the position and shape of each path determined by the x0, y0, x1, y1, and width properties of the link.\nThe chart also includes event handlers for mouseover and mouseout events on the nodes and links, which highlight the corresponding elements and display tooltips with additional information."}),"\n",(0,i.jsx)(n.h2,{id:"interactions",children:"Interactions"}),"\n",(0,i.jsx)(n.p,{children:"There are various interactions that a user experiences in Line Chart which are"}),"\n",(0,i.jsx)(n.h4,{id:"hover-over-nodes",children:"Hover Over Nodes"}),"\n",(0,i.jsxs)(n.p,{children:["When the user hovers over nodes, the entire flow associated with that node will be highlighted, encompassing both the links and nodes within the entire flow. Furthermore, the entire flow will be colored to match the node upon which the user has hovered. To enhance visibility, all other nodes will be rendered in white with reduced opacity.Below is an example. Here user has hovered over node with value 62 .\n",(0,i.jsx)(n.img,{alt:"image.png",src:t(488).Z+"",width:"998",height:"472"})]}),"\n",(0,i.jsx)(n.p,{children:"Hovering on the node with height less than 24px will display a callout with details of node name and weight."}),"\n",(0,i.jsx)(n.h4,{id:"hover-over-links",children:"Hover Over links"}),"\n",(0,i.jsx)(n.p,{children:"When the user hovers over a link, the entire flow will be highlighted. All nodes will retain their original colors, while the links themselves will adopt a gradient color derived from the source and target nodes. Additionally, a callout will appear, displaying details about the link, such as the source node's name, weight, and the target node's name. To enhance the visual appeal, the link border will also transition into a gradient when the link is hovered over. Below is an example of a link being hovered over, in this case, between node 4 and node 12."}),"\n",(0,i.jsx)(n.p,{children:(0,i.jsx)(n.img,{alt:"image.png",src:t(4010).Z+"",width:"1032",height:"628"})})]})}function c(e={}){const{wrapper:n}={...(0,a.a)(),...e.components};return n?(0,i.jsx)(n,{...e,children:(0,i.jsx)(l,{...e})}):l(e)}},7994:(e,n,t)=>{t.d(n,{Z:()=>i});const i=t.p+"assets/images/SankeyChartPic1-21938ac4624ca9c0b2e7a81642895f54.png"},2323:(e,n,t)=>{t.d(n,{Z:()=>i});const i=t.p+"assets/images/SankeyChartPic2-f8b20217db956a3f15db72749f483f96.png"},3593:(e,n,t)=>{t.d(n,{Z:()=>i});const i=t.p+"assets/images/SankeyChartPic4-94529d27a2a3b60dc3a8eb5bbe3da5c6.png"},488:(e,n,t)=>{t.d(n,{Z:()=>i});const i=t.p+"assets/images/SankeyChartPic5-981250d62a5438d1f49a7189100e63c0.png"},4010:(e,n,t)=>{t.d(n,{Z:()=>i});const i=t.p+"assets/images/SankeyChartPic6-af110dd78bfea90678297931ac13a72f.png"},1435:(e,n,t)=>{t.d(n,{Z:()=>i});const i="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAPAAAAAwCAYAAAAvvfcmAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAAHYcAAB2HAY/l8WUAAABfaVRYdFNuaXBNZXRhZGF0YQAAAAAAeyJjbGlwUG9pbnRzIjpbeyJ4IjowLCJ5IjowfSx7IngiOjIzOSwieSI6MH0seyJ4IjoyMzksInkiOjQ3fSx7IngiOjAsInkiOjQ3fV19jVsYmgAAAjdJREFUeF7t3c1qE1EYh/F3JnZrKdoplmiySqyIrqRgaBFlaKgrpYuKbrqpS115Bd6D9+JGdOtGdNMvreIHkhYqtYFUOhPPmQyl2ya1zD8+P3jJIZPVwJMZknASdB0DICdwwnwNQBABA8IIGBBGwIAwAgaEETAgjIABYQQMCCNgQBgBA8Jkf0r541vLnj97YR/XvtrIyJn8WaCIAjddS5LUZuau2fStKfPZ+YnjuPeSPvifUsoHvLH6xcbOjtvEWNWdpt6JAgojCKzzp23ft9ezgO8uNOz+o/gw4HK5nL/w+IYi4PWVzzY5XrUrlZtWCkouXwJGcbjEbOd3y959emXJQerivWPLTxbzo4MZmoAvnK/Y5UvTBIzC8QH/2tuy95tvsoDvPbxtj58+yI8OxvfLh1iAMAIGhBEwIIyAAWEEDAgjYEAYAQPCCBgQRsCAMAIGhBEwIIyAAWEEDAgjYEAYAQPCCBgQRsCAMAIGhBEwIGwoAva7UYZhiWGKOUd2rvJ7ZJ2kodhW9tzohJWjuns34oYCBeN6bXd2bfPnh2xTu/mFhi0uzecHzaIoylfH5ze1Y2N34JT4faEb8VW7MVvP9oT2ms1m9tgP36/sJcufgDRNrZv6x96aYYo6SZJk49dh6O4V8xmU7BV4u7Vjr1++tb3dtgUncCKAfyVJDmy/s2+pS+1iNbL69crhH4jUarXeog/St9DA/076FhoA3wMD0ggYEEbAgDACBoQRMCCMgAEAOH1mfwGdx7oHd1aLQgAAAABJRU5ErkJggg=="},1151:(e,n,t)=>{t.d(n,{Z:()=>s,a:()=>o});var i=t(7294);const a={},r=i.createContext(a);function o(e){const n=i.useContext(r);return i.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function s(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(a):e.components||a:o(e.components),i.createElement(r.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/1ff5abae.b0c49283.js b/assets/js/1ff5abae.b0c49283.js new file mode 100644 index 0000000000..c8b33884cb --- /dev/null +++ b/assets/js/1ff5abae.b0c49283.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkdocsite=self.webpackChunkdocsite||[]).push([[5671],{2972:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>o,contentTitle:()=>r,default:()=>d,frontMatter:()=>s,metadata:()=>h,toc:()=>l});var a=n(5893),i=n(1151);const s={},r="Contributor guide: Grouped Vertical Bar Chart",h={id:"Charting-Concepts/GroupedVerticalBarChart",title:"Contributor guide: Grouped Vertical Bar Chart",description:"GroupedVerticalBarChart1.png",source:"@site/../../docs/Charting-Concepts/GroupedVerticalBarChart.md",sourceDirName:"Charting-Concepts",slug:"/Charting-Concepts/GroupedVerticalBarChart",permalink:"/fluentui-charting-contrib/docs/Charting-Concepts/GroupedVerticalBarChart",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{},sidebar:"tutorialSidebar",previous:{title:"Contributor guide: Gauge Chart",permalink:"/fluentui-charting-contrib/docs/Charting-Concepts/GaugeChart"},next:{title:"Contributor guide: Heatmap Chart",permalink:"/fluentui-charting-contrib/docs/Charting-Concepts/HeatMapChart"}},o={},l=[];function c(e){const t={a:"a",code:"code",em:"em",h1:"h1",img:"img",li:"li",ol:"ol",p:"p",pre:"pre",strong:"strong",ul:"ul",...(0,i.a)(),...e.components};return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(t.h1,{id:"contributor-guide-grouped-vertical-bar-chart",children:"Contributor guide: Grouped Vertical Bar Chart"}),"\n",(0,a.jsx)(t.p,{children:(0,a.jsx)(t.img,{alt:"GroupedVerticalBarChart1.png",src:n(1075).Z+"",width:"1011",height:"748"})}),"\n",(0,a.jsx)(t.p,{children:"A grouped vertical bar chart is a type of chart that displays multiple series of data as groups of bars, with each bar representing a category. The bars are grouped together side by side, with each group representing a different series."}),"\n",(0,a.jsx)(t.p,{children:"In a grouped vertical bar chart, the x-axis represents the categories, while the y-axis represents the values of the series. Each bar in a group is colored differently to differentiate between the series."}),"\n",(0,a.jsxs)(t.ul,{children:["\n",(0,a.jsxs)(t.li,{children:[(0,a.jsx)(t.strong,{children:"Use cases"}),"\nSome common use cases for a Grouped Vertical Bar Chart are as follows:","\n",(0,a.jsxs)(t.ul,{children:["\n",(0,a.jsx)(t.li,{children:"Comparing the values of multiple series across categories"}),"\n",(0,a.jsx)(t.li,{children:"Displaying financial data, such as revenue and expenses, for different products or services"}),"\n",(0,a.jsx)(t.li,{children:"Displaying scientific research data for different treatments or conditions"}),"\n",(0,a.jsx)(t.li,{children:"Comparing the performance of different teams or departments in a company"}),"\n",(0,a.jsx)(t.li,{children:"Showing the distribution of different types of crimes in a city"}),"\n",(0,a.jsx)(t.li,{children:"Displaying the results of a survey for different age groups or genders"}),"\n",(0,a.jsx)(t.li,{children:"Comparing the sales of different products in a store"}),"\n",(0,a.jsx)(t.li,{children:"Showing the number of students enrolled in different courses in a school"}),"\n",(0,a.jsx)(t.li,{children:"Displaying the number of employees in different departments of a company"}),"\n",(0,a.jsx)(t.li,{children:"Comparing the number of visitors to different tourist attractions in a city"}),"\n"]}),"\n"]}),"\n",(0,a.jsx)(t.li,{children:(0,a.jsx)(t.strong,{children:"Mathematical/Geometrical concepts"})}),"\n"]}),"\n",(0,a.jsx)(t.p,{children:(0,a.jsx)(t.img,{alt:"GroupedVerticalBarChart2.png",src:n(1030).Z+"",width:"1121",height:"636"})}),"\n",(0,a.jsx)(t.p,{children:"The major D3 functions that are involved in the creation of Vertical bar charts are:"}),"\n",(0,a.jsxs)(t.ul,{children:["\n",(0,a.jsxs)(t.li,{children:["\n",(0,a.jsxs)(t.p,{children:[(0,a.jsx)(t.strong,{children:"d3-scale:"}),"\nThe\xa0d3-scale\xa0module is a part of the d3 library, which is a collection of JavaScript functions that are used for data visualization. The\xa0d3-scale\xa0module provides several functions for creating and manipulating scales, which are used to map data values to visual properties, such as\xa0position, size, and color."]}),"\n",(0,a.jsx)(t.p,{children:"The\xa0d3-scale\xa0module includes several scale types, including linear, logarithmic, power, and time scales. These scales are used to map continuous data values to a continuous range of visual properties. The module also includes ordinal and band scales, which are used to map categorical data values to a discrete range of visual properties."}),"\n"]}),"\n"]}),"\n",(0,a.jsx)(t.p,{children:"The\xa0d3-scale\xa0module provides several functions for creating and manipulating scales, including\xa0scaleLinear, scaleLog, scalePow, scaleTime, scaleOrdinal, and scaleBand. These functions take one or more arguments that define the domain and range of the scale, as well as any additional properties, such as the number of ticks or the padding between bands."}),"\n",(0,a.jsxs)(t.p,{children:[(0,a.jsx)(t.strong,{children:"Application in Grouped Vertical bar chart:"}),"\nGrouped vertical bar chart uses the\xa0d3-scale\xa0module to create a linear scale for the y-axis of the chart. The linear scale maps a continuous domain of data values to a continuous range of visual properties, such as position or height."]}),"\n",(0,a.jsxs)(t.ul,{children:["\n",(0,a.jsxs)(t.li,{children:["\n",(0,a.jsxs)(t.p,{children:[(0,a.jsx)(t.strong,{children:"d3.scaleLinear()"}),": The\xa0d3.scaleLinear\xa0is a function from the\xa0d3-scale\xa0module that is used to create a linear scale for the y-axis of the chart. The linear scale maps a continuous domain of data values to a continuous range of visual properties, such as position or height. The\xa0d3ScaleLinear\xa0function takes no arguments and returns a new linear scale. The scale can be customized using several methods, including\xa0domain, range, clamp, and nice. The\xa0domain\xa0method sets the domain of the scale, which is the range of data values that the scale maps to the range of visual properties. The\xa0range\xa0method sets the range of the scale, which is the range of visual properties that the scale maps to the domain of data values."]}),"\n",(0,a.jsx)(t.p,{children:(0,a.jsx)(t.strong,{children:"Application in Grouped Vertical bar chart:"})}),"\n",(0,a.jsxs)(t.ul,{children:["\n",(0,a.jsx)(t.li,{children:"In the Grouped Vertical Bar chart component, the\xa0d3.scaleLinear\xa0function from the\xa0d3-scale\xa0module is used to create a new linear scale for the y-axis of the chart."}),"\n",(0,a.jsx)(t.li,{children:"The\xa0d3.scaleLinear\xa0function takes no arguments and returns a new linear scale. The scale maps a continuous input domain to a continuous output range. In this case, the input domain is the range of values for the y-axis data, while the output range is the range of pixel values for the y-axis on the chart."}),"\n",(0,a.jsx)(t.li,{children:"The\xa0d3.scaleLinear\xa0function is used in the\xa0GroupedVerticalBarChart\xa0component to generate the y-axis scale for the chart. The\xa0yAxisScale\xa0property of the component is set to a new instance of the\xa0d3.scaleLinear\xa0function. The\xa0domain\xa0property of the\xa0yAxisScale\xa0object is set to an array of the minimum and maximum values of the y-axis data. The\xa0range\xa0property of the\xa0yAxisScale\xa0object is set to an array of the minimum and maximum pixel values for the y-axis on the chart."}),"\n",(0,a.jsx)(t.li,{children:"The\xa0d3.scaleLinear\xa0function is used to generate a linear scale that maps the y-axis data to the pixel values on the chart. This allows the y-axis data to be displayed in a way that is visually meaningful and easy to interpret."}),"\n"]}),"\n"]}),"\n",(0,a.jsxs)(t.li,{children:["\n",(0,a.jsxs)(t.p,{children:[(0,a.jsx)(t.strong,{children:"d3.scaleBand():"}),"\xa0The\xa0d3.scaleBand\xa0is a function from the\xa0d3-scale\xa0module that is used to create a band scale for the x-axis of the chart. The band scale maps a discrete domain of data values to a discrete range of visual properties, such as\xa0position or width. The\xa0d3ScaleBand\xa0function takes no arguments and returns a new band scale. The scale can be customized using several methods, including\xa0domain, range, padding, and align. The\xa0domain\xa0method sets the domain of the scale, which is the range of data values that the scale maps to the range of visual properties. The\xa0range\xa0method sets the range of the scale, which is the range of visual properties that the scale maps to the domain of data values. The\xa0padding\xa0method sets the padding between the bands of the scale, which determines the width of the bands. The\xa0align\xa0method sets the alignment of the bands within the range of the scale."]}),"\n",(0,a.jsx)(t.p,{children:(0,a.jsx)(t.strong,{children:"Application in Grouped Vertical bar chart:"})}),"\n"]}),"\n"]}),"\n",(0,a.jsx)(t.pre,{children:(0,a.jsx)(t.code,{children:"- x0_inner_padding = space_between_groups /(space_between_groups + group_width)\n\n- space_between_groups = 2 * bar_width\n\n- group_width = this._keys.length * bar_width + (this._keys.length - 1) * space_between_bars\n"})}),"\n",(0,a.jsxs)(t.ul,{children:["\n",(0,a.jsx)(t.li,{children:"In the Grouped Vertical Bar chart component, the\xa0d3.scaleBand\xa0function from the\xa0d3-scale\xa0module is used to create a new band scale for the x-axis of the chart."}),"\n",(0,a.jsx)(t.li,{children:"The\xa0d3.scaleBand\xa0function takes no arguments and returns a new band scale. The scale maps a discrete input domain to a continuous output range. In this case, the input domain is an array of categories for the x-axis, while the output range is the range of pixel values for the x-axis on the chart."}),"\n",(0,a.jsx)(t.li,{children:"The\xa0d3.scaleBand\xa0function is used in the\xa0GroupedVerticalBarChart\xa0component to generate the x-axis scale for the chart. The\xa0xAxisScale\xa0property of the component is set to a new instance of the\xa0d3.scaleBand\xa0function. The\xa0domain\xa0property of the\xa0xAxisScale\xa0object is set to an array of the categories for the x-axis. The\xa0range\xa0property of the\xa0xAxisScale\xa0object is set to an array of the minimum and maximum pixel values for the x-axis on the chart."}),"\n",(0,a.jsx)(t.li,{children:"The\xa0d3.scaleBand\xa0function is used to generate a band scale that maps the categories for the x-axis to the pixel values on the chart. This allows the categories to be displayed in a way that is visually meaningful and easy to interpret. The\xa0paddingInner\xa0and\xa0paddingOuter\xa0properties of the\xa0xAxisScale\xa0object can be used to adjust the spacing between the bars and groups of bars on the chart."}),"\n"]}),"\n",(0,a.jsx)(t.p,{children:"Overall, the\xa0d3.scaleBand\xa0function is used to generate a band scale that maps the categories for the x-axis to the pixel values on the chart, allowing the categories to be displayed in a way that is visually meaningful and easy to interpret."}),"\n",(0,a.jsxs)(t.ul,{children:["\n",(0,a.jsxs)(t.li,{children:["\n",(0,a.jsxs)(t.p,{children:[(0,a.jsx)(t.strong,{children:"d3-selection:"}),"\xa0The\xa0d3-selection\xa0is a module from the d3 library that is used to select and manipulate DOM elements in the chart component. The\xa0d3-selection\xa0module provides several functions for selecting and manipulating DOM elements, including\xa0select, selectAll, append, attr, and style. The select function is used to select a single DOM element that matches a given selector. The\xa0selectAll\xa0function is used to select multiple DOM elements that match a given selector. The\xa0append\xa0function is used to append a new DOM element to a selected element. The\xa0attr\xa0function is used to set or get an attribute of a selected element. The\xa0style\xa0function is used to set or get a style property of a selected element."]}),"\n",(0,a.jsx)(t.p,{children:(0,a.jsx)(t.strong,{children:"Application in Grouped Vertical bar chart:"})}),"\n",(0,a.jsxs)(t.ul,{children:["\n",(0,a.jsx)(t.li,{children:"In the Grouped Vertical Bar chart component, the\xa0d3Select\xa0function from the\xa0d3-selection\xa0module is used to select an element from the DOM."}),"\n",(0,a.jsx)(t.li,{children:"The\xa0d3Select\xa0function takes one argument, which is a SVG node element for the element to be selected. The function returns a new selection object that represents the selected element."}),"\n"]}),"\n"]}),"\n"]}),"\n",(0,a.jsx)(t.p,{children:"Overall, the\xa0d3Select\xa0function from the\xa0d3-selection\xa0module is used to select an element from the DOM, which allows the\xa0GroupedVerticalBarChart\xa0component to interact with and modify the chart elements."}),"\n",(0,a.jsxs)(t.ul,{children:["\n",(0,a.jsxs)(t.li,{children:["\n",(0,a.jsxs)(t.p,{children:[(0,a.jsx)(t.strong,{children:"d3-array:"}),"\xa0The\xa0d3-array\xa0is a module from the d3 library that is used to manipulate arrays of data in the chart component. The\xa0d3-array\xa0module provides several functions for manipulating arrays of data, including\xa0max, min, extent, sum, and mean. The\xa0max\xa0function is used to find the maximum value in an array of data. The\xa0min\xa0function is used to find the minimum value in an array of data. The\xa0extent\xa0function is used to find the minimum and maximum values in an array of data. The\xa0sum\xa0function is used to find the sum of the values in an array of data. The\xa0mean\xa0function is used to find the mean (average) of the values in an array of data."]}),"\n",(0,a.jsx)(t.p,{children:(0,a.jsx)(t.strong,{children:"Application in Grouped Vertical bar chart:"})}),"\n",(0,a.jsxs)(t.ul,{children:["\n",(0,a.jsx)(t.li,{children:"In the Grouped Vertical Bar chart component, the\xa0d3Max\xa0function from the\xa0d3-array\xa0module is used to find the maximum value in an array of numbers."}),"\n",(0,a.jsx)(t.li,{children:"The\xa0d3Max\xa0function takes two arguments: the first argument is the array of numbers to be searched, and the second argument is an optional function that specifies how to extract the numeric value from each element in the array. If the second argument is not provided, the\xa0d3Max\xa0function assumes that the array contains only numeric values."}),"\n"]}),"\n"]}),"\n"]}),"\n",(0,a.jsx)(t.p,{children:"Overall, the\xa0d3Max\xa0function from the\xa0d3-array\xa0module is used to find the maximum value in an array of numbers, which allows the\xa0GroupedVerticalBarChart\xa0component to set the y-axis scale domain based on the maximum value of the y-axis data."}),"\n",(0,a.jsxs)(t.ul,{children:["\n",(0,a.jsxs)(t.li,{children:["\n",(0,a.jsxs)(t.p,{children:[(0,a.jsx)(t.strong,{children:"d3-format:"}),"\xa0The\xa0d3-format\xa0is a module from the d3 library that is used to format numbers and strings in the chart component. The\xa0d3-format\xa0module provides several functions for formatting numbers and strings, including\xa0format, formatPrefix, precisionFixed, and precisionRound."]}),"\n",(0,a.jsx)(t.p,{children:"The\xa0format\xa0function is used to format a number or string using a specified format string. The format string can include placeholders for the value, such as\xa0%\xa0for a percentage or\xa0,\xa0for a comma-separated number. The\xa0formatPrefix\xa0function is used to format a number using a prefix notation that rounds the value to a specified precision and appends a prefix, such as\xa0K\xa0for thousands or\xa0M\xa0for millions. The\xa0precisionFixed\xa0function is used to format a number using a fixed number of decimal places. The\xa0precisionRound\xa0function is used to format a number using a variable number of decimal places that is determined by the magnitude of the value."}),"\n"]}),"\n"]}),"\n",(0,a.jsx)(t.p,{children:(0,a.jsx)(t.strong,{children:"Application in Grouped Vertical bar chart:"})}),"\n",(0,a.jsxs)(t.ul,{children:["\n",(0,a.jsx)(t.li,{children:"In the Grouped Vertical Bar chart component, the\xa0d3FormatPrefix\xa0function from the\xa0d3-format\xa0module is used to format numbers with SI-prefixes."}),"\n",(0,a.jsx)(t.li,{children:'The\xa0d3FormatPrefix\xa0function takes one argument, which is a numeric value. The function returns a string that represents the value with an SI-prefix, such as "K" for thousands or "M" for millions.'}),"\n",(0,a.jsx)(t.li,{children:"The\xa0d3FormatPrefix\xa0function is used in the\xa0GroupedVerticalBarChart\xa0component to format the bar labels for groups."}),"\n"]}),"\n",(0,a.jsx)(t.p,{children:"Overall, the\xa0d3FormatPrefix\xa0function from the\xa0d3-format\xa0module is used to format numbers, which allows the component to display the bar labels in a way that is visually meaningful and easy to interpret."}),"\n",(0,a.jsxs)(t.ul,{children:["\n",(0,a.jsxs)(t.li,{children:["\n",(0,a.jsxs)(t.p,{children:[(0,a.jsx)(t.strong,{children:"d3-axis:"}),"\xa0The\xa0d3-axis\xa0module is a part of the d3 library, which is a collection of JavaScript functions that are used for data visualization. The\xa0d3-axis\xa0module provides several functions for creating and manipulating axes, which are used to display the scales of a chart component."]}),"\n",(0,a.jsx)(t.p,{children:"In data visualization, axes are used to display the scales of a chart component, such as the x-axis and y-axis of a bar chart. Axes provide visual cues to help readers interpret the data values of a chart component, such as the range and domain of the data values."}),"\n"]}),"\n"]}),"\n",(0,a.jsx)(t.p,{children:"The\xa0d3-axis\xa0module provides several types of axes, including\xa0bottom, top, left, and right axes. Each type of axis has its own set of methods for customizing the axis and displaying the tick values."}),"\n",(0,a.jsx)(t.p,{children:"Overall, the\xa0d3-axis\xa0module is an essential part of data visualization, as it provides a powerful and flexible way to display the scales of a chart component and help readers interpret the data values of the chart."}),"\n",(0,a.jsxs)(t.p,{children:[(0,a.jsx)(t.strong,{children:"Application in Grouped Vertical bar chart:"}),"\nIn the Vertical stacked bar chart,\xa0d3-axis\xa0is used to create and render the x and y axes of the chart."]}),"\n",(0,a.jsxs)(t.ul,{children:["\n",(0,a.jsx)(t.li,{children:"The\xa0d3-axis\xa0library provides various methods for creating and rendering axes, such as\xa0axisBottom(),\xa0axisLeft(), and\xa0tickFormat(). In this case, the\xa0d3-axis\xa0library is used to create and render the x and y axes of the chart."}),"\n",(0,a.jsx)(t.li,{children:"To create the x and y axes, the\xa0d3-axis\xa0library's\xa0axisBottom()\xa0and\xa0axisLeft()\xa0methods are used, respectively. These methods take a scale function as an argument and return a new axis function that can be used to render the axis."}),"\n",(0,a.jsx)(t.li,{children:"The resulting x and y axis functions are then used to render the x and y axes of the chart. The\xa0call()\xa0method of the selection object is used to call the axis function and render the axis."}),"\n",(0,a.jsx)(t.li,{children:"The\xa0tickFormat()\xa0method of the y-axis scale is also used to set the tick format function for the y-axis. This method takes the format function created using the\xa0d3-format\xa0library as an argument and sets it as the tick format function for the y-axis."}),"\n"]}),"\n",(0,a.jsx)(t.p,{children:"Overall, the\xa0d3-axis\xa0library is used to create and render the x and y axes of the chart by using the\xa0axisBottom()\xa0and\xa0axisLeft()\xa0methods to create the axis functions and the\xa0call()\xa0method to render the axes. The\xa0tickFormat()\xa0method is also used to set the tick format function for the y-axis."}),"\n",(0,a.jsxs)(t.ul,{children:["\n",(0,a.jsxs)(t.li,{children:[(0,a.jsx)(t.strong,{children:"Dev Deisgn Details:"}),"\nFollowing are the major components that contribute towards creating a complete grouped vertical bar chart:","\n",(0,a.jsxs)(t.ul,{children:["\n",(0,a.jsxs)(t.li,{children:[(0,a.jsx)(t.strong,{children:"Axes:"}),"\n",(0,a.jsxs)(t.ul,{children:["\n",(0,a.jsxs)(t.li,{children:["\n",(0,a.jsxs)(t.p,{children:[(0,a.jsx)(t.strong,{children:"_createX0Scale():"}),"\xa0This method is responsible for generating the x and y scales that are used to map the data points to the chart dimensions. The scales are generated using the\xa0d3-scale\xa0library, which provides several scale types for different types of data."]}),"\n",(0,a.jsx)(t.p,{children:(0,a.jsx)(t.strong,{children:"Function arguments:"})}),"\n",(0,a.jsxs)(t.ul,{children:["\n",(0,a.jsx)(t.li,{children:"containerWidth: It is a number representing the width of the container element for the chart. This argument is used to calculate the range of the x-axis scale."}),"\n"]}),"\n"]}),"\n"]}),"\n"]}),"\n"]}),"\n"]}),"\n"]}),"\n",(0,a.jsx)(t.p,{children:(0,a.jsx)(t.strong,{children:"Working algorithm:"})}),"\n",(0,a.jsxs)(t.ul,{children:["\n",(0,a.jsxs)(t.li,{children:["\n",(0,a.jsx)(t.p,{children:"The\xa0_createX0Scale\xa0method first creates a new\xa0d3ScaleBand\xa0object called\xa0x0Axis. The\xa0domain\xa0property of the\xa0x0Axis\xa0object is set to the\xa0_xAxisLabels\xa0array, which contains the labels for the main x-axis of the chart. The\xa0range\xa0property of the\xa0x0Axis\xa0object is set to an array that defines the range of the main x-axis scale. The range is calculated based on the\xa0containerWidth, the\xa0margins\xa0of the chart, and the\xa0_domainMargin\xa0property, which is the margin between the edge of the chart and the first and last bars."}),"\n"]}),"\n",(0,a.jsxs)(t.li,{children:["\n",(0,a.jsx)(t.p,{children:"The\xa0paddingInner\xa0property of the\xa0x0Axis\xa0object is set to a value that defines the inner padding between groups of bars in the chart. The value is calculated based on the number of keys in the chart, which is the number of series in each data point, and the\xa0BAR_GAP_RATE\xa0property, which is the ratio of the space between bars to the width of a bar."}),"\n"]}),"\n",(0,a.jsxs)(t.li,{children:["\n",(0,a.jsx)(t.p,{children:"Finally, the\xa0_createX0Scale\xa0method returns the\xa0x0Axis\xa0object."}),"\n"]}),"\n",(0,a.jsxs)(t.li,{children:["\n",(0,a.jsxs)(t.p,{children:[(0,a.jsx)(t.strong,{children:"_createX1Scale():"}),"\xa0This method generates the grouped x-axis scale for the chart. The method creates a new\xa0d3ScaleBand\xa0object and sets its\xa0domain, range, and paddingInner\xa0properties based on the\xa0_keys\xa0array, the\xa0bandwidth\xa0of the main x-axis scale, the\xa0_isRtl\xa0property, and the\xa0X1_INNER_PADDING\xa0and\xa0BAR_GAP_RATE\xa0properties. The method returns the\xa0d3ScaleBand\xa0object."]}),"\n",(0,a.jsx)(t.p,{children:(0,a.jsx)(t.strong,{children:"Function arguments:"})}),"\n",(0,a.jsxs)(t.ul,{children:["\n",(0,a.jsx)(t.li,{children:"xScale0: This argument is a scale function that is used to calculate the width of each bar in the chart. The function returns a new scale function that is used to calculate the position of each bar within a group."}),"\n"]}),"\n"]}),"\n"]}),"\n",(0,a.jsx)(t.p,{children:(0,a.jsx)(t.strong,{children:"Working algorithm:"})}),"\n",(0,a.jsxs)(t.ul,{children:["\n",(0,a.jsxs)(t.li,{children:["\n",(0,a.jsx)(t.p,{children:"The\xa0_createX1Scale\xa0method first creates a new\xa0d3ScaleBand\xa0object say\xa0x1Axis. The\xa0domain\xa0property of the\xa0x1Axis\xa0object is set to the\xa0_keys\xa0array, which contains the keys for each series in the chart. The\xa0range\xa0property of the\xa0x1Axis\xa0object is set to an array that defines the range of the grouped x-axis scale. The range is calculated based on the\xa0bandwidth\xa0of the main x-axis scale, the\xa0_isRtl\xa0property, which is a\xa0boolean\xa0that indicates whether the chart is in right-to-left mode."}),"\n"]}),"\n",(0,a.jsxs)(t.li,{children:["\n",(0,a.jsx)(t.p,{children:"The\xa0paddingInner\xa0property of the\xa0x1Axis\xa0object is set to a value that defines the inner padding between groups of bars in the chart. The value is calculated based on the\xa0X1_INNER_PADDING\xa0property whose value is 0.1."}),"\n"]}),"\n",(0,a.jsxs)(t.li,{children:["\n",(0,a.jsx)(t.p,{children:"Finally, the\xa0_createX1Scale\xa0method returns the\xa0x1Axis\xa0object."}),"\n"]}),"\n",(0,a.jsxs)(t.li,{children:["\n",(0,a.jsxs)(t.p,{children:[(0,a.jsx)(t.strong,{children:"_getDomainMargins():"}),"\xa0This method calculates the margins of the chart based on the available width of the chart container and the required width to render the bars in the chart. The method calculates the\xa0barWidth\xa0and\xa0groupWidth\xa0variables based on the\xa0barwidth\xa0prop, the number of keys in the chart, and the\xa0BAR_GAP_RATE\xa0property. If the available width is greater than or equal to the required width, the method centers the chart by setting equal left and right margins for the domain. If the available width is less than the required width, the method calculates the maximum possible group width to maintain a\xa02:1\xa0spacing between bars and groups of bars and recalculates the\xa0barWidth\xa0variable. The method returns an object that represents the margins of the chart."]}),"\n",(0,a.jsx)(t.p,{children:(0,a.jsx)(t.strong,{children:"Function arguments:"})}),"\n",(0,a.jsxs)(t.ul,{children:["\n",(0,a.jsx)(t.li,{children:"containerWidth: It is a number representing the width of the container in which the chart is being rendered."}),"\n"]}),"\n"]}),"\n"]}),"\n",(0,a.jsx)(t.p,{children:(0,a.jsx)(t.strong,{children:"Formulae:"})}),"\n",(0,a.jsx)(t.pre,{children:(0,a.jsx)(t.code,{children:"x1_inner_padding = space_between_bars / (space_between_bars + bar_width)\n\n=> space_between_bars = (x1_inner_padding / (1 - x1_inner_padding)) \\* bar_width\n\nBAR_GAP_RATE = Rate at which the space between the bars in a group changes wrt the bar width\n\nBAR_GAP_RATE = X1_INNER_PADDING / (1 - X1_INNER_PADDING)\n\nX1_INNER_PADDING = 0.1\n\nMaximum possible group width to maintain 2:1 spacing:\n\nInitialBarWidth = Math.min(props.barwidth || 16, 24);\n\n(i) InitialGroupWidth = _keys.length * InitialBarWidth+ (_keys.length - 1) * BAR_GAP_RATE * InitialBarWidth\n\nTotal width required to render the bars. Directly proportional to bar width:\n\n(ii) ReqWidth = _xAxisLabels.length * InitialGroupWidth + (_xAxisLabels.length - 1) * 2 * InitialBarWidth\n\nFrom (i) and (ii)\n\nMaximum possible group width to maintain 2:1 spacing\n\nMaxBandwidth = totalWidth / (_xAxisLabels.length +\n\n(_xAxisLabels.length - 1) \\* (2 / (_keys.length + (_keys.length - 1) * BAR_GAP_RATE)))\n\nFinalGroupWidth = MaxBandwidth;\n\nFrom (i)\n\nFinalBarWidth = FinalGroupWidth / (_keys.length + (_keys.length - 1) * BAR_GAP_RATE)\n"})}),"\n",(0,a.jsx)(t.p,{children:(0,a.jsx)(t.strong,{children:"Working algorithm:"})}),"\n",(0,a.jsxs)(t.ul,{children:["\n",(0,a.jsxs)(t.li,{children:["\n",(0,a.jsx)(t.p,{children:"The\xa0_getDomainMargins\xa0method first calculates the total width available to render the bars in the chart. The total width is calculated based on the\xa0containerWidth, the\xa0margins\xa0of the chart, and the\xa0MIN_DOMAIN_MARGIN\xa0property, which is the minimum margin between the edge of the chart and the first and last bars. The method then sets the\xa0barWidth\xa0variable to the minimum of the\xa0barwidth\xa0prop or 16, and the\xa0groupWidth\xa0variable to the product of the number of keys in the chart, the\xa0barWidth, and the\xa0BAR_GAP_RATE\xa0property, which is the ratio of the space between bars to the width of a bar, plus the space between groups of bars."}),"\n"]}),"\n",(0,a.jsxs)(t.li,{children:["\n",(0,a.jsx)(t.p,{children:"The method then calculates the total width required to render the bars in the chart. The total width is calculated based on the length of the\xa0_xAxisLabels\xa0array, the\xa0groupWidth, the\xa0barWidth, and the space between groups of bars. If the total width available to render the bars is greater than or equal to the total width required to render the bars, the method sets the\xa0_domainMargin\xa0property to half of the difference between the total width available and the total width required. This centers the chart by setting equal left and right margins for the domain."}),"\n"]}),"\n",(0,a.jsxs)(t.li,{children:["\n",(0,a.jsx)(t.p,{children:"If the total width available to render the bars is less than the total width required to render the bars, the method calculates the maximum possible group width to maintain a 2:1 spacing between bars and groups of bars. The method then sets the\xa0groupWidth\xa0variable to the maximum possible group width and recalculates the\xa0barWidth\xa0variable based on the\xa0groupWidth\xa0and the\xa0BAR_GAP_RATE\xa0property. The\xa0_domainMargin\xa0property is set to the\xa0MIN_DOMAIN_MARGIN."}),"\n"]}),"\n",(0,a.jsxs)(t.li,{children:["\n",(0,a.jsx)(t.p,{children:"Finally, the\xa0_getDomainMargins\xa0method returns an object that represents the margins of the chart. The left and right margins of the chart are updated to include the\xa0_domainMargin."}),"\n"]}),"\n",(0,a.jsxs)(t.li,{children:["\n",(0,a.jsxs)(t.p,{children:[(0,a.jsx)(t.strong,{children:"createNumericXAxis():"}),"\xa0The code above is a function called\xa0createNumericXAxis\xa0in the\xa0utilities.ts\xa0file. This function is responsible for creating a numeric x-axis for a chart component. The function takes two arguments:\xa0xAxisParams\xa0and\xa0chartType.\xa0xAxisParams\xa0is an object that contains several properties, including\xa0domainNRangeValues,\xa0showRoundOffXTickValues,\xa0xAxistickSize,\xa0tickPadding,\xa0xAxisCount, and\xa0xAxisElement.\xa0chartType\xa0is an enumeration that specifies the type of chart component."]}),"\n",(0,a.jsx)(t.p,{children:(0,a.jsx)(t.strong,{children:"Function arguments:"})}),"\n",(0,a.jsxs)(t.ul,{children:["\n",(0,a.jsxs)(t.li,{children:["xAxisParams\xa0of type\xa0IXAxisParams\xa0which is an object containing the following properties:","\n",(0,a.jsxs)(t.ul,{children:["\n",(0,a.jsx)(t.li,{children:"domainNRangeValues\xa0of type\xa0IDomainNRange\xa0which is an object containing the domain and range values for the x-axis."}),"\n",(0,a.jsx)(t.li,{children:"showRoundOffXTickValues\xa0of type\xa0boolean\xa0which is an optional property that determines whether to round off the x-axis tick values."}),"\n",(0,a.jsx)(t.li,{children:"xAxistickSize\xa0of type\xa0number\xa0which is an optional property that determines the size of the x-axis ticks."}),"\n",(0,a.jsx)(t.li,{children:"tickPadding\xa0of type\xa0number\xa0which is an optional property that determines the padding between the x-axis ticks and the x-axis labels."}),"\n",(0,a.jsx)(t.li,{children:"xAxisCount\xa0of type\xa0number\xa0which is an optional property that determines the number of x-axis ticks."}),"\n",(0,a.jsx)(t.li,{children:"xAxisElement\xa0of type\xa0SVGElement | null\xa0which is an optional property that represents the x-axis element."}),"\n"]}),"\n"]}),"\n",(0,a.jsx)(t.li,{children:"chartType\xa0of type\xa0ChartTypes\xa0which is an enum that represents the type of chart."}),"\n",(0,a.jsx)(t.li,{children:"culture\xa0of type string which is an optional paramter represents the locale into which the numeric x-axis labels will be localized."}),"\n"]}),"\n"]}),"\n"]}),"\n",(0,a.jsx)(t.p,{children:(0,a.jsx)(t.strong,{children:"Working algorithm:"})}),"\n",(0,a.jsxs)(t.ul,{children:["\n",(0,a.jsx)(t.li,{children:"The function first extracts the properties of the\xa0xAxisParams\xa0object using destructuring. The\xa0domainNRangeValues\xa0property is an object that contains the start and end values of the domain and range of the x-axis. The\xa0showRoundOffXTickValues\xa0property is a boolean that specifies whether to round off the tick values of the x-axis. The\xa0xAxistickSize\xa0property is a number that specifies the size of the ticks of the x-axis. The\xa0tickPadding\xa0property is a number that specifies the padding between the ticks and the labels of the x-axis. The\xa0xAxisCount\xa0property is a number that specifies the number of ticks of the x-axis. The\xa0xAxisElement\xa0property is a reference to the DOM node that contains the x-axis of the chart."}),"\n",(0,a.jsx)(t.li,{children:"The function then creates a linear scale for the x-axis using the\xa0d3ScaleLinear\xa0function from the\xa0d3-scale\xa0module. The scale is customized using the\xa0domain\xa0and\xa0range\xa0methods, which set the domain and range of the scale, respectively. If the\xa0showRoundOffXTickValues\xa0property is\xa0true, the\xa0nice\xa0method is called on the scale to round off the tick values of the x-axis."}),"\n",(0,a.jsx)(t.li,{children:"The function then creates a bottom axis for the x-axis using the\xa0d3AxisBottom\xa0function from the\xa0d3-axis\xa0module. The axis is customized using the\xa0tickSize,\xa0tickPadding,\xa0ticks, and\xa0tickFormat\xa0methods. The\xa0tickSize\xa0method sets the size of the ticks of the x-axis. The\xa0tickPadding\xa0method sets the padding between the ticks and the labels of the x-axis. The\xa0ticks\xa0method sets the number of ticks of the x-axis. The\xa0tickFormat\xa0method formats the tick values of the x-axis using the\xa0convertToLocaleString\xa0function and the\xa0culture\xa0parameter."}),"\n",(0,a.jsx)(t.li,{children:"If the\xa0xAxisElement\xa0property is not\xa0null, the axis is rendered on the DOM node using the\xa0call\xa0method of the\xa0d3-selection\xa0module. The\xa0selectAll\xa0method is called on the axis to select all the text elements of the x-axis, and the\xa0attr\xa0method is called to set the\xa0aria-hidden\xa0attribute of the text elements to\xa0true."}),"\n",(0,a.jsx)(t.li,{children:"Finally, the function computes the tick values of the x-axis using the\xa0ticks\xa0and\xa0tickFormat\xa0methods of the scale, and returns an object that contains the x-axis scale and the tick values."}),"\n"]}),"\n",(0,a.jsx)(t.p,{children:"Overall, the\xa0createNumericXAxis\xa0function is responsible for creating a numeric x-axis for a chart component. The function creates a linear scale for the x-axis and a bottom axis for the x-axis using the\xa0d3-scale\xa0and\xa0d3-axis\xa0modules, respectively. The function customizes the scale and axis using several methods, including\xa0domain,\xa0range,\xa0tickSize,\xa0tickPadding,\xa0ticks, and\xa0tickFormat. The function also renders the axis on the DOM node and computes the tick values of the x-axis."}),"\n",(0,a.jsxs)(t.ul,{children:["\n",(0,a.jsxs)(t.li,{children:[(0,a.jsx)(t.strong,{children:"createStringXAxis():"}),"\xa0This function is responsible for creating a string x-axis for a chart component. The function takes four arguments:\xa0xAxisParams,\xa0tickParams,\xa0dataset, and\xa0culture.\xa0xAxisParams\xa0is an object that contains several properties, including\xa0domainNRangeValues,\xa0xAxisCount,\xa0xAxistickSize,\xa0tickPadding,\xa0xAxisPadding,\xa0xAxisInnerPadding, and\xa0xAxisOuterPadding.\xa0tickParams\xa0is an object that contains several properties, including\xa0tickValues\xa0and\xa0tickFormat.\xa0dataset\xa0is an array of strings that contains the values of the x-axis.\xa0culture\xa0is a string that specifies the locale into which the x-axis labels can be localized."]}),"\n"]}),"\n",(0,a.jsx)(t.p,{children:(0,a.jsx)(t.strong,{children:"Function Arguments:"})}),"\n",(0,a.jsxs)(t.ul,{children:["\n",(0,a.jsx)(t.li,{children:"xAxisParams: An object containing the parameters for the x-axis, including the domain and range values, tick size, tick padding, number of ticks, padding for the inner and outer edges of the axis, and the element to render the axis."}),"\n",(0,a.jsx)(t.li,{children:"tickParams: An object containing the parameters for the ticks on the x-axis, including the tick values and tick format."}),"\n",(0,a.jsx)(t.li,{children:"dataset: An array of strings representing the data points for the x-axis."}),"\n",(0,a.jsx)(t.li,{children:"culture: An optional string representing the culture to use for formatting the tick labels on the x-axis. However, the localization works only if the string can be converted to a numeric value. Otherwise, the x-axis labels remain unlocalized."}),"\n"]}),"\n",(0,a.jsx)(t.p,{children:(0,a.jsx)(t.strong,{children:"Working algorithm:"})}),"\n",(0,a.jsxs)(t.ul,{children:["\n",(0,a.jsx)(t.li,{children:"The function first extracts the properties of the\xa0xAxisParams\xa0object using destructuring. The\xa0domainNRangeValues\xa0property is an object that contains the start and end values of the domain and range of the x-axis. The\xa0xAxisCount\xa0property is a number that specifies the number of ticks of the x-axis. The\xa0xAxistickSize\xa0property is a number that specifies the size of the ticks of the x-axis. The\xa0tickPadding\xa0property is a number that specifies the padding between the ticks and the labels of the x-axis. The\xa0xAxisPadding\xa0property is a number that specifies the padding between the bars of the chart. The\xa0xAxisInnerPadding\xa0property is a number that specifies the inner padding between the bars of the chart. The\xa0xAxisOuterPadding\xa0property is a number that specifies the outer padding between the bars of the chart."}),"\n",(0,a.jsx)(t.li,{children:"The function then creates a band scale for the x-axis using the\xa0d3ScaleBand\xa0function from the\xa0d3-scale\xa0module. The scale is customized using the\xa0domain\xa0and\xa0range\xa0methods, which set the domain and range of the scale, respectively. The\xa0paddingInner\xa0and\xa0paddingOuter\xa0methods are used to set the inner and outer padding between the bars of the chart, respectively."}),"\n",(0,a.jsx)(t.li,{children:"The function then creates a bottom axis for the x-axis using the\xa0d3AxisBottom\xa0function from the\xa0d3-axis\xa0module. The axis is customized using the\xa0tickSize,\xa0tickPadding,\xa0ticks, and\xa0tickFormat\xa0methods. The\xa0tickSize\xa0method sets the size of the ticks of the x-axis. The\xa0tickPadding\xa0method sets the padding between the ticks and the labels of the x-axis. The\xa0ticks\xa0method sets the number of ticks of the x-axis. The\xa0tickFormat\xa0method formats the tick values of the x-axis using the\xa0convertToLocaleString\xa0function and the\xa0culture\xa0parameter."}),"\n",(0,a.jsx)(t.li,{children:"If the\xa0xAxisParams.xAxisElement\xa0property is not\xa0null, the axis is rendered on the DOM node using the\xa0call\xa0method of the\xa0d3-selection\xa0module. The\xa0selectAll\xa0method is called on the axis to select all the text elements of the x-axis, and the\xa0attr\xa0method is called to set the\xa0aria-hidden\xa0attribute of the text elements to\xa0true."}),"\n",(0,a.jsx)(t.li,{children:"Finally, the function computes the tick values of the x-axis using the\xa0tickFormat\xa0method of the axis, and returns an object that contains the x-axis scale and the tick values."}),"\n"]}),"\n",(0,a.jsx)(t.p,{children:"Overall, the\xa0createStringXAxis\xa0function is responsible for creating a string x-axis for a chart component. The function creates a band scale for the x-axis and a bottom axis for the x-axis using the\xa0d3-scale\xa0and\xa0d3-axis\xa0modules, respectively. The function customizes the scale and axis using several methods, including\xa0domain,\xa0range,\xa0paddingInner,\xa0paddingOuter,\xa0tickSize,\xa0tickPadding,\xa0ticks, and\xa0tickFormat. The function also renders the axis on the DOM node and computes the tick values of the x-axis."}),"\n",(0,a.jsxs)(t.ul,{children:["\n",(0,a.jsxs)(t.li,{children:["\n",(0,a.jsxs)(t.p,{children:[(0,a.jsx)(t.strong,{children:"createYAxis():"}),"\xa0In the Vertical bar chart component, the\xa0d3-axis\xa0module is used to create and customize the y-axis of a vertical bar chart. The\xa0createYAxis\xa0function is responsible for creating the y-axis using the\xa0createYAxisForOtherCharts\xa0function. The function takes in several parameters, including\xa0yAxisParams,\xa0isRtl,\xa0axisData, and\xa0useSecondaryYScale. These parameters are used to customize the y-axis, such as setting the tick values, tick format, and tick padding."]}),"\n",(0,a.jsx)(t.p,{children:(0,a.jsx)(t.strong,{children:"Function arguments:"})}),"\n",(0,a.jsxs)(t.ul,{children:["\n",(0,a.jsxs)(t.li,{children:["yAxisParams: An object that contains various parameters related to the y-axis of the chart. It has the following properties:","\n",(0,a.jsxs)(t.ul,{children:["\n",(0,a.jsx)(t.li,{children:"yMinMaxValues: An object that contains the start and end values of the y-axis."}),"\n",(0,a.jsx)(t.li,{children:"yAxisElement: The DOM element that represents the y-axis."}),"\n",(0,a.jsx)(t.li,{children:"yMaxValue: The maximum value of the y-axis."}),"\n",(0,a.jsx)(t.li,{children:"yMinValue: The minimum value of the y-axis."}),"\n",(0,a.jsx)(t.li,{children:"containerHeight: The height of the container that holds the chart."}),"\n",(0,a.jsx)(t.li,{children:"containerWidth: The width of the container that holds the chart."}),"\n",(0,a.jsx)(t.li,{children:"margins: An object that contains the margins of the chart."}),"\n",(0,a.jsx)(t.li,{children:"tickPadding: The padding between the ticks and the axis line."}),"\n",(0,a.jsx)(t.li,{children:"maxOfYVal: The maximum value of the y-axis for area chart and Grouped vertical bar chart."}),"\n",(0,a.jsx)(t.li,{children:"yAxisTickFormat: The format of the y-axis tick labels."}),"\n",(0,a.jsx)(t.li,{children:"yAxisTickCount: The number of ticks on the y-axis."}),"\n",(0,a.jsx)(t.li,{children:"eventAnnotationProps: An object that contains the properties of the event annotation."}),"\n",(0,a.jsx)(t.li,{children:"eventLabelHeight: The height of the event label."}),"\n"]}),"\n"]}),"\n",(0,a.jsx)(t.li,{children:"isRtl: A boolean value that indicates whether the chart is in right-to-left mode."}),"\n",(0,a.jsx)(t.li,{children:"axisData: An object that contains the data related to the axis of the chart."}),"\n",(0,a.jsx)(t.li,{children:"useSecondaryYScale: A boolean value that indicates whether to use a secondary y-axis scale."}),"\n"]}),"\n"]}),"\n"]}),"\n",(0,a.jsx)(t.p,{children:(0,a.jsx)(t.strong,{children:"Working algorithm:"})}),"\n",(0,a.jsxs)(t.ul,{children:["\n",(0,a.jsxs)(t.li,{children:["\n",(0,a.jsx)(t.p,{children:"The function first extracts the necessary parameters from the\xa0yAxisParams\xa0object, such as the\xa0yMinMaxValues, yAxisElement, containerHeight, and containerWidth. It then calculates the final maximum and minimum values for the y-axis, based on the\xa0maxOfYVal, yMaxValue, and yMinValue\xa0parameters."}),"\n"]}),"\n",(0,a.jsxs)(t.li,{children:["\n",(0,a.jsx)(t.p,{children:"The function then prepares the datapoints for the y-axis using the\xa0prepareDatapoints\xa0function, which calculates the tick values based on the maximum and minimum values of the y-axis. It then creates a linear scale for the y-axis using the\xa0d3ScaleLinear\xa0function from the\xa0d3-scale\xa0library."}),"\n"]}),"\n",(0,a.jsxs)(t.li,{children:["\n",(0,a.jsx)(t.p,{children:"The function then creates the y-axis using the\xa0d3AxisLeft\xa0or\xa0d3AxisRight\xa0function from the\xa0d3-axis\xa0library, depending on the\xa0isRtl and useSecondaryYScale\xa0parameters. It sets the tick padding, tick values, and tick size for the y-axis, and formats the tick labels using the\xa0yAxisTickFormat\xa0parameter."}),"\n"]}),"\n",(0,a.jsxs)(t.li,{children:["\n",(0,a.jsx)(t.p,{children:"Finally, the function uses the d3Select function to select the\xa0yAxisElement\xa0and apply the y-axis to it using the call method. It also sets the aria-hidden attribute of the y-axis text elements to true to improve accessibility."}),"\n"]}),"\n",(0,a.jsxs)(t.li,{children:["\n",(0,a.jsxs)(t.p,{children:[(0,a.jsx)(t.strong,{children:"createStringYAxis():"}),"\xa0In the Vertical bar chart component, the\xa0d3-axis\xa0module is used to create and customize the y-axis of a vertical bar chart. The\xa0createStringYAxis\xa0function is responsible for creating the y-axis that use string values for the y-axis using the\xa0createStringYAxisForOtherCharts\xa0function. The function takes in several parameters, including\xa0yAxisParams, dataPoints, and isRtl. These parameters are used to customize the y-axis, such as setting the tick values, tick format, and tick padding."]}),"\n",(0,a.jsx)(t.p,{children:(0,a.jsx)(t.strong,{children:"Function arguments:"})}),"\n",(0,a.jsxs)(t.ul,{children:["\n",(0,a.jsx)(t.li,{children:"yAxisParams: An object that contains the parameters for the y-axis, including\xa0containerHeight,\xa0tickPadding,\xa0margins,\xa0yAxisTickFormat,\xa0yAxisElement, and\xa0yAxisPadding."}),"\n",(0,a.jsx)(t.li,{children:"dataPoints: An array of strings that represent the data points for the y-axis."}),"\n",(0,a.jsx)(t.li,{children:"isRtl: A boolean value that indicates whether the chart is in right-to-left mode."}),"\n"]}),"\n"]}),"\n"]}),"\n",(0,a.jsx)(t.p,{children:(0,a.jsx)(t.strong,{children:"Working algorithm:"})}),"\n",(0,a.jsxs)(t.ul,{children:["\n",(0,a.jsx)(t.li,{children:"The function first extracts the necessary parameters from the\xa0yAxisParams\xa0object, such as the\xa0containerHeight,\xa0margins,\xa0yAxisTickFormat,\xa0yAxisElement, and\xa0yAxisPadding. It then creates a band scale for the y-axis using the\xa0d3ScaleBand\xa0function from the\xa0d3-scale\xa0library."}),"\n",(0,a.jsx)(t.li,{children:"The band scale is defined using the\xa0dataPoints\xa0array as the domain, and the\xa0containerHeight\xa0and\xa0margins\xa0parameters as the range. The\xa0padding\xa0method is used to set the padding between the bands in the y-axis."}),"\n",(0,a.jsx)(t.li,{children:"The function then creates the y-axis using the\xa0d3AxisLeft\xa0or\xa0d3AxisRight\xa0function from the\xa0d3-axis\xa0library, depending on the\xa0isRtl\xa0parameter. It sets the tick padding, tick values, and tick size for the y-axis, and formats the tick labels using the\xa0yAxisTickFormat\xa0parameter."}),"\n",(0,a.jsx)(t.li,{children:"Finally, the function uses the\xa0d3Select\xa0function to select the\xa0yAxisElement\xa0and apply the y-axis to it using the\xa0call\xa0method. It also selects all the text elements of the y-axis and returns the y-axis scale."}),"\n",(0,a.jsxs)(t.li,{children:[(0,a.jsx)(t.strong,{children:"Bars:"}),"\n",(0,a.jsxs)(t.ul,{children:["\n",(0,a.jsxs)(t.li,{children:["\n",(0,a.jsxs)(t.p,{children:[(0,a.jsx)(t.strong,{children:"_getGraphData():"}),"\xa0This method generates the set of bars for each data point in the chart. The method creates two new x-axis scales, iterates over the\xa0_datasetForBars\xa0array, and calls the\xa0_buildGraph\xa0method to generate a set of bars for each data point. The sets of bars are added to an array, which is then assigned to the\xa0_groupedVerticalBarGraph\xa0variable."]}),"\n",(0,a.jsx)(t.p,{children:(0,a.jsx)(t.strong,{children:"Function arguments:"})}),"\n",(0,a.jsxs)(t.ul,{children:["\n",(0,a.jsx)(t.li,{children:"xScale: A\xa0StringAxis\xa0or\xa0NumericAxis\xa0object that represents the x-axis scale of the chart."}),"\n",(0,a.jsx)(t.li,{children:"yScale: A\xa0NumericAxis\xa0object that represents the y-axis scale of the chart."}),"\n",(0,a.jsx)(t.li,{children:"containerHeight: A number that represents the height of the chart container."}),"\n",(0,a.jsx)(t.li,{children:"containerWidth: A number that represents the width of the chart container."}),"\n",(0,a.jsx)(t.li,{children:"xElement: An optional\xa0SVGElement\xa0or\xa0null\xa0that represents the x-axis element of the chart."}),"\n"]}),"\n"]}),"\n"]}),"\n"]}),"\n"]}),"\n",(0,a.jsx)(t.p,{children:(0,a.jsx)(t.strong,{children:"Working algorithm:"})}),"\n",(0,a.jsxs)(t.ul,{children:["\n",(0,a.jsxs)(t.li,{children:["\n",(0,a.jsx)(t.p,{children:"The\xa0_getGraphData\xa0method first creates two new x-axis scales using the\xa0_createX0Scale\xa0and\xa0_createX1Scale\xa0methods. The\xa0_createX0Scale\xa0method creates a new x-axis scale for the main x-axis of the chart, while the\xa0_createX1Scale\xa0method creates a new x-axis scale for the grouped bars in the chart."}),"\n"]}),"\n",(0,a.jsxs)(t.li,{children:["\n",(0,a.jsx)(t.p,{children:"The method then creates an empty array called\xa0allGroupsBars. The\xa0_datasetForBars\xa0array is then iterated over, and for each data point in the array, the\xa0_buildGraph\xa0method is called to generate a set of bars for the data point. The\xa0_buildGraph\xa0method takes the current data point, the two x-axis scales, the container height, and the optional x-axis element as arguments and returns a set of bars as a JSX element."}),"\n"]}),"\n",(0,a.jsxs)(t.li,{children:["\n",(0,a.jsx)(t.p,{children:"The set of bars for each data point is added to the\xa0allGroupsBars\xa0array. Finally, the\xa0_groupedVerticalBarGraph\xa0variable is set to the\xa0allGroupsBars\xa0array."}),"\n"]}),"\n",(0,a.jsxs)(t.li,{children:["\n",(0,a.jsxs)(t.p,{children:[(0,a.jsx)(t.strong,{children:"_buildGraph():"}),"\xa0The method generates a set of bars for a single data point in the chart. The method iterates over each series in the data point and creates a\xa0rect\xa0element for each series. If the data property of the series is not\xa0null, the method also creates a text element to display the value of the data point above the bar. If the\xa0wrapXAxisLables\xa0prop is false and the\xa0showXAxisLablesTooltip\xa0prop is true, the method also displays a tooltip at the x-axis label. The method returns a\xa0g\xa0element that contains the set of bars and labels."]}),"\n",(0,a.jsx)(t.p,{children:(0,a.jsx)(t.strong,{children:"Function arguments:"})}),"\n",(0,a.jsxs)(t.ul,{children:["\n",(0,a.jsx)(t.li,{children:"singleSet: This is an object that contains the data for a single set of bars."}),"\n",(0,a.jsx)(t.li,{children:"xScale0: This is a scale function that maps the domain values to the range values for the x-axis."}),"\n",(0,a.jsx)(t.li,{children:"xScale1: This is a scale function that maps the domain values to the range values for the x-axis."}),"\n",(0,a.jsx)(t.li,{children:"containerHeight: This is the height of the container that holds the chart. It is of type\xa0number."}),"\n",(0,a.jsx)(t.li,{children:"xElement: This is the SVG element that represents the x-axis. It is of type\xa0SVGElement."}),"\n"]}),"\n"]}),"\n"]}),"\n",(0,a.jsx)(t.p,{children:(0,a.jsx)(t.strong,{children:"Working algorithm:"})}),"\n",(0,a.jsxs)(t.ul,{children:["\n",(0,a.jsx)(t.li,{children:"The\xa0_buildGraph\xa0method first creates two empty arrays called\xa0singleGroup\xa0and\xa0barLabelsForGroup. The\xa0yBarScale\xa0variable is then set to a new\xa0d3ScaleLinear\xa0object that represents the y-axis scale of the chart."}),"\n",(0,a.jsx)(t.li,{children:"The method then iterates over each series in the current data point. For each series, the method calculates the x and y coordinates of the bar using the\xa0xScale1\xa0and\xa0yBarScale\xa0scales, respectively. If the\xa0data\xa0property of the series is not\xa0null, the method creates a new\xa0rect\xa0element and adds it to the\xa0singleGroup\xa0array. The\xa0rect\xa0element has properties that define its position, size, color, and event handlers. If the\xa0data\xa0property of the series is not\xa0null\xa0and the\xa0hideLabels\xa0prop is\xa0false\xa0and the\xa0_barWidth\xa0property is greater than or equal to 16, the method creates a new\xa0text\xa0element and adds it to the\xa0barLabelsForGroup\xa0array. The\xa0text\xa0element displays the value of the data point above the bar."}),"\n",(0,a.jsx)(t.li,{children:"If the\xa0wrapXAxisLables\xa0prop is\xa0false\xa0and the\xa0showXAxisLablesTooltip\xa0prop is\xa0true, the method creates a new\xa0tooltipProps\xa0object and calls the\xa0tooltipOfXAxislabels\xa0function to display a tooltip at the x-axis label."}),"\n",(0,a.jsx)(t.li,{children:"Finally, the method returns a\xa0g\xa0element that contains the\xa0singleGroup\xa0and\xa0barLabelsForGroup\xa0arrays. The\xa0g\xa0element is translated to the x-coordinate of the current data point on the main x-axis using the\xa0xScale0\xa0scale."}),"\n",(0,a.jsxs)(t.li,{children:[(0,a.jsx)(t.strong,{children:"Legends:"}),"\n",(0,a.jsxs)(t.ul,{children:["\n",(0,a.jsxs)(t.li,{children:["\n",(0,a.jsxs)(t.p,{children:[(0,a.jsx)(t.strong,{children:"_getLegendData():"}),"\xa0The method generates the legend for the chart. The method iterates over each data point and series in the chart and creates a legend object for each unique series. The method returns a Legends component that renders the legend using the legend objects."]}),"\n",(0,a.jsx)(t.p,{children:(0,a.jsx)(t.strong,{children:"Function arguments:"})}),"\n",(0,a.jsxs)(t.ul,{children:["\n",(0,a.jsx)(t.li,{children:"points: An array of\xa0IGroupedVerticalBarChartData\xa0objects, which contain the data points for the chart."}),"\n",(0,a.jsx)(t.li,{children:"palette: An object of type\xa0IPalette, which contains the color palette for the chart.\nThe function returns a JSX element that renders the legend for the chart."}),"\n"]}),"\n"]}),"\n"]}),"\n"]}),"\n"]}),"\n",(0,a.jsx)(t.p,{children:(0,a.jsx)(t.strong,{children:"Working algorithm:"})}),"\n",(0,a.jsxs)(t.ul,{children:["\n",(0,a.jsx)(t.li,{children:"The\xa0_getLegendData\xa0method starts by defining some variables. The data variable is set to the points argument. The\xa0defaultPalette\xa0variable is set to an array of colors to use for the legend. The actions variable is set to an empty array."}),"\n",(0,a.jsx)(t.li,{children:"The method then iterates over each data point in the data array. For each data point, the method iterates over each series in the data point. For each series, the method checks if a similar legend has already been added to the actions array. If a similar legend exists, the method skips to the next series. If a similar legend does not exist, the method creates a new legend object and adds it to the actions array. The\xa0legend\xa0object contains a title property, which is set to the legend property of the current series, a color property, which is set to a random color from the\xa0defaultPalette\xa0array if the\xa0color\xa0property of the current series is not defined, and\xa0action, hoverAction, and onMouseOutAction\xa0properties, which are functions that handle\xa0click, hover, and mouse out\xa0events for the legend."}),"\n",(0,a.jsx)(t.li,{children:"Finally, the method returns a\xa0Legends\xa0component that renders the legend for the chart. The\xa0legends\xa0prop is set to the actions array. The\xa0overflowProps, enabledWrapLines, focusZonePropsInHoverCard, and legendProps\xa0props are set to values from the props object."}),"\n",(0,a.jsxs)(t.li,{children:[(0,a.jsx)(t.strong,{children:"Callouts:"}),"\n",(0,a.jsxs)(t.ul,{children:["\n",(0,a.jsxs)(t.li,{children:[(0,a.jsx)(t.strong,{children:"_getCustomizedCallout():"}),"\xa0The method returns a customized callout for a data point in the chart. The callout is rendered using the\xa0onRenderCalloutPerDataPoint\xa0prop, which is a function that takes a\xa0dataPointCalloutProps\xa0object as an argument and returns a React element."]}),"\n"]}),"\n"]}),"\n"]}),"\n",(0,a.jsx)(t.p,{children:(0,a.jsx)(t.strong,{children:"Working algorithm:"})}),"\n",(0,a.jsxs)(t.ul,{children:["\n",(0,a.jsx)(t.li,{children:"The\xa0_getCustomizedCallout\xa0method first checks if the\xa0onRenderCalloutPerDataPoint\xa0prop is defined. If it is, the method calls the\xa0onRenderCalloutPerDataPoint\xa0function and passes in the\xa0dataPointCalloutProps\xa0object as an argument. The\xa0dataPointCalloutProps\xa0object contains information about the current data point, including its\xa0x\xa0and\xa0y\xa0values, as well as its\xa0color\xa0and\xa0data\xa0properties."}),"\n",(0,a.jsx)(t.li,{children:"If the\xa0onRenderCalloutPerDataPoint\xa0prop is not defined, the\xa0_getCustomizedCallout\xa0method returns\xa0null."}),"\n",(0,a.jsxs)(t.li,{children:[(0,a.jsx)(t.strong,{children:"Rendering details"}),"\nThe Grouped vertical bar chart uses d3 SVG based rendering, which follows the following render cycles:","\n",(0,a.jsx)(t.pre,{children:(0,a.jsx)(t.code,{children:"- Invocation cycle: Grouped Vertical bar Chart -> Cartesian base chart -> X-axis -> X-axis labels -> Y-axis -> Y-axis labels -> bars, legends, callouts\n- Rendering cycle: Grouped vertical bar chart <- Bars (rect), Legends, Callouts <- Axes (d3.axis, d3.scale)\n"})}),"\n"]}),"\n"]}),"\n",(0,a.jsx)(t.p,{children:(0,a.jsx)(t.strong,{children:"Following are the detailed steps:"})}),"\n",(0,a.jsxs)(t.ul,{children:["\n",(0,a.jsx)(t.li,{children:"The rendering of the grouped vertical bar chart is done using SVG elements. The chart is rendered inside a\xa0svg\xa0element that is created using the\xa0React.createElement()\xa0method."}),"\n",(0,a.jsx)(t.li,{children:"The chart is divided into two main sections: the x-axis and the bars. The x-axis is created using the\xa0d3.axis()\xa0function and is rendered as a\xa0g\xa0element inside the\xa0svg\xa0element. The bars are created using the\xa0rect\xa0element and are rendered as a\xa0g\xa0element inside the\xa0svg\xa0element."}),"\n",(0,a.jsx)(t.li,{children:"The\xa0rect\xa0elements are created using the\xa0datasetForBars\xa0array that is created using the\xa0_createDataset()\xa0method. The\xa0datasetForBars\xa0array contains an array of objects, where each object represents a group of bars. Each group of bars is rendered as a\xa0g\xa0element inside the\xa0svg\xa0element."}),"\n",(0,a.jsx)(t.li,{children:"Inside each group of bars, the\xa0rect\xa0elements are created using the\xa0map()\xa0method on the\xa0data\xa0array. The\xa0map()\xa0method creates a new array of\xa0rect\xa0elements, where each\xa0rect\xa0element represents a bar in the group. The\xa0rect\xa0elements are positioned using the\xa0x\xa0and\xa0y\xa0attributes, which are calculated based on the data and the scales that were created earlier in the file."}),"\n",(0,a.jsx)(t.li,{children:"The\xa0rect\xa0elements are also styled using various attributes such as\xa0fill,\xa0stroke, and\xa0strokeWidth. The\xa0fill\xa0attribute is set to a color that is based on the index of the\xa0rect\xa0element in the group. The\xa0stroke\xa0and\xa0strokeWidth\xa0attributes are used to create a border around each\xa0rect\xa0element."}),"\n",(0,a.jsx)(t.li,{children:"The\xa0_onBarHover()\xa0method is used to handle the hover event on the bars. This method is called when the user hovers over a bar in the chart. The method updates the state of the component to show the callout for the hovered bar."}),"\n"]}),"\n",(0,a.jsx)(t.p,{children:"Overall, the grouped vertical bar chart is rendered using\xa0SVG\xa0elements that are created using the\xa0React.createElement()\xa0method. The chart is divided into two main sections: the x-axis and the bars. The bars are created using the\xa0rect\xa0element and are positioned and styled based on the data and the scales that were created earlier in the file. The\xa0_onBarHover()\xa0method is used to handle the hover event on the bars and show the callout for the hovered bar."}),"\n",(0,a.jsxs)(t.ul,{children:["\n",(0,a.jsxs)(t.li,{children:[(0,a.jsx)(t.strong,{children:"Error scenarios"}),"\nThe Grouped Vertical bar chart handles the following error scenario:","\n",(0,a.jsxs)(t.ul,{children:["\n",(0,a.jsx)(t.li,{children:"Empty data: If the data passed to the chart component is empty, the chart will not render and a message will be narrated to the user.\xa0_isChartEmpty\xa0functions handles that scenario."}),"\n"]}),"\n"]}),"\n",(0,a.jsxs)(t.li,{children:[(0,a.jsx)(t.strong,{children:"Localization aspects"}),"\nCurrently, although the component has a support for\xa0culture\xa0prop, but it does not support localization yet."]}),"\n",(0,a.jsxs)(t.li,{children:[(0,a.jsx)(t.strong,{children:"Testing"}),"\nThe testing for Grouped Vertical bar chart have not been started. The document will be updated as and when the tests are completed.\n",(0,a.jsx)(t.img,{alt:"GroupedVerticalBarChart3.png",src:n(6569).Z+"",width:"2475",height:"542"}),"\n",(0,a.jsxs)(t.ul,{children:["\n",(0,a.jsxs)(t.li,{children:["Component Tests:","\n",(0,a.jsxs)(t.ul,{children:["\n",(0,a.jsxs)(t.li,{children:["Work item ",(0,a.jsx)(t.a,{href:"https://uifabric.visualstudio.com/iss/_workitems/edit/7411",children:"7411"})]}),"\n"]}),"\n"]}),"\n",(0,a.jsxs)(t.li,{children:["Unit Tests:","\n",(0,a.jsxs)(t.ul,{children:["\n",(0,a.jsxs)(t.li,{children:["Work item ",(0,a.jsx)(t.a,{href:"https://uifabric.visualstudio.com/iss/_workitems/edit/7412",children:"7412"})]}),"\n"]}),"\n"]}),"\n",(0,a.jsxs)(t.li,{children:["Manual Tests:","\n",(0,a.jsxs)(t.ul,{children:["\n",(0,a.jsxs)(t.li,{children:["Work item ",(0,a.jsx)(t.a,{href:"https://uifabric.visualstudio.com/iss/_workitems/edit/8605",children:"8605"})]}),"\n"]}),"\n"]}),"\n",(0,a.jsxs)(t.li,{children:["Accessibility Tests:","\n",(0,a.jsxs)(t.ul,{children:["\n",(0,a.jsxs)(t.li,{children:["Work item ",(0,a.jsx)(t.a,{href:"https://uifabric.visualstudio.com/iss/_workitems/edit/7410",children:"7410"})]}),"\n"]}),"\n"]}),"\n"]}),"\n"]}),"\n",(0,a.jsxs)(t.li,{children:[(0,a.jsx)(t.strong,{children:"Accessibility"}),"\nFAST pass checks resulted in no error for Grouped Vertical bar chart. Link to the ",(0,a.jsx)(t.a,{href:"https://accessibilityinsights.io/docs/web/getstarted/fastpass/",children:"FAST pass tool"}),"\nOur charts have elaborate accessibility support. The charts are WCAG 2.1 MAS C compliant for accessibility.\nConsumers can define their own aria labels for each point by setting the\xa0callOutAccessibilityData\xa0property."]}),"\n",(0,a.jsxs)(t.li,{children:[(0,a.jsx)(t.strong,{children:"Theming"}),'\nThe palette for vertical bar chart is set from the "theme" prop as passed to the component during rendering. Both light and dark themes are supported and users can create there own theme too.\xa0',(0,a.jsx)(t.a,{href:"https://github.com/microsoft/fluentui/wiki/Theming",children:"Ref6"}),"\xa0\xa0and\xa0",(0,a.jsx)(t.a,{href:"https://github.com/microsoft/fluentui/wiki/How-to-apply-theme-to-Fluent-UI-React-components",children:"Ref7"}),"\xa0\xa0explains theming in detail."]}),"\n",(0,a.jsxs)(t.li,{children:[(0,a.jsx)(t.strong,{children:"Debugging"}),"\nThe detailed steps on debugging has been given in\xa0",(0,a.jsx)(t.a,{href:"https://github.com/microsoft/fluentui-charting-contrib/blob/main/docs/Debugging.md",children:"Debugging"}),"."]}),"\n",(0,a.jsxs)(t.li,{children:[(0,a.jsx)(t.strong,{children:"Variants"}),"\nFollowing are the variants of vertical bar chart:\xa0",(0,a.jsx)(t.a,{href:"https://developer.microsoft.com/en-us/fluentui#/controls/web/verticalbarchart/grouped",children:"Ref8"}),"\xa0","\n",(0,a.jsxs)(t.ul,{children:["\n",(0,a.jsxs)(t.li,{children:[(0,a.jsx)(t.em,{children:"Basic Grouped Vertical bar Chart"}),": Only basic props are provided."]}),"\n",(0,a.jsxs)(t.li,{children:[(0,a.jsx)(t.em,{children:"Custom Accessibility"}),": Providing custom aria labels."]}),"\n",(0,a.jsxs)(t.li,{children:[(0,a.jsx)(t.em,{children:"Styled"}),": Can show bars with increased bar width."]}),"\n",(0,a.jsxs)(t.li,{children:[(0,a.jsx)(t.em,{children:"Tooltip"}),": Can show tooltip over x-axis ticks when the ticks are truncated."]}),"\n"]}),"\n"]}),"\n",(0,a.jsxs)(t.li,{children:[(0,a.jsx)(t.strong,{children:"Interaction"}),"\nFollowing are the interactions that are allowed for donut chart:","\n",(0,a.jsxs)(t.ul,{children:["\n",(0,a.jsxs)(t.li,{children:[(0,a.jsx)(t.em,{children:"Mouse Events"}),":\na. Hover mouse over a bar, should call the corresponding handler and show the callout over that bar.\nb. On mouse move on Bar 1 (step 1) -> mouse leave (step 2) -> mouse move on Bar 2 (step 3), should render the callout of the Bar 2.\nc. On mouse over, callout should be defined, on mouse leave, callout should disappear.\nd. On mouse over on legends, should highlight the corresponding bar.\nf. On click on Bar, should highlight the corresponding bar.\ng. On mouse out after mouse over on first legend, should have opacity 0.1 for second bar initially (during mouseOver on first legend) and opacity set to 1 for both the bars on mouse out."]}),"\n",(0,a.jsxs)(t.li,{children:[(0,a.jsx)(t.em,{children:"Keyboard Events"}),":\na. On focus on a bar, should render the corresponding callout."]}),"\n"]}),"\n"]}),"\n",(0,a.jsxs)(t.li,{children:[(0,a.jsx)(t.strong,{children:"Some notable PRs and their brief description"}),"\n",(0,a.jsxs)(t.ul,{children:["\n",(0,a.jsx)(t.li,{children:(0,a.jsx)(t.a,{href:"https://github.com/microsoft/fluentui/pull/12687",children:"Adding the Grouped Vertical bar chart main component"})}),"\n",(0,a.jsx)(t.li,{children:(0,a.jsx)(t.a,{href:"https://github.com/microsoft/fluentui/pull/15838",children:"Refactoring Grouped Vertical Bar Chart via implementation of Cartesian charts"})}),"\n",(0,a.jsx)(t.li,{children:(0,a.jsx)(t.a,{href:"https://github.com/microsoft/fluentui/pull/18880",children:"Custom Accessibility Change for Grouped Vertical Bar Chart"})}),"\n",(0,a.jsx)(t.li,{children:(0,a.jsx)(t.a,{href:"https://github.com/microsoft/fluentui/pull/20347",children:"Number localization in charts"})}),"\n",(0,a.jsx)(t.li,{children:(0,a.jsx)(t.a,{href:"https://github.com/microsoft/fluentui/pull/16914",children:"Narrator issues fixed in bar charts"})}),"\n",(0,a.jsx)(t.li,{children:(0,a.jsx)(t.a,{href:"https://github.com/microsoft/fluentui/pull/17571",children:"Callout accessibility issue fixed for bar charts"})}),"\n"]}),"\n"]}),"\n",(0,a.jsxs)(t.li,{children:[(0,a.jsx)(t.strong,{children:"Learnings"}),"\n",(0,a.jsxs)(t.ul,{children:["\n",(0,a.jsx)(t.li,{children:"While implementing the tests using react testing library, it was found that certain browser functions like\xa0getComputedTextLength()\xa0cannot be unit tested and needs to be tested End-to-End only."}),"\n",(0,a.jsx)(t.li,{children:"Order of imports are important.\nFor example: for Vertical bar charts tests, improper sequencing of the imports (data first and then render) results in incorrect and incopmlete rendering of charts:"}),"\n"]}),"\n"]}),"\n"]}),"\n",(0,a.jsx)(t.pre,{children:(0,a.jsx)(t.code,{children:" - import { chartPoints } from '../VerticalBarChart/VerticalBarChart.test';\n - import { render, screen, queryAllByAttribute, fireEvent, act } from '@testing-library/react';\n"})}),"\n",(0,a.jsx)(t.p,{children:"However, the following results in correct rendering:"}),"\n",(0,a.jsx)(t.pre,{children:(0,a.jsx)(t.code,{children:"import { render, screen, queryAllByAttribute } from '@testing-library/react';\n\nimport { chartPoints } from './VerticalBarChart.test';\n"})}),"\n",(0,a.jsxs)(t.ul,{children:["\n",(0,a.jsxs)(t.li,{children:["\n",(0,a.jsx)(t.p,{children:"Certain props need async await structure (waitFor in react testing library) for different props or nested SVGs to render."}),"\n"]}),"\n",(0,a.jsxs)(t.li,{children:["\n",(0,a.jsx)(t.p,{children:(0,a.jsx)(t.strong,{children:"Known issues"})}),"\n",(0,a.jsxs)(t.ul,{children:["\n",(0,a.jsx)(t.li,{children:"Setting the margins externally via the props may cut the x and y ticks if the margins provided are very less. Setting a minimum margin would prevent any such distortions."}),"\n"]}),"\n"]}),"\n",(0,a.jsxs)(t.li,{children:["\n",(0,a.jsx)(t.p,{children:(0,a.jsx)(t.strong,{children:"Future improvements"})}),"\n",(0,a.jsx)(t.p,{children:"Following are the list of future improvements for the vertical bar chart:"}),"\n",(0,a.jsxs)(t.ul,{children:["\n",(0,a.jsx)(t.li,{children:"Improved accessibility: While the component already provides accessibility data for screen readers, there is always room for improvement in this area. Adding support for keyboard navigation and improving the accessibility of the callout would make the component more accessible to users with disabilities."}),"\n",(0,a.jsx)(t.li,{children:"Support for animations: Adding support for animations, such as transitions between data updates or hover effects, would make the component more visually appealing and engaging for users."}),"\n",(0,a.jsxs)(t.li,{children:["Following error handling scenarios can be improved:","\n",(0,a.jsxs)(t.ul,{children:["\n",(0,a.jsx)(t.li,{children:"Invalid or missing chart dimensions: If the dimensions of the chart are invalid or missing, the chart will not render and a message will be displayed to the user."}),"\n",(0,a.jsx)(t.li,{children:"Invalid or missing axis parameters: If the parameters for the x-axis or y-axis are invalid or missing, the chart will not render and a message will be displayed to the user."}),"\n",(0,a.jsx)(t.li,{children:"Invalid or missing legends: If the legends for the chart are invalid or missing, the chart will not render and a message will be displayed to the user."}),"\n",(0,a.jsx)(t.li,{children:"Invalid bar width: If the bar width for the chart is invalid, the chart will not render and a message will be displayed to the user."}),"\n",(0,a.jsx)(t.li,{children:"Invalid or missing data for callout: If the data for the callout is invalid or missing, the callout will not render and a message will be displayed to the user."}),"\n",(0,a.jsx)(t.li,{children:"Invalid or missing accessibility data: If the accessibility data for the chart is invalid or missing, the chart will not render and a message will be displayed to the user."}),"\n"]}),"\n"]}),"\n",(0,a.jsx)(t.li,{children:"Localization support can be improved for all strings and numbers."}),"\n"]}),"\n"]}),"\n",(0,a.jsxs)(t.li,{children:["\n",(0,a.jsxs)(t.p,{children:[(0,a.jsx)(t.strong,{children:"Design figma"}),"\nVertical bar Chart Figma:\xa0",(0,a.jsx)(t.a,{href:"https://www.figma.com/file/WOoCs0CmNYZhYl9xXeCGpi/Data-viz-(Archive)?type=design&node-id=21153-80245&mode=design&t=eFKlPGUixdgy9xRs-0",children:"Link"}),"\xa0"]}),"\n"]}),"\n",(0,a.jsxs)(t.li,{children:["\n",(0,a.jsx)(t.p,{children:(0,a.jsx)(t.strong,{children:"Performance"})}),"\n",(0,a.jsx)(t.p,{children:"The performance aspect of a donut chart refers to how efficiently and effectively it conveys information to the viewer. Here are some key considerations regarding the performance of a line chart:"}),"\n",(0,a.jsxs)(t.ul,{children:["\n",(0,a.jsx)(t.li,{children:"Data Visualization Efficiency"}),"\n",(0,a.jsx)(t.li,{children:"Clarity and Simplicity"}),"\n",(0,a.jsx)(t.li,{children:"Responsiveness"}),"\n",(0,a.jsx)(t.li,{children:"Handling Large Datasets"}),"\n",(0,a.jsx)(t.li,{children:"Interactive Features"}),"\n"]}),"\n"]}),"\n"]}),"\n",(0,a.jsx)(t.p,{children:"We use Lighthouse tool for measuring the performance of our charts. Following are few of the scenarios for which we measure the performance score for vertical bar chart:"}),"\n",(0,a.jsxs)(t.ul,{children:["\n",(0,a.jsx)(t.li,{children:(0,a.jsx)(t.strong,{children:"References"})}),"\n"]}),"\n",(0,a.jsxs)(t.ol,{children:["\n",(0,a.jsx)(t.li,{children:(0,a.jsx)(t.a,{href:"https://github.com/d3/d3-scale/blob/main/README.md",children:"D3-scale"})}),"\n",(0,a.jsx)(t.li,{children:(0,a.jsx)(t.a,{href:"https://github.com/d3/d3-selection/blob/main/README.md",children:"D3-selection"})}),"\n",(0,a.jsx)(t.li,{children:(0,a.jsx)(t.a,{href:"https://github.com/d3/d3-array/blob/main/README.md",children:"D3-array"})}),"\n",(0,a.jsx)(t.li,{children:(0,a.jsx)(t.a,{href:"https://github.com/d3/d3-axis/blob/main/README.md",children:"D3-axis"})}),"\n",(0,a.jsx)(t.li,{children:(0,a.jsx)(t.a,{href:"https://github.com/microsoft/fluentui/wiki/How-to-apply-theme-to-Fluent-UI-React-components",children:"How to apply theme"})}),"\n",(0,a.jsx)(t.li,{children:(0,a.jsx)(t.a,{href:"https://github.com/microsoft/fluentui/wiki/Theming",children:"Theming"})}),"\n",(0,a.jsx)(t.li,{children:(0,a.jsx)(t.a,{href:"https://developer.microsoft.com/en-us/fluentui#/controls/web/verticalbarchart/grouped",children:"Grouped Vertical Bar Chart"})}),"\n"]}),"\n",(0,a.jsxs)(t.ul,{children:["\n",(0,a.jsxs)(t.li,{children:[(0,a.jsx)(t.strong,{children:"Appendix"}),"\nThe mathematical formulae used in the Grouped vertical bar chart component are as follows:"]}),"\n"]}),"\n",(0,a.jsxs)(t.ol,{children:["\n",(0,a.jsx)(t.li,{children:"Formula for calculating the\xa0x0\xa0scale using\xa0d3ScaleBand:"}),"\n"]}),"\n",(0,a.jsx)(t.pre,{children:(0,a.jsx)(t.code,{children:"x0 = d3ScaleBand()\n\n.domain(data.map(d => d.category))\n\n.range([0, width])\n\n.paddingInner(x0_inner_padding)\n\n- x0_inner_padding = space_between_groups/(space_between_groups + group_width)\n\n- space_between_groups = 2 * bar_width\n\n- group_width = this._keys.length * bar_width + (this._keys.length - 1) * space_between_bars\n"})}),"\n",(0,a.jsxs)(t.ol,{start:"2",children:["\n",(0,a.jsx)(t.li,{children:"Formula for calculating the maximum value of the y-axis data using\xa0d3Max:"}),"\n"]}),"\n",(0,a.jsx)(t.pre,{children:(0,a.jsx)(t.code,{children:"const maxYValue = d3Max(data, d => d3Max(\\_keys, key => d[key]))\n"})}),"\n",(0,a.jsxs)(t.ol,{start:"3",children:["\n",(0,a.jsx)(t.li,{children:"Formula for calculating the\xa0y\xa0scale using\xa0d3ScaleLinear:"}),"\n"]}),"\n",(0,a.jsx)(t.pre,{children:(0,a.jsx)(t.code,{children:"y = d3ScaleLinear()\n\n.domain([0, maxYValue])\n\n.range([0, height])\n\nheight = containerHeight - marginsBottom - marginsTop\n"})}),"\n",(0,a.jsxs)(t.ol,{start:"4",children:["\n",(0,a.jsx)(t.li,{children:"Formula for calculating the bar gap rate:"}),"\n"]}),"\n",(0,a.jsx)(t.pre,{children:(0,a.jsx)(t.code,{children:"x1_inner_padding = space_between_bars / (space_between_bars + bar_width)\n\n=> space_between_bars = (x1_inner_padding / (1 - x1_inner_padding)) * bar_width\n\nRate at which the space between the bars in a group changes wrt the bar width\n\nBAR_GAP_RATE = X1_INNER_PADDING / (1 - X1_INNER_PADDING)\n\nX1_INNER_PADDING = 0.1\n"})}),"\n",(0,a.jsxs)(t.ol,{start:"5",children:["\n",(0,a.jsx)(t.li,{children:"Formula for calculating the group width and bar width:"}),"\n"]}),"\n",(0,a.jsx)(t.p,{children:"Maximum possible group width to maintain 2:1 spacing:"}),"\n",(0,a.jsx)(t.p,{children:"InitialBarWidth = Math.min(props.barwidth || 16, 24);"}),"\n",(0,a.jsx)(t.pre,{children:(0,a.jsx)(t.code,{children:"(i) InitialGroupWidth = _keys.length * InitialBarWidth+ (_keys.length - 1) * BAR_GAP_RATE * InitialBarWidth\n"})}),"\n",(0,a.jsx)(t.p,{children:"Total width required to render the bars. Directly proportional to bar width:"}),"\n",(0,a.jsx)(t.pre,{children:(0,a.jsx)(t.code,{children:"(ii) ReqWidth = _xAxisLabels.length * InitialGroupWidth + (_xAxisLabels.length - 1) * 2 * InitialBarWidth\n\nFrom (i) and (ii)\n\nMaximum possible group width to maintain 2:1 spacing\n\nMaxBandwidth = totalWidth / (_xAxisLabels.length +\n\n(_xAxisLabels.length - 1) * (2 / (_keys.length + (_keys.length - 1) * BAR_GAP_RATE)))\n\nFinalGroupWidth = MaxBandwidth;\n\nFrom (i)\n\nFinalBarWidth = FinalGroupWidth / (_keys.length + (_keys.length - 1) * BAR_GAP_RATE)\n"})}),"\n",(0,a.jsxs)(t.ol,{start:"6",children:["\n",(0,a.jsx)(t.li,{children:"Formula for calculating the width of each bar:"}),"\n"]}),"\n",(0,a.jsx)(t.pre,{children:(0,a.jsx)(t.code,{children:"barWidth = (x0.bandwidth() - spaceBetweenBars) / this._keys.length\n"})})]})}function d(e={}){const{wrapper:t}={...(0,i.a)(),...e.components};return t?(0,a.jsx)(t,{...e,children:(0,a.jsx)(c,{...e})}):c(e)}},1075:(e,t,n)=>{n.d(t,{Z:()=>a});const a=n.p+"assets/images/GVBC1-bfb960362b8a441805cd138056a2f8f6.png"},1030:(e,t,n)=>{n.d(t,{Z:()=>a});const a=n.p+"assets/images/GVBC2-d4cbda92ad72f6f1a2f85f9e2341b6e0.png"},6569:(e,t,n)=>{n.d(t,{Z:()=>a});const a=n.p+"assets/images/GVBC3-15789353c5cef662c6d0f971540ad844.png"},1151:(e,t,n)=>{n.d(t,{Z:()=>h,a:()=>r});var a=n(7294);const i={},s=a.createContext(i);function r(e){const t=a.useContext(s);return a.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function h(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(i):e.components||i:r(e.components),a.createElement(s.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/44a464d7.ef547f4b.js b/assets/js/44a464d7.ef547f4b.js new file mode 100644 index 0000000000..0ecaa9d66e --- /dev/null +++ b/assets/js/44a464d7.ef547f4b.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkdocsite=self.webpackChunkdocsite||[]).push([[6662],{1826:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>o,contentTitle:()=>r,default:()=>d,frontMatter:()=>s,metadata:()=>h,toc:()=>l});var a=n(5893),i=n(1151);const s={},r="Contributor guide: Vertical Bar Chart",h={id:"Charting-Concepts/VerticalBarChart",title:"Contributor guide: Vertical Bar Chart",description:"VerticalBarChart1.png",source:"@site/../../docs/Charting-Concepts/VerticalBarChart.md",sourceDirName:"Charting-Concepts",slug:"/Charting-Concepts/VerticalBarChart",permalink:"/fluentui-charting-contrib/docs/Charting-Concepts/VerticalBarChart",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{},sidebar:"tutorialSidebar",previous:{title:"Contributor guide: Stacked Bar Chart",permalink:"/fluentui-charting-contrib/docs/Charting-Concepts/StackedBarChart"},next:{title:"Contributor guide: Vertical Stacked Bar Chart",permalink:"/fluentui-charting-contrib/docs/Charting-Concepts/VerticalStackedBarChart"}},o={},l=[];function c(e){const t={a:"a",code:"code",em:"em",h1:"h1",img:"img",li:"li",ol:"ol",p:"p",pre:"pre",strong:"strong",ul:"ul",...(0,i.a)(),...e.components};return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(t.h1,{id:"contributor-guide-vertical-bar-chart",children:"Contributor guide: Vertical Bar Chart"}),"\n",(0,a.jsx)(t.p,{children:(0,a.jsx)(t.img,{alt:"VerticalBarChart1.png",src:n(5387).Z+"",width:"1059",height:"761"})}),"\n",(0,a.jsx)(t.p,{children:"A vertical bar chart is a type of chart that displays data as a series of vertical bars, with each bar representing a category and the height of the bar representing the value of that category. It is commonly used to compare the values of different categories. In addition, it can also include a line chart that displays a trend line or a target line. This type of chart is commonly used to show the relationship between the actual values and the target values or to show the trend of the data over time."}),"\n",(0,a.jsxs)(t.ul,{children:["\n",(0,a.jsxs)(t.li,{children:[(0,a.jsx)(t.strong,{children:"Use cases"}),"\nSome common use cases of vertical bar charts are as follows:","\n",(0,a.jsxs)(t.ul,{children:["\n",(0,a.jsx)(t.li,{children:"Comparing values of different categories"}),"\n",(0,a.jsx)(t.li,{children:"Showing changes in data over time"}),"\n",(0,a.jsx)(t.li,{children:"Displaying data that can be easily divided into categories"}),"\n",(0,a.jsx)(t.li,{children:"Highlighting the highest or lowest values in a dataset"}),"\n",(0,a.jsx)(t.li,{children:"Showing the distribution of data across categories"}),"\n",(0,a.jsx)(t.li,{children:"Displaying survey results or feedback data"}),"\n",(0,a.jsx)(t.li,{children:"Comparing performance metrics of different products or services"}),"\n",(0,a.jsx)(t.li,{children:"Analyzing sales data by region or product category"}),"\n",(0,a.jsx)(t.li,{children:"Displaying financial data such as revenue or profit by quarter or year"}),"\n"]}),"\n"]}),"\n",(0,a.jsx)(t.li,{children:(0,a.jsx)(t.strong,{children:"Mathematical/Geometrical concepts"})}),"\n"]}),"\n",(0,a.jsx)(t.p,{children:(0,a.jsx)(t.img,{alt:"VerticalBarChart2.png",src:n(2362).Z+"",width:"1110",height:"642"})}),"\n",(0,a.jsx)(t.p,{children:"The major D3 functions that are involved in the creation of Vertical bar charts are:"}),"\n",(0,a.jsxs)(t.ul,{children:["\n",(0,a.jsxs)(t.li,{children:["\n",(0,a.jsxs)(t.p,{children:[(0,a.jsx)(t.strong,{children:"d3-scale:"}),"\nThe\xa0d3-scale\xa0module is a part of the d3 library, which is a collection of JavaScript functions that are used for data visualization. The\xa0d3-scale\xa0module provides several functions for creating and manipulating scales, which are used to map data values to visual properties, such as\xa0position, size, and color."]}),"\n",(0,a.jsx)(t.p,{children:"The\xa0d3-scale\xa0module includes several scale types, including linear, logarithmic, power, and time scales. These scales are used to map continuous data values to a continuous range of visual properties. The module also includes ordinal and band scales, which are used to map categorical data values to a discrete range of visual properties."}),"\n"]}),"\n"]}),"\n",(0,a.jsx)(t.p,{children:"The\xa0d3-scale\xa0module provides several functions for creating and manipulating scales, including\xa0scaleLinear, scaleLog, scalePow, scaleTime, scaleOrdinal, and scaleBand. These functions take one or more arguments that define the domain and range of the scale, as well as any additional properties, such as the number of ticks or the padding between bands."}),"\n",(0,a.jsxs)(t.p,{children:[(0,a.jsx)(t.strong,{children:"Application in Vertical bar chart:"}),"\nVertical bar chart uses the\xa0d3-scale\xa0module to create a linear scale for the y-axis of the chart. The linear scale maps a continuous domain of data values to a continuous range of visual properties, such as position or height."]}),"\n",(0,a.jsx)(t.p,{children:"In Vertical bar chart, the\xa0d3ScaleLinear\xa0function is used to create the\xa0xBarScale,\xa0yBarScale\xa0and\xa0colorScale\xa0properties of the component."}),"\n",(0,a.jsxs)(t.ul,{children:["\n",(0,a.jsxs)(t.li,{children:["\n",(0,a.jsxs)(t.p,{children:[(0,a.jsx)(t.strong,{children:"xBarScale:"})," It is a function that can be used to map input values to positions on the x-axis of the chart. When an input value is passed to the\xa0xBarScale\xa0function, it will return a position value that corresponds to the input value based on the specified domain and range.\xa0d3.scaleLinear()\xa0is used to create\xa0xBarScale\xa0for Numeric scales. Otherwise,\xa0d3.scaleBand()\xa0is used."]}),"\n"]}),"\n",(0,a.jsxs)(t.li,{children:["\n",(0,a.jsxs)(t.p,{children:[(0,a.jsx)(t.strong,{children:"yBarScale:"})," It is a function that can be used to map input values to positions on the y-axis of the chart. When an input value is passed to the\xa0yBarScale\xa0function, it will return a position value that corresponds to the input value based on the specified domain and range."]}),"\n"]}),"\n",(0,a.jsxs)(t.li,{children:["\n",(0,a.jsxs)(t.p,{children:[(0,a.jsx)(t.strong,{children:"colorScale:"})," It is a function that can be used to map input values to colors. When an input value is passed to the\xa0colorScale\xa0function, it will return a color value that corresponds to the input value based on the specified domain and range."]}),"\n"]}),"\n",(0,a.jsxs)(t.li,{children:["\n",(0,a.jsxs)(t.p,{children:[(0,a.jsx)(t.strong,{children:"d3-shape:"}),"\xa0The\xa0d3-shape\xa0library provides various functions for creating and manipulating shapes such as\xa0arcs, lines, and areas. Following are the main mathematical/geometrical concepts that are used while drawing a vertical bar chart."]}),"\n",(0,a.jsxs)(t.p,{children:[(0,a.jsx)(t.strong,{children:"Application in Vertical bar chart:"}),"\nIn Vertical bar chart,\xa0d3.line()\xa0is a function from the\xa0d3-shape\xa0module that is used to create a line generator for the line chart in the chart component. The line generator is used to generate a path element that represents the line chart based on the data points and the x and y scales."]}),"\n",(0,a.jsxs)(t.ul,{children:["\n",(0,a.jsxs)(t.li,{children:["\n",(0,a.jsxs)(t.p,{children:[(0,a.jsx)(t.strong,{children:"d3.line():"}),"\xa0The\xa0d3Line\xa0function takes no arguments and returns a new line generator. The line generator can be customized using several methods, including\xa0x, y, defined, and curve. The\xa0x\xa0and\xa0y\xa0methods set the x and y accessors for the line generator, which define how the x and y values of the data points are mapped to the x and y positions of the line. The\xa0defined\xa0method sets a function that determines whether a data point is defined or not, which can be used to handle missing or invalid data. The\xa0curve\xa0method sets the curve interpolation for the line, which determines how the line is smoothed between the data points."]}),"\n",(0,a.jsxs)(t.p,{children:[(0,a.jsx)(t.strong,{children:"Application in Vertical bar chart:"}),"\nIn Vertical bar chart, the\xa0d3Line\xa0function is used to create the\xa0linePath\xa0of the component, which is the line generator for the line chart on top of the vertical bar chart. The\xa0linePath\xa0variable is created using the\xa0d3Line\xa0function and is customized using the\xa0x and y\xa0methods."]}),"\n"]}),"\n"]}),"\n"]}),"\n"]}),"\n",(0,a.jsx)(t.p,{children:"The\xa0x\xa0method uses a ternary operator to check if the x-axis is a numeric axis or not. If the x-axis is not a numeric axis, the function uses the\xa0xBarScale\xa0function to calculate the x-coordinate of the line chart. The\xa0xBarScale\xa0function is a scale function that maps the x-axis values to the x-coordinates of the vertical bars in the chart. If the x-axis is a numeric axis, the function uses the\xa0xScale\xa0function to calculate the x-coordinate of the line chart. The\xa0xScale\xa0function is a scale function that maps the x-axis values to the x-coordinates of the chart."}),"\n",(0,a.jsx)(t.p,{children:"The\xa0y\xa0method uses a ternary operator to check if the data point should use the secondary y-axis or not. If the data point should use the secondary y-axis, the function uses the\xa0yScaleSecondary\xa0function to calculate the y-coordinate of the line chart. The\xa0yScaleSecondary\xa0function is a scale function that maps the y-axis values to the y-coordinates of the secondary y-axis. If the data point should not use the secondary y-axis, the function uses the\xa0yScale\xa0function to calculate the y-coordinate of the line chart. The\xa0yScale\xa0function is a scale function that maps the y-axis values to the y-coordinates of the chart."}),"\n",(0,a.jsxs)(t.ul,{children:["\n",(0,a.jsxs)(t.li,{children:["\n",(0,a.jsxs)(t.p,{children:[(0,a.jsx)(t.strong,{children:"d3-selection:"}),"\xa0The\xa0d3-selection\xa0is a module from the d3 library that is used to select and manipulate DOM elements in the chart component. The\xa0d3-selection\xa0module provides several functions for selecting and manipulating DOM elements, including\xa0select, selectAll, append, attr, and style. The select function is used to select a single DOM element that matches a given selector. The\xa0selectAll\xa0function is used to select multiple DOM elements that match a given selector. The\xa0append\xa0function is used to append a new DOM element to a selected element. The\xa0attr\xa0function is used to set or get an attribute of a selected element. The\xa0style\xa0function is used to set or get a style property of a selected element."]}),"\n",(0,a.jsxs)(t.p,{children:[(0,a.jsx)(t.strong,{children:"Application in Vertical bar chart:"}),"\nIn Vertical bar chart, the\xa0d3-selection\xa0module is used to select and manipulate several DOM elements in the chart component. For example, the\xa0d3Selection.select\xa0function is used to select the\xa0xElement\xa0element, which is a reference to the SVG element that contains the x-axis."]}),"\n"]}),"\n",(0,a.jsxs)(t.li,{children:["\n",(0,a.jsxs)(t.p,{children:[(0,a.jsx)(t.strong,{children:"d3-array:"}),"\xa0The\xa0d3-array\xa0is a module from the d3 library that is used to manipulate arrays of data in the chart component. The\xa0d3-array\xa0module provides several functions for manipulating arrays of data, including\xa0max, min, extent, sum, and mean. The\xa0max\xa0function is used to find the maximum value in an array of data. The\xa0min\xa0function is used to find the minimum value in an array of data. The\xa0extent\xa0function is used to find the minimum and maximum values in an array of data. The\xa0sum\xa0function is used to find the sum of the values in an array of data. The\xa0mean\xa0function is used to find the mean (average) of the values in an array of data."]}),"\n",(0,a.jsxs)(t.p,{children:[(0,a.jsx)(t.strong,{children:"Application in Vertical bar chart:"}),"\nIn Vertical bar chart, the\xa0d3-array\xa0module is used to manipulate the data array that represents the data points in the chart component. For example, the\xa0d3Array.max\xa0function is used to find the maximum value of the y-values in the data array, which is used to set the domain of the y-axis scale. The\xa0d3Array.min\xa0function is used to find the minimum value of the y-values in the data array, which is also used to set the domain of the y-axis scale."]}),"\n"]}),"\n",(0,a.jsxs)(t.li,{children:["\n",(0,a.jsxs)(t.p,{children:[(0,a.jsx)(t.strong,{children:"d3-format:"}),"\xa0The\xa0d3-format\xa0is a module from the d3 library that is used to format numbers and strings in the chart component. The\xa0d3-format\xa0module provides several functions for formatting numbers and strings, including\xa0format, formatPrefix, precisionFixed, and precisionRound."]}),"\n",(0,a.jsx)(t.p,{children:"The\xa0format\xa0function is used to format a number or string using a specified format string. The format string can include placeholders for the value, such as\xa0%\xa0for a percentage or\xa0,\xa0for a comma-separated number. The\xa0formatPrefix\xa0function is used to format a number using a prefix notation that rounds the value to a specified precision and appends a prefix, such as k for thousands or M for millions. The\xa0precisionFixed\xa0function is used to format a number using a fixed number of decimal places. The\xa0precisionRound\xa0function is used to format a number using a variable number of decimal places that is determined by the magnitude of the value."}),"\n"]}),"\n"]}),"\n",(0,a.jsxs)(t.p,{children:[(0,a.jsx)(t.strong,{children:"Application in Vertical bar chart:"}),"\nIn Vertical bar chart, the\xa0d3-format\xa0module is used to format the labels for the bars in the chart component. For example, the\xa0_renderBarLabel\xa0method uses the\xa0d3FormatPrefix\xa0function to format the value of the bar using a prefix notation that rounds the value to two decimal places if the value is less than\xa01000, or to one decimal place if the value is greater than or equal to\xa01000. The formatted value is then appended to the text element as its content."]}),"\n",(0,a.jsxs)(t.ul,{children:["\n",(0,a.jsxs)(t.li,{children:["\n",(0,a.jsxs)(t.p,{children:[(0,a.jsx)(t.strong,{children:"d3-axis:"}),"\xa0The\xa0d3-axis\xa0module is a part of the d3 library, which is a collection of JavaScript functions that are used for data visualization. The\xa0d3-axis\xa0module provides several functions for creating and manipulating axes, which are used to display the scales of a chart component."]}),"\n",(0,a.jsx)(t.p,{children:"In data visualization, axes are used to display the scales of a chart component, such as the x-axis and y-axis of a bar chart. Axes provide visual cues to help readers interpret the data values of a chart component, such as the range and domain of the data values."}),"\n"]}),"\n"]}),"\n",(0,a.jsx)(t.p,{children:"The\xa0d3-axis\xa0module provides several types of axes, including\xa0bottom, top, left, and right axes. Each type of axis has its own set of methods for customizing the axis and displaying the tick values."}),"\n",(0,a.jsxs)(t.p,{children:[(0,a.jsx)(t.strong,{children:"Application in Vertical bar chart:"}),"\nIn the Vertical stacked bar chart,\xa0d3-axis\xa0is used to create and render the x and y axes of the chart."]}),"\n",(0,a.jsxs)(t.ul,{children:["\n",(0,a.jsxs)(t.li,{children:["\n",(0,a.jsx)(t.p,{children:"The\xa0d3-axis\xa0library provides various methods for creating and rendering axes, such as\xa0axisBottom(),\xa0axisLeft(), and\xa0tickFormat(). In this case, the\xa0d3-axis\xa0library is used to create and render the x and y axes of the chart."}),"\n"]}),"\n",(0,a.jsxs)(t.li,{children:["\n",(0,a.jsx)(t.p,{children:"To create the x and y axes, the\xa0d3-axis\xa0library's\xa0axisBottom()\xa0and\xa0axisLeft()\xa0methods are used, respectively. These methods take a scale function as an argument and return a new axis function that can be used to render the axis."}),"\n"]}),"\n",(0,a.jsxs)(t.li,{children:["\n",(0,a.jsx)(t.p,{children:"The resulting x and y axis functions are then used to render the x and y axes of the chart. The\xa0call()\xa0method of the selection object is used to call the axis function and render the axis."}),"\n"]}),"\n",(0,a.jsxs)(t.li,{children:["\n",(0,a.jsx)(t.p,{children:"The\xa0tickFormat()\xa0method of the y-axis scale is also used to set the tick format function for the y-axis. This method takes the format function created using the\xa0d3-format\xa0library as an argument and sets it as the tick format function for the y-axis."}),"\n"]}),"\n",(0,a.jsxs)(t.li,{children:["\n",(0,a.jsxs)(t.p,{children:[(0,a.jsx)(t.strong,{children:"Dev Deisgn Details:"}),"\nFollowing are the major components that contribute towards creating a complete vertical bar chart:"]}),"\n",(0,a.jsxs)(t.ul,{children:["\n",(0,a.jsxs)(t.li,{children:[(0,a.jsx)(t.strong,{children:"Axes:"}),"\n",(0,a.jsxs)(t.ul,{children:["\n",(0,a.jsxs)(t.li,{children:["\n",(0,a.jsxs)(t.p,{children:[(0,a.jsx)(t.strong,{children:"_getScales():"}),"\xa0This method is responsible for generating the x and y scales that are used to map the data points to the chart dimensions. The scales are generated using the\xa0d3-scale\xa0library, which provides several scale types for different types of data."]}),"\n",(0,a.jsx)(t.p,{children:(0,a.jsx)(t.strong,{children:"Function arguments:"})}),"\n",(0,a.jsxs)(t.ul,{children:["\n",(0,a.jsx)(t.li,{children:"containerHeight: a number representing the height of the container element that the chart is rendered in."}),"\n",(0,a.jsx)(t.li,{children:"containerWidth: a number representing the width of the container element that the chart is rendered in."}),"\n",(0,a.jsx)(t.li,{children:"isNumericScale: a boolean value indicating whether the x-axis scale is numeric or not."}),"\n"]}),"\n"]}),"\n"]}),"\n"]}),"\n"]}),"\n"]}),"\n"]}),"\n",(0,a.jsx)(t.p,{children:(0,a.jsx)(t.strong,{children:"Working algorithm:"})}),"\n",(0,a.jsxs)(t.ul,{children:["\n",(0,a.jsxs)(t.li,{children:["\n",(0,a.jsx)(t.p,{children:"The\xa0_getScales\xa0method takes several arguments, including\xa0containerHeight,\xa0containerWidth, and\xa0isNumericScale. These arguments are used to define the dimensions of the chart and to determine whether the x-axis is a numeric or categorical axis."}),"\n"]}),"\n",(0,a.jsxs)(t.li,{children:["\n",(0,a.jsx)(t.p,{children:"If the x-axis is a numeric axis, the method uses the\xa0d3ScaleLinear\xa0function to create a linear scale for the x-axis. It first calculates the maximum and minimum x-values in the data using the\xa0d3Max\xa0and\xa0d3Min\xa0functions, respectively. It then creates a linear scale that maps the x-values to the chart dimensions using the domain and range methods. The nice method is also called on the x-axis scale to ensure that the tick values are rounded to the nearest integer."}),"\n"]}),"\n",(0,a.jsxs)(t.li,{children:["\n",(0,a.jsx)(t.p,{children:"If the x-axis is a categorical axis, the method uses the\xa0d3ScaleBand\xa0function to create a band scale for the x-axis. It first extracts the x-axis labels from the data and uses them to define the domain of the scale. It then creates a band scale that maps the x-axis labels to the chart dimensions using the domain and range methods. The\xa0paddingInner\xa0method is also called on the x-axis scale to ensure that there is some space between the bars."}),"\n"]}),"\n",(0,a.jsxs)(t.li,{children:["\n",(0,a.jsx)(t.p,{children:"For the y-axis, the method always uses the\xa0d3ScaleLinear\xa0function to create a linear scale that maps the y-values to the chart dimensions. It first defines the domain of the scale as\xa0[0, this._yMax], where\xa0_yMax\xa0is the maximum y-value in the data. It then defines the range of the scale as\xa0[0, containerHeight - this.margins.bottom! - this.margins.top!], where\xa0containerHeight\xa0is the height of the chart container and\xa0this.margins.bottom!\xa0and\xa0this.margins.top!\xa0are the bottom and top margins of the chart, respectively."}),"\n"]}),"\n",(0,a.jsxs)(t.li,{children:["\n",(0,a.jsx)(t.p,{children:"Finally, the method returns an object that contains the x and y scales for the chart. The x and y scales are returned as separate properties of the object."}),"\n"]}),"\n",(0,a.jsxs)(t.li,{children:["\n",(0,a.jsxs)(t.p,{children:[(0,a.jsx)(t.strong,{children:"_getDomainMargins():"}),"\xa0This method is responsible for calculating the margins for the chart based on the available container width and the number of x-axis labels. The margins are used to center the chart and to ensure that the bars are evenly spaced."]}),"\n",(0,a.jsx)(t.p,{children:(0,a.jsx)(t.strong,{children:"Function arguments:"})}),"\n",(0,a.jsxs)(t.ul,{children:["\n",(0,a.jsx)(t.li,{children:"containerWidth\xa0which is a number representing the width of the container in which the chart is being rendered."}),"\n"]}),"\n"]}),"\n"]}),"\n",(0,a.jsx)(t.p,{children:(0,a.jsx)(t.strong,{children:"Working algorithm:"})}),"\n",(0,a.jsxs)(t.ul,{children:["\n",(0,a.jsxs)(t.li,{children:["\n",(0,a.jsx)(t.p,{children:"The\xa0_getDomainMargins\xa0method takes one argument,\xa0containerWidth, which is the width of the container that the chart is rendered in. It first checks whether the x-axis is a numeric axis or a categorical axis. If the x-axis is a categorical axis, the method returns the margins defined in the margins prop."}),"\n"]}),"\n",(0,a.jsxs)(t.li,{children:["\n",(0,a.jsx)(t.p,{children:"If the x-axis is a numeric axis, the method calculates the total width available to render the bars by subtracting the left and right margins and the minimum domain margin from the container width. It then calculates the required width to render the bars based on the number of x-axis labels and the bar width. If the total width is greater than or equal to the required width, the method centers the chart by setting equal left and right margins for the domain. If the total width is less than the required width, the method calculates the maximum possible bar width to maintain a 2:1 spacing between the bars."}),"\n"]}),"\n",(0,a.jsxs)(t.li,{children:["\n",(0,a.jsx)(t.p,{children:"The method then sets the\xa0_domainMargin\xa0and\xa0_barWidth\xa0properties of the component based on the calculated margins and bar width. It returns an object that contains the updated margins, with the left and right margins increased by the\xa0_domainMargin\xa0value."}),"\n"]}),"\n",(0,a.jsxs)(t.li,{children:["\n",(0,a.jsxs)(t.p,{children:[(0,a.jsx)(t.strong,{children:"createNumericXAxis():"}),"\xa0This function is responsible for creating a numeric x-axis for a chart component. The function takes two arguments:\xa0xAxisParams\xa0and\xa0chartType.\xa0xAxisParams\xa0is an object that contains several properties, including\xa0domainNRangeValues,\xa0showRoundOffXTickValues,\xa0xAxistickSize,\xa0tickPadding,\xa0xAxisCount, and\xa0xAxisElement.\xa0chartType\xa0is an enumeration that specifies the type of chart component."]}),"\n",(0,a.jsx)(t.p,{children:(0,a.jsx)(t.strong,{children:"Function arguments:"})}),"\n",(0,a.jsxs)(t.ul,{children:["\n",(0,a.jsxs)(t.li,{children:["xAxisParams\xa0of type\xa0IXAxisParams\xa0which is an object containing the following properties:","\n",(0,a.jsxs)(t.ul,{children:["\n",(0,a.jsx)(t.li,{children:"domainNRangeValues\xa0of type\xa0IDomainNRange\xa0which is an object containing the domain and range values for the x-axis."}),"\n",(0,a.jsx)(t.li,{children:"showRoundOffXTickValues\xa0of type\xa0boolean\xa0which is an optional property that determines whether to round off the x-axis tick values."}),"\n",(0,a.jsx)(t.li,{children:"xAxistickSize\xa0of type\xa0number\xa0which is an optional property that determines the size of the x-axis ticks."}),"\n",(0,a.jsx)(t.li,{children:"tickPadding\xa0of type\xa0number\xa0which is an optional property that determines the padding between the x-axis ticks and the x-axis labels."}),"\n",(0,a.jsx)(t.li,{children:"xAxisCount\xa0of type\xa0number\xa0which is an optional property that determines the number of x-axis ticks."}),"\n",(0,a.jsx)(t.li,{children:"xAxisElement\xa0of type\xa0SVGElement | null\xa0which is an optional property that represents the x-axis element."}),"\n"]}),"\n"]}),"\n",(0,a.jsx)(t.li,{children:"chartType\xa0of type\xa0ChartTypes\xa0which is an enum that represents the type of chart."}),"\n",(0,a.jsx)(t.li,{children:"culture\xa0of type string which is an optional paramter represents the locale into which the numeric x-axis labels will be localized."}),"\n"]}),"\n"]}),"\n"]}),"\n",(0,a.jsx)(t.p,{children:(0,a.jsx)(t.strong,{children:"Working algorithm:"})}),"\n",(0,a.jsxs)(t.ul,{children:["\n",(0,a.jsx)(t.li,{children:"The function first extracts the properties of the\xa0xAxisParams\xa0object using destructuring. The\xa0domainNRangeValues\xa0property is an object that contains the start and end values of the domain and range of the x-axis. The\xa0showRoundOffXTickValues\xa0property is a boolean that specifies whether to round off the tick values of the x-axis. The\xa0xAxistickSize\xa0property is a number that specifies the size of the ticks of the x-axis. The\xa0tickPadding\xa0property is a number that specifies the padding between the ticks and the labels of the x-axis. The\xa0xAxisCount\xa0property is a number that specifies the number of ticks of the x-axis. The\xa0xAxisElement\xa0property is a reference to the DOM node that contains the x-axis of the chart."}),"\n",(0,a.jsx)(t.li,{children:"The function then creates a linear scale for the x-axis using the\xa0d3ScaleLinear\xa0function from the\xa0d3-scale\xa0module. The scale is customized using the\xa0domain\xa0and\xa0range\xa0methods, which set the domain and range of the scale, respectively. If the\xa0showRoundOffXTickValues\xa0property is\xa0true, the\xa0nice\xa0method is called on the scale to round off the tick values of the x-axis."}),"\n",(0,a.jsx)(t.li,{children:"The function then creates a bottom axis for the x-axis using the\xa0d3AxisBottom\xa0function from the\xa0d3-axis\xa0module. The axis is customized using the\xa0tickSize,\xa0tickPadding,\xa0ticks, and\xa0tickFormat\xa0methods. The\xa0tickSize\xa0method sets the size of the ticks of the x-axis. The\xa0tickPadding\xa0method sets the padding between the ticks and the labels of the x-axis. The\xa0ticks\xa0method sets the number of ticks of the x-axis. The\xa0tickFormat\xa0method formats the tick values of the x-axis using the\xa0convertToLocaleString\xa0function and the\xa0culture\xa0parameter."}),"\n",(0,a.jsx)(t.li,{children:"If the\xa0xAxisElement\xa0property is not\xa0null, the axis is rendered on the DOM node using the\xa0call\xa0method of the\xa0d3-selection\xa0module. The\xa0selectAll\xa0method is called on the axis to select all the text elements of the x-axis, and the\xa0attr\xa0method is called to set the\xa0aria-hidden\xa0attribute of the text elements to\xa0true."}),"\n",(0,a.jsx)(t.li,{children:"Finally, the function computes the tick values of the x-axis using the\xa0ticks\xa0and\xa0tickFormat\xa0methods of the scale, and returns an object that contains the x-axis scale and the tick values."}),"\n",(0,a.jsxs)(t.li,{children:[(0,a.jsx)(t.strong,{children:"createStringXAxis():"}),"\xa0This function is responsible for creating a string x-axis for a chart component. The function takes four arguments:\xa0xAxisParams,\xa0tickParams,\xa0dataset, and\xa0culture.\xa0xAxisParams\xa0is an object that contains several properties, including\xa0domainNRangeValues,\xa0xAxisCount,\xa0xAxistickSize,\xa0tickPadding,\xa0xAxisPadding,\xa0xAxisInnerPadding, and\xa0xAxisOuterPadding.\xa0tickParams\xa0is an object that contains several properties, including\xa0tickValues\xa0and\xa0tickFormat.\xa0dataset\xa0is an array of strings that contains the values of the x-axis.\xa0culture\xa0is a string that specifies the locale into which the x-axis labels can be localized."]}),"\n"]}),"\n",(0,a.jsx)(t.p,{children:(0,a.jsx)(t.strong,{children:"Function Arguments:"})}),"\n",(0,a.jsxs)(t.ul,{children:["\n",(0,a.jsx)(t.li,{children:"xAxisParams: An object containing the parameters for the x-axis, including the domain and range values, tick size, tick padding, number of ticks, padding for the inner and outer edges of the axis, and the element to render the axis."}),"\n",(0,a.jsx)(t.li,{children:"tickParams: An object containing the parameters for the ticks on the x-axis, including the tick values and tick format."}),"\n",(0,a.jsx)(t.li,{children:"dataset: An array of strings representing the data points for the x-axis."}),"\n",(0,a.jsx)(t.li,{children:"culture: An optional string representing the culture to use for formatting the tick labels on the x-axis. However, the localization works only if the string can be converted to a numeric value. Otherwise, the x-axis labels remain unlocalized."}),"\n"]}),"\n",(0,a.jsx)(t.p,{children:(0,a.jsx)(t.strong,{children:"Working algorithm:"})}),"\n",(0,a.jsxs)(t.ul,{children:["\n",(0,a.jsxs)(t.li,{children:["\n",(0,a.jsx)(t.p,{children:"The function first extracts the properties of the\xa0xAxisParams\xa0object using destructuring. The\xa0domainNRangeValues\xa0property is an object that contains the start and end values of the domain and range of the x-axis. The\xa0xAxisCount\xa0property is a number that specifies the number of ticks of the x-axis. The\xa0xAxistickSize\xa0property is a number that specifies the size of the ticks of the x-axis. The\xa0tickPadding\xa0property is a number that specifies the padding between the ticks and the labels of the x-axis. The\xa0xAxisPadding\xa0property is a number that specifies the padding between the bars of the chart. The\xa0xAxisInnerPadding\xa0property is a number that specifies the inner padding between the bars of the chart. The\xa0xAxisOuterPadding\xa0property is a number that specifies the outer padding between the bars of the chart."}),"\n"]}),"\n",(0,a.jsxs)(t.li,{children:["\n",(0,a.jsx)(t.p,{children:"The function then creates a band scale for the x-axis using the\xa0d3ScaleBand\xa0function from the\xa0d3-scale\xa0module. The scale is customized using the\xa0domain\xa0and\xa0range\xa0methods, which set the domain and range of the scale, respectively. The\xa0paddingInner\xa0and\xa0paddingOuter\xa0methods are used to set the inner and outer padding between the bars of the chart, respectively."}),"\n"]}),"\n",(0,a.jsxs)(t.li,{children:["\n",(0,a.jsx)(t.p,{children:"The function then creates a bottom axis for the x-axis using the\xa0d3AxisBottom\xa0function from the\xa0d3-axis\xa0module. The axis is customized using the\xa0tickSize,\xa0tickPadding,\xa0ticks, and\xa0tickFormat\xa0methods. The\xa0tickSize\xa0method sets the size of the ticks of the x-axis. The\xa0tickPadding\xa0method sets the padding between the ticks and the labels of the x-axis. The\xa0ticks\xa0method sets the number of ticks of the x-axis. The\xa0tickFormat\xa0method formats the tick values of the x-axis using the\xa0convertToLocaleString\xa0function and the\xa0culture\xa0parameter."}),"\n"]}),"\n",(0,a.jsxs)(t.li,{children:["\n",(0,a.jsx)(t.p,{children:"If the\xa0xAxisParams.xAxisElement\xa0property is not\xa0null, the axis is rendered on the DOM node using the\xa0call\xa0method of the\xa0d3-selection\xa0module. The\xa0selectAll\xa0method is called on the axis to select all the text elements of the x-axis, and the\xa0attr\xa0method is called to set the\xa0aria-hidden\xa0attribute of the text elements to\xa0true."}),"\n"]}),"\n",(0,a.jsxs)(t.li,{children:["\n",(0,a.jsx)(t.p,{children:"Finally, the function computes the tick values of the x-axis using the\xa0tickFormat\xa0method of the axis, and returns an object that contains the x-axis scale and the tick values."}),"\n"]}),"\n",(0,a.jsxs)(t.li,{children:["\n",(0,a.jsxs)(t.p,{children:[(0,a.jsx)(t.strong,{children:"createYAxis():"}),"\xa0In the Vertical bar chart component, the\xa0d3-axis\xa0module is used to create and customize the y-axis of a vertical bar chart. The\xa0createYAxis\xa0function is responsible for creating the y-axis using the\xa0createYAxisForOtherCharts\xa0function. The function takes in several parameters, including\xa0yAxisParams,\xa0isRtl,\xa0axisData, and\xa0useSecondaryYScale. These parameters are used to customize the y-axis, such as setting the tick values, tick format, and tick padding."]}),"\n",(0,a.jsx)(t.p,{children:(0,a.jsx)(t.strong,{children:"Function arguments:"})}),"\n",(0,a.jsxs)(t.ul,{children:["\n",(0,a.jsxs)(t.li,{children:["yAxisParams: An object that contains various parameters related to the y-axis of the chart. It has the following properties:","\n",(0,a.jsxs)(t.ul,{children:["\n",(0,a.jsx)(t.li,{children:"yMinMaxValues: An object that contains the start and end values of the y-axis."}),"\n",(0,a.jsx)(t.li,{children:"yAxisElement: The DOM element that represents the y-axis."}),"\n",(0,a.jsx)(t.li,{children:"yMaxValue: The maximum value of the y-axis."}),"\n",(0,a.jsx)(t.li,{children:"yMinValue: The minimum value of the y-axis."}),"\n",(0,a.jsx)(t.li,{children:"containerHeight: The height of the container that holds the chart."}),"\n",(0,a.jsx)(t.li,{children:"containerWidth: The width of the container that holds the chart."}),"\n",(0,a.jsx)(t.li,{children:"margins: An object that contains the margins of the chart."}),"\n",(0,a.jsx)(t.li,{children:"tickPadding: The padding between the ticks and the axis line."}),"\n",(0,a.jsx)(t.li,{children:"maxOfYVal: The maximum value of the y-axis for area chart and Grouped vertical bar chart."}),"\n",(0,a.jsx)(t.li,{children:"yAxisTickFormat: The format of the y-axis tick labels."}),"\n",(0,a.jsx)(t.li,{children:"yAxisTickCount: The number of ticks on the y-axis."}),"\n",(0,a.jsx)(t.li,{children:"eventAnnotationProps: An object that contains the properties of the event annotation."}),"\n",(0,a.jsx)(t.li,{children:"eventLabelHeight: The height of the event label."}),"\n"]}),"\n"]}),"\n",(0,a.jsx)(t.li,{children:"isRtl: A boolean value that indicates whether the chart is in right-to-left mode."}),"\n",(0,a.jsx)(t.li,{children:"axisData: An object that contains the data related to the axis of the chart."}),"\n",(0,a.jsx)(t.li,{children:"useSecondaryYScale: A boolean value that indicates whether to use a secondary y-axis scale."}),"\n"]}),"\n"]}),"\n"]}),"\n",(0,a.jsx)(t.p,{children:(0,a.jsx)(t.strong,{children:"Working algorithm:"})}),"\n",(0,a.jsxs)(t.ul,{children:["\n",(0,a.jsxs)(t.li,{children:["\n",(0,a.jsx)(t.p,{children:"The function first extracts the necessary parameters from the\xa0yAxisParams\xa0object, such as the\xa0yMinMaxValues, yAxisElement, containerHeight, and containerWidth. It then calculates the final maximum and minimum values for the y-axis, based on the\xa0maxOfYVal, yMaxValue, and yMinValue\xa0parameters."}),"\n"]}),"\n",(0,a.jsxs)(t.li,{children:["\n",(0,a.jsx)(t.p,{children:"The function then prepares the datapoints for the y-axis using the\xa0prepareDatapoints\xa0function, which calculates the tick values based on the maximum and minimum values of the y-axis. It then creates a linear scale for the y-axis using the\xa0d3ScaleLinear\xa0function from the\xa0d3-scale\xa0library."}),"\n"]}),"\n",(0,a.jsxs)(t.li,{children:["\n",(0,a.jsx)(t.p,{children:"The function then creates the y-axis using the\xa0d3AxisLeft\xa0or\xa0d3AxisRight\xa0function from the\xa0d3-axis\xa0library, depending on the\xa0isRtl and useSecondaryYScale\xa0parameters. It sets the tick padding, tick values, and tick size for the y-axis, and formats the tick labels using the\xa0yAxisTickFormat\xa0parameter."}),"\n"]}),"\n",(0,a.jsxs)(t.li,{children:["\n",(0,a.jsx)(t.p,{children:"Finally, the function uses the d3Select function to select the\xa0yAxisElement\xa0and apply the y-axis to it using the call method. It also sets the aria-hidden attribute of the y-axis text elements to true to improve accessibility."}),"\n"]}),"\n",(0,a.jsxs)(t.li,{children:["\n",(0,a.jsxs)(t.p,{children:[(0,a.jsx)(t.strong,{children:"createStringYAxis():"}),"\xa0In the Vertical bar chart component, the\xa0d3-axis\xa0module is used to create and customize the y-axis of a vertical bar chart. The\xa0createStringYAxis\xa0function is responsible for creating the y-axis that use string values for the y-axis using the\xa0createStringYAxisForOtherCharts\xa0function. The function takes in several parameters, including\xa0yAxisParams, dataPoints, and isRtl. These parameters are used to customize the y-axis, such as setting the tick values, tick format, and tick padding."]}),"\n",(0,a.jsx)(t.p,{children:(0,a.jsx)(t.strong,{children:"Function arguments:"})}),"\n",(0,a.jsxs)(t.ul,{children:["\n",(0,a.jsx)(t.li,{children:"yAxisParams: An object that contains the parameters for the y-axis, including\xa0containerHeight,\xa0tickPadding,\xa0margins,\xa0yAxisTickFormat,\xa0yAxisElement, and\xa0yAxisPadding."}),"\n",(0,a.jsx)(t.li,{children:"dataPoints: An array of strings that represent the data points for the y-axis."}),"\n",(0,a.jsx)(t.li,{children:"isRtl: A boolean value that indicates whether the chart is in right-to-left mode."}),"\n"]}),"\n"]}),"\n"]}),"\n",(0,a.jsx)(t.p,{children:(0,a.jsx)(t.strong,{children:"Working algorithm:"})}),"\n",(0,a.jsxs)(t.ul,{children:["\n",(0,a.jsx)(t.li,{children:"The function first extracts the necessary parameters from the\xa0yAxisParams\xa0object, such as the\xa0containerHeight,\xa0margins,\xa0yAxisTickFormat,\xa0yAxisElement, and\xa0yAxisPadding. It then creates a band scale for the y-axis using the\xa0d3ScaleBand\xa0function from the\xa0d3-scale\xa0library."}),"\n",(0,a.jsx)(t.li,{children:"The band scale is defined using the\xa0dataPoints\xa0array as the domain, and the\xa0containerHeight\xa0and\xa0margins\xa0parameters as the range. The\xa0padding\xa0method is used to set the padding between the bands in the y-axis."}),"\n",(0,a.jsx)(t.li,{children:"The function then creates the y-axis using the\xa0d3AxisLeft\xa0or\xa0d3AxisRight\xa0function from the\xa0d3-axis\xa0library, depending on the\xa0isRtl\xa0parameter. It sets the tick padding, tick values, and tick size for the y-axis, and formats the tick labels using the\xa0yAxisTickFormat\xa0parameter."}),"\n",(0,a.jsx)(t.li,{children:"Finally, the function uses the\xa0d3Select\xa0function to select the\xa0yAxisElement\xa0and apply the y-axis to it using the\xa0call\xa0method. It also selects all the text elements of the y-axis and returns the y-axis scale."}),"\n",(0,a.jsxs)(t.li,{children:[(0,a.jsx)(t.strong,{children:"Bars:"}),"\n",(0,a.jsxs)(t.ul,{children:["\n",(0,a.jsxs)(t.li,{children:["\n",(0,a.jsxs)(t.p,{children:[(0,a.jsx)(t.strong,{children:"Numeric bars (_createNumericBars()):"}),"\xa0This method is responsible for generating the vertical bars for the chart when the x-axis is a numeric axis. The bars are generated using the d3 library, which provides several functions for creating and manipulating SVG elements."]}),"\n",(0,a.jsx)(t.p,{children:(0,a.jsx)(t.strong,{children:"Function arguments:"})}),"\n",(0,a.jsxs)(t.ul,{children:["\n",(0,a.jsx)(t.li,{children:"containerHeight\xa0- a number representing the height of the container in which the chart is rendered."}),"\n",(0,a.jsx)(t.li,{children:"containerWidth\xa0- a number representing the width of the container in which the chart is rendered."}),"\n",(0,a.jsx)(t.li,{children:"xElement\xa0- an SVGElement representing the x-axis element of the chart."}),"\n"]}),"\n"]}),"\n"]}),"\n"]}),"\n"]}),"\n",(0,a.jsx)(t.p,{children:(0,a.jsx)(t.strong,{children:"Working algorithm:"})}),"\n",(0,a.jsxs)(t.ul,{children:["\n",(0,a.jsxs)(t.li,{children:["\n",(0,a.jsx)(t.p,{children:"The\xa0_createNumericBars\xa0method takes several arguments, including\xa0containerHeight, containerWidth, and xElement. These arguments are used to define the dimensions of the chart and to create the x-axis scale."}),"\n"]}),"\n",(0,a.jsxs)(t.li,{children:["\n",(0,a.jsx)(t.p,{children:"The method first extracts several props from the props object, including\xa0useSingleColor, which determines whether all bars should be the same color, and\xa0xBarScale\xa0and\xa0yBarScale, which are the x and y scales for the chart. It also creates a color scale using the\xa0_createColors\xa0method, which generates a range of colors based on the number of data points."}),"\n"]}),"\n",(0,a.jsxs)(t.li,{children:["\n",(0,a.jsx)(t.p,{children:"The method then iterates over each data point in the\xa0_points\xa0array and generates a vertical bar for each point. It first checks whether the bar should be highlighted based on the legend or whether any legend is highlighted. It then generates a class name for the bar using the\xa0getClassNames\xa0function, which applies styles based on the theme and whether the bar should be highlighted."}),"\n"]}),"\n",(0,a.jsxs)(t.li,{children:["\n",(0,a.jsx)(t.p,{children:"The height of the bar is determined by the\xa0yBarScale\xa0function, which maps the y-value of the data point to the chart dimensions. If the height of the bar is less than 1, the method returns an empty\xa0React.Fragment\xa0element."}),"\n"]}),"\n",(0,a.jsxs)(t.li,{children:["\n",(0,a.jsx)(t.p,{children:"The method then calculates the x and y positions of the bar using the\xa0xBarScale\xa0and\xa0yBarScale\xa0functions, respectively. It generates a rect element for the bar and sets its attributes, including the\xa0x, y, width, height, and fill\xa0attributes. It also sets several event handlers for the bar, including\xa0onClick, onMouseOver, onMouseLeave, onFocus, and onBlur, which are used to display the callout and tooltip for the bar."}),"\n"]}),"\n",(0,a.jsxs)(t.li,{children:["\n",(0,a.jsx)(t.p,{children:"Finally, the method returns an array of\xa0g\xa0elements that contain the\xa0rect\xa0elements for each bar. It also removes any unwanted tooltip\xa0divs\xa0from the DOM and displays the tooltip at the x-axis labels if the\xa0showXAxisLablesTooltip\xa0prop is set to\xa0true."}),"\n"]}),"\n",(0,a.jsxs)(t.li,{children:["\n",(0,a.jsxs)(t.p,{children:[(0,a.jsx)(t.strong,{children:"String bars (_createStringBars()):"}),"\xa0This method is responsible for generating the vertical bars for the chart when the x-axis is a categorical axis. The bars are generated using the d3 library, which provides several functions for creating and manipulating SVG elements."]}),"\n",(0,a.jsx)(t.p,{children:(0,a.jsx)(t.strong,{children:"Function arguments:"})}),"\n",(0,a.jsxs)(t.ul,{children:["\n",(0,a.jsx)(t.li,{children:"containerHeight\xa0(number): The height of the container in which the chart is rendered."}),"\n",(0,a.jsx)(t.li,{children:"containerWidth\xa0(number): The width of the container in which the chart is rendered."}),"\n",(0,a.jsx)(t.li,{children:"xElement\xa0(SVGElement): The SVG element that represents the x-axis of the chart."}),"\n"]}),"\n"]}),"\n"]}),"\n",(0,a.jsx)(t.p,{children:(0,a.jsx)(t.strong,{children:"Working algorithm:"})}),"\n",(0,a.jsxs)(t.ul,{children:["\n",(0,a.jsx)(t.li,{children:"The\xa0_createStringBars\xa0method takes several arguments, including\xa0containerHeight, containerWidth, and xElement. These arguments are used to define the dimensions of the chart and to create the x-axis scale."}),"\n",(0,a.jsx)(t.li,{children:"The method first extracts several props from the props object, including\xa0xBarScale\xa0and\xa0yBarScale, which are the x and y scales for the chart, and\xa0colorScale, which is a color scale generated using the\xa0_createColors\xa0method. It also generates a\xa0React.Fragment\xa0element for any bars that have a height less than 1."}),"\n",(0,a.jsx)(t.li,{children:"The method then iterates over each data point in the\xa0_points\xa0array and generates a vertical bar for each point. It first calculates the height of the bar using the\xa0yBarScale\xa0function, which maps the y-value of the data point to the chart dimensions. If the height of the bar is less than 1, the method returns an empty\xa0React.Fragment\xa0element."}),"\n",(0,a.jsx)(t.li,{children:"The method then calculates the x and y positions of the bar using the\xa0xBarScale\xa0and\xa0yBarScale\xa0functions, respectively. It generates a rect element for the bar and sets its attributes, including the\xa0x, y, width, height, and fill\xa0attributes. It also sets several event handlers for the bar, including\xa0onClick, onMouseOver, onMouseLeave, onFocus, and onBlur, which are used to display the callout and tooltip for the bar."}),"\n",(0,a.jsx)(t.li,{children:"Finally, the method returns an array of\xa0g\xa0elements that contain the\xa0rect\xa0elements for each bar. It also removes any unwanted tooltip\xa0divs\xa0from the DOM and displays the tooltip at the x-axis labels if the\xa0showXAxisLablesTooltip\xa0prop is set to\xa0true."}),"\n",(0,a.jsxs)(t.li,{children:[(0,a.jsx)(t.strong,{children:"Lines:"}),"\n",(0,a.jsxs)(t.ul,{children:["\n",(0,a.jsxs)(t.li,{children:["\n",(0,a.jsxs)(t.p,{children:[(0,a.jsx)(t.strong,{children:"_createLine():"}),"\xa0This method is responsible for creating a line chart that can be overlaid on top of the vertical bar chart. The line chart is created using the\xa0d3.line\xa0function, which generates a path element based on an array of data points."]}),"\n",(0,a.jsx)(t.p,{children:(0,a.jsx)(t.strong,{children:"Function arguments:"})}),"\n",(0,a.jsxs)(t.ul,{children:["\n",(0,a.jsx)(t.li,{children:"xScale: A scale function that maps values from the x domain to the x range."}),"\n",(0,a.jsx)(t.li,{children:"yScale: A scale function that maps values from the y domain to the y range."}),"\n",(0,a.jsx)(t.li,{children:"containerHeight: The height of the container element that the chart is rendered in."}),"\n",(0,a.jsx)(t.li,{children:"containerWidth: The width of the container element that the chart is rendered in."}),"\n",(0,a.jsx)(t.li,{children:"yScaleSecondary: An optional scale function that maps values from the secondary y domain to the secondary y range. This is used when the chart has a secondary y axis."}),"\n"]}),"\n"]}),"\n"]}),"\n"]}),"\n"]}),"\n",(0,a.jsx)(t.p,{children:(0,a.jsx)(t.strong,{children:"Working algorithm:"})}),"\n",(0,a.jsxs)(t.ul,{children:["\n",(0,a.jsx)(t.li,{children:"The\xa0_createLine\xa0method takes several arguments, including\xa0xScale, yScale, containerHeight, containerWidth, and yScaleSecondary. These arguments are used to define the scales and dimensions of the chart, as well as to extract the data needed to create the line chart."}),"\n",(0,a.jsx)(t.li,{children:"The method first checks whether the x-axis is a numeric axis or a categorical axis, and then creates the necessary scales and color scales based on this information. It then extracts the data points from the data prop that have a\xa0lineData\xa0property, which contains the y-value for each point on the line chart."}),"\n",(0,a.jsx)(t.li,{children:"The method then creates a\xa0linePath\xa0function using the\xa0d3.line\xa0function, which maps the x and y values of each data point to the chart dimensions using the\xa0xScale\xa0and\xa0yScale\xa0functions. If a\xa0yScaleSecondary\xa0function is provided, it is used instead of\xa0yScale\xa0for data points that have a\xa0useSecondaryYScale\xa0property set to true."}),"\n",(0,a.jsx)(t.li,{children:"The method then creates a line array that contains two path elements: one for the line itself, and one for the line border. The line element has a stroke color that is set to the\xa0lineLegendColor\xa0prop, which defaults to yellow. The\xa0lineBorder\xa0element has a white stroke color and a width that is determined by the\xa0lineBorderWidth\xa0prop."}),"\n",(0,a.jsx)(t.li,{children:"Finally, the method creates a dots array that contains a circle element for each data point on the line chart. These circles have a white fill color and a stroke color that matches the\xa0lineLegendColor\xa0prop. They also have a visibility property that is set to show if the data point is currently active and hide otherwise."}),"\n",(0,a.jsxs)(t.li,{children:[(0,a.jsx)(t.strong,{children:"Legends:"}),"\n",(0,a.jsxs)(t.ul,{children:["\n",(0,a.jsxs)(t.li,{children:["\n",(0,a.jsxs)(t.p,{children:[(0,a.jsx)(t.strong,{children:"_getLegendData():"}),"\xa0This method is responsible for generating the legend for the chart, which displays the color and label for each data point on the chart. The legend is generated using the Legends component, which is a reusable component that displays a list of legends with customizable styles and behaviors."]}),"\n",(0,a.jsx)(t.p,{children:(0,a.jsx)(t.strong,{children:"Function arguments:"})}),"\n",(0,a.jsxs)(t.ul,{children:["\n",(0,a.jsx)(t.li,{children:"data: an array of\xa0IVerticalBarChartDataPoint\xa0objects, which contain the data points for the chart."}),"\n",(0,a.jsx)(t.li,{children:"palette: an object of type\xa0IPalette, which contains the color palette to be used for the chart."}),"\n"]}),"\n"]}),"\n"]}),"\n"]}),"\n"]}),"\n",(0,a.jsx)(t.p,{children:(0,a.jsx)(t.strong,{children:"Working algorithm:"})}),"\n",(0,a.jsxs)(t.ul,{children:["\n",(0,a.jsx)(t.li,{children:"The\xa0_getLegendData\xa0method takes two arguments,\xa0data and palette, which are arrays of data points and a color palette, respectively. It also extracts several props from the props object, including\xa0theme, useSingleColor, lineLegendText, and lineLegendColor. These props are used to determine the color and label for each legend item."}),"\n",(0,a.jsx)(t.li,{children:"The method then iterates over each data point in the data array and generates a legend item for each point. It first calculates the color of the legend item using the color property of the data point, or by generating a new color using the\xa0_createColors\xa0method if no color is defined. It then creates a new object called legend that contains the title, color, and several event handlers for the legend item. These event handlers are used to handle mouse events on the legend item, such as clicking, hovering, and leaving."}),"\n",(0,a.jsx)(t.li,{children:"The method then adds the legend object to an array called actions, which is used to store all of the legend items for the chart. If the chart includes a line chart and the\xa0lineLegendText\xa0and\xa0lineLegendColor\xa0props are defined, the method adds a new legend item to the beginning of the actions array that represents the line chart. This legend item includes the\xa0lineLegendText\xa0and\xa0lineLegendColor\xa0props, as well as an additional property called\xa0isLineLegendInBarChart, which is used to style the legend item differently from the other legend items."}),"\n",(0,a.jsx)(t.li,{children:"Finally, the method returns a\xa0Legends\xa0component that displays the legend items in a list. The\xa0Legends\xa0component takes several props that are used to customize the styles and behaviors of the legend items, including\xa0enabledWrapLines, overflowProps, focusZonePropsInHoverCard, and overflowText."}),"\n",(0,a.jsxs)(t.li,{children:[(0,a.jsx)(t.strong,{children:"Callouts:"}),"\n",(0,a.jsxs)(t.ul,{children:["\n",(0,a.jsxs)(t.li,{children:[(0,a.jsx)(t.strong,{children:"_getCalloutContentForLineAndBar():"}),"\xa0This method is responsible for generating the content that is displayed in the callout when the user hovers over a data point on the chart. The callout content includes the y-values for both the vertical bar and the line chart, as well as any associated callout data."]}),"\n"]}),"\n"]}),"\n"]}),"\n",(0,a.jsx)(t.p,{children:(0,a.jsx)(t.strong,{children:"Working algorithm:"})}),"\n",(0,a.jsxs)(t.ul,{children:["\n",(0,a.jsx)(t.li,{children:"The\xa0_getCalloutContentForLineAndBar\xa0method takes a single argument, point, which is an object that contains the x and y values for the data point that the user is hovering over. The method first initializes an empty array called\xa0YValueHover, which will be used to store the y-values and callout data for the vertical bar and line chart."}),"\n",(0,a.jsx)(t.li,{children:"The method then extracts several props from the props object, including data,\xa0lineLegendText, and\xa0lineLegendColor. It uses these props to filter the data array and find the data point that matches the x-value of the hovered point. If the chart includes a line chart and the selected data point has a\xa0lineData\xa0property with a defined y-value, the method adds a new object to the\xa0YValueHover\xa0array that contains the y-value and callout data for the line chart. This object also includes the legend text and color for the line chart, which are defined by the\xa0lineLegendText\xa0and\xa0lineLegendColor\xa0props."}),"\n",(0,a.jsx)(t.li,{children:"The method then adds a second object to the\xa0YValueHover\xa0array that contains the y-value and callout data for the vertical bar. This object includes the legend text, y-value, and color for the vertical bar, as well as any associated callout data. The color of the vertical bar is determined by the color property of the selected data point, or by generating a new color using the\xa0_createColors\xa0method if no color is defined."}),"\n",(0,a.jsx)(t.li,{children:"Finally, the method returns an object that contains the\xa0YValueHover\xa0array and the x-value of the hovered point. The x-value is determined by the\xa0xAxisCalloutData\xa0property of the selected data point, or by using the x-value of the point if no\xa0xAxisCalloutData\xa0is defined."}),"\n",(0,a.jsxs)(t.li,{children:[(0,a.jsx)(t.strong,{children:"Bar labels:"}),"\n",(0,a.jsxs)(t.ul,{children:["\n",(0,a.jsxs)(t.li,{children:["\n",(0,a.jsxs)(t.p,{children:[(0,a.jsx)(t.strong,{children:"_renderBarLabel():"}),"\xa0This method is responsible for rendering the labels for the bars in the chart component. The method takes three arguments:\xa0xPoint, yPoint, and barValue.\xa0xPoint\xa0and\xa0yPoint\xa0are the x and y positions of the bar, respectively, and\xa0barValue\xa0is the value of the bar."]}),"\n",(0,a.jsx)(t.p,{children:(0,a.jsx)(t.strong,{children:"Working algorithm:"})}),"\n",(0,a.jsxs)(t.ul,{children:["\n",(0,a.jsx)(t.li,{children:"The method first checks if the\xa0hideLabels\xa0prop is set to true or if the width of the bar is less than\xa016 pixels. If either of these conditions is\xa0true, the method returns\xa0null, which means that no label is rendered for the bar."}),"\n",(0,a.jsx)(t.li,{children:"If the\xa0hideLabels\xa0prop is false and the width of the bar is greater than or equal to\xa016 pixels, the method returns a text element that represents the label for the bar. The\xa0text\xa0element is positioned at the center of the bar using the\xa0xPoint\xa0and\xa0yPoint\xa0arguments. The\xa0textAnchor\xa0attribute is set to middle, which centers the text horizontally. The\xa0className\xa0attribute is set to a CSS class that is used to style the label. The\xa0aria-hidden\xa0attribute is set to true, which means that the label is hidden from screen readers."}),"\n",(0,a.jsx)(t.li,{children:"The content of the\xa0text\xa0element is generated using the\xa0d3FormatPrefix\xa0function from the\xa0d3-format\xa0module. The\xa0d3FormatPrefix\xa0function formats the\xa0barValue\xa0argument using a prefix notation that rounds the value to two decimal places if the value is less than\xa01000, or to one decimal place if the value is greater than or equal to\xa01000. The formatted value is then appended to the text element as its content."}),"\n"]}),"\n"]}),"\n"]}),"\n"]}),"\n",(0,a.jsxs)(t.li,{children:[(0,a.jsx)(t.strong,{children:"Ticks:"}),"\n",(0,a.jsxs)(t.ul,{children:["\n",(0,a.jsxs)(t.li,{children:["\n",(0,a.jsxs)(t.p,{children:[(0,a.jsx)(t.strong,{children:"Rotated x-axis ticks (rotateXAxisLabels()):"}),"\xa0This function is responsible for rotating the labels of the x-axis of a chart component. The function takes an object called\xa0rotateLabelProps\xa0as an argument, which contains two properties:\xa0node\xa0and\xa0xAxis.\xa0node\xa0is a reference to the DOM node that contains the chart component, and\xa0xAxis\xa0is a reference to the x-axis of the chart."]}),"\n",(0,a.jsx)(t.p,{children:(0,a.jsx)(t.strong,{children:"Working algorithm:"})}),"\n",(0,a.jsxs)(t.ul,{children:["\n",(0,a.jsx)(t.li,{children:"The function first checks if either\xa0node\xa0or\xa0xAxis\xa0is\xa0null."}),"\n",(0,a.jsx)(t.li,{children:"If either of these values is\xa0null, the function returns\xa0undefined, which means that no rotation is performed."}),"\n",(0,a.jsx)(t.li,{children:"The function then initializes a variable called\xa0maxHeight\xa0to 0 and an array called\xa0xAxisTranslations\xa0to store the x-axis translations. It uses\xa0d3Select\xa0to select the chart node and call the x-axis function. It then selects all the tick elements and loops through them. For each tick element, the function checks whether it has already been rotated. If it hasn't, the function extracts the x-axis translation value and pushes it to the\xa0xAxisTranslations\xa0array. The function then sets the\xa0transform\xa0attribute of the tick element to translate it by the x-axis translation value and rotate it by\xa0-45\xa0degrees. The function also computes the height of the tick element and stores it in the\xa0maxHeight\xa0variable if it's greater than the current\xa0maxHeight."}),"\n",(0,a.jsx)(t.li,{children:"The function then loops through the tick elements again and sets their\xa0transform\xa0attribute to translate them by the corresponding x-axis translation value, translate them vertically by half of the\xa0maxHeight, and rotate them by\xa0-45\xa0degrees."}),"\n",(0,a.jsx)(t.li,{children:"Finally, the function returns the vertical height of the labels by computing\xa0maxHeight/tanInverse(45)."}),"\n"]}),"\n"]}),"\n"]}),"\n"]}),"\n",(0,a.jsxs)(t.li,{children:[(0,a.jsx)(t.strong,{children:"Rendering details"}),"\nThe Vertical bar chart uses d3 SVG based rendering, which follows the following render cycles:","\n",(0,a.jsx)(t.pre,{children:(0,a.jsx)(t.code,{children:"- Invocation cycle: Vertical bar Chart -> Cartesian base chart -> X-axis -> X-axis labels -> Y-axis -> Y-axis labels -> bars, legends, callouts\n- Rendering cycle: Vertical bar chart <- Bars (rect), lines (d3.line), Legends, Callouts <- Axes (d3.axis, d3.scale)\n"})}),"\n"]}),"\n"]}),"\n",(0,a.jsx)(t.p,{children:(0,a.jsx)(t.strong,{children:"Following are the detailed steps:"})}),"\n",(0,a.jsxs)(t.ol,{children:["\n",(0,a.jsx)(t.li,{children:"The\xa0VerticalBarChart\xa0component renders a vertical bar chart with optional line chart overlay. The chart is rendered using D3.js and SVG elements. The chart can be customized with various props, including data points, axis labels, legend, colors, and more."}),"\n",(0,a.jsx)(t.li,{children:"The chart is rendered within an SVG element with a specified width and height. The chart is composed of several elements, including the x-axis, y-axis, bars, and line chart. The x-axis and y-axis are rendered using D3.js axis functions, and the bars and line chart are rendered using D3.js scales and data binding."}),"\n",(0,a.jsx)(t.li,{children:"The chart data is passed in as an array of\xa0IVerticalBarChartDataPoint\xa0objects, which contain x and y values, a legend label, and an optional color. The chart can also display a line chart overlay, which is passed in as an array of\xa0IVerticalBarChartDataPoint\xa0objects with an additional\xa0lineData\xa0property."}),"\n",(0,a.jsx)(t.li,{children:"The legend is rendered using the\xa0Legends\xa0component, which is passed an array of\xa0ILegend\xa0objects. The chart can also display callout labels for each bar, which are rendered using SVG\xa0text\xa0elements."}),"\n",(0,a.jsx)(t.li,{children:"The chart can be customized with various props, including\xa0barWidth,\xa0colors,\xa0theme,\xa0lineLegendText,\xa0yAxisTickCount, and more. The chart also supports accessibility features, including aria labels and keyboard navigation."}),"\n"]}),"\n",(0,a.jsxs)(t.ul,{children:["\n",(0,a.jsxs)(t.li,{children:["\n",(0,a.jsxs)(t.p,{children:[(0,a.jsx)(t.strong,{children:"Error scenarios"}),"\nThe Vertical bar chart handles the following error scenario:"]}),"\n",(0,a.jsxs)(t.ul,{children:["\n",(0,a.jsx)(t.li,{children:"Empty data: If the data passed to the chart component is empty, the chart will not render and a message will be narrated to the user.\xa0_isChartEmpty\xa0functions handles that scenario."}),"\n"]}),"\n"]}),"\n",(0,a.jsxs)(t.li,{children:["\n",(0,a.jsxs)(t.p,{children:[(0,a.jsx)(t.strong,{children:"Localization aspects"}),"\nThe component has a\xa0culture\xa0prop, which is used to set the culture for the chart. This prop is used to format the x-axis labels and the callout values based on the specified culture. Currently, vertical bar chart provides localization only for the x-axis ticks if they are numbers."]}),"\n"]}),"\n",(0,a.jsxs)(t.li,{children:["\n",(0,a.jsxs)(t.p,{children:[(0,a.jsx)(t.strong,{children:"Testing"}),"\nThe manual and component tests for Vertical bar chart has been completed and unit testing are in progress. Following is the current code coverage for Vertical bar chart:"]}),"\n",(0,a.jsx)(t.p,{children:(0,a.jsx)(t.img,{alt:"VerticalBarChart3.png",src:n(2521).Z+"",width:"2475",height:"537"})}),"\n"]}),"\n"]}),"\n",(0,a.jsxs)(t.ol,{children:["\n",(0,a.jsxs)(t.li,{children:["Component Tests:","\n",(0,a.jsxs)(t.ol,{children:["\n",(0,a.jsxs)(t.li,{children:["Work item ",(0,a.jsx)(t.a,{href:"https://uifabric.visualstudio.com/iss/_workitems/edit/7435",children:"7435"})]}),"\n",(0,a.jsxs)(t.li,{children:["Test plan:\xa0",(0,a.jsx)(t.a,{href:"https://github.com/microsoft/fluentui/blob/master/packages/react-charting/docs/TestPlans/VerticalBarChart/ComponentTests.md",children:"https://github.com/microsoft/fluentui/blob/master/packages/react-charting/docs/TestPlans/VerticalBarChart/ComponentTests.md"}),"\xa0"]}),"\n"]}),"\n"]}),"\n",(0,a.jsxs)(t.li,{children:["Unit Tests:","\n",(0,a.jsxs)(t.ol,{children:["\n",(0,a.jsxs)(t.li,{children:["Work item ",(0,a.jsx)(t.a,{href:"https://uifabric.visualstudio.com/iss/_workitems/edit/7436",children:"7436"})]}),"\n"]}),"\n"]}),"\n",(0,a.jsxs)(t.li,{children:["Manual Tests:","\n",(0,a.jsxs)(t.ol,{children:["\n",(0,a.jsxs)(t.li,{children:["Work item ",(0,a.jsx)(t.a,{href:"https://uifabric.visualstudio.com/iss/_workitems/edit/8604",children:"8604"})]}),"\n"]}),"\n"]}),"\n",(0,a.jsxs)(t.li,{children:["Accessibility Tests:","\n",(0,a.jsxs)(t.ol,{children:["\n",(0,a.jsxs)(t.li,{children:["Work item ",(0,a.jsx)(t.a,{href:"https://uifabric.visualstudio.com/iss/_workitems/edit/7434",children:"7434"})]}),"\n"]}),"\n"]}),"\n"]}),"\n",(0,a.jsxs)(t.ul,{children:["\n",(0,a.jsxs)(t.li,{children:[(0,a.jsx)(t.strong,{children:"Accessibility"}),"\nVertical bar chart is tested for fast pass accessibility.\nLink to the ",(0,a.jsx)(t.a,{href:"https://accessibilityinsights.io/docs/web/getstarted/fastpass/",children:"FAST pass tool"}),"\nOur charts have elaborate accessibility support. The charts are WCAG 2.1 MAS C compliant for accessibility.\nConsumers can define their own aria labels for each point by setting the\xa0callOutAccessibilityData\xa0property."]}),"\n",(0,a.jsxs)(t.li,{children:[(0,a.jsx)(t.strong,{children:"Theming"}),'\nThe palette for vertical bar chart is set from the "theme" prop as passed to the component during rendering. Both light and dark themes are supported and users can create there own theme too.\xa0',(0,a.jsx)(t.a,{href:"https://github.com/microsoft/fluentui/wiki/Theming",children:"Ref6"}),"\xa0\xa0and\xa0",(0,a.jsx)(t.a,{href:"https://github.com/microsoft/fluentui/wiki/How-to-apply-theme-to-Fluent-UI-React-components",children:"Ref7"}),"\xa0\xa0explains theming in detail."]}),"\n",(0,a.jsxs)(t.li,{children:[(0,a.jsx)(t.strong,{children:"Debugging"}),"\nThe detailed steps on debugging has been given in\xa0",(0,a.jsx)(t.a,{href:"https://github.com/microsoft/fluentui-charting-contrib/blob/main/docs/Debugging.md",children:"Debugging"}),"."]}),"\n",(0,a.jsxs)(t.li,{children:[(0,a.jsx)(t.strong,{children:"Variants"}),"\nFollowing are the variants of vertical bar chart:\xa0",(0,a.jsx)(t.a,{href:"https://developer.microsoft.com/en-us/fluentui#/controls/web/verticalbarchart",children:"Ref8"}),"\n",(0,a.jsxs)(t.ul,{children:["\n",(0,a.jsxs)(t.li,{children:[(0,a.jsx)(t.em,{children:"Basic Vertical bar Chart"}),": Only basic props are provided."]}),"\n",(0,a.jsxs)(t.li,{children:[(0,a.jsx)(t.em,{children:"Dynamic Vertical bar Chart"}),": The data and bar colors can change."]}),"\n",(0,a.jsxs)(t.li,{children:[(0,a.jsx)(t.em,{children:"Custom Callout"}),": Can show customized callout data."]}),"\n",(0,a.jsxs)(t.li,{children:[(0,a.jsx)(t.em,{children:"Custom Accessibility"}),": Providing custom aria labels."]}),"\n",(0,a.jsxs)(t.li,{children:[(0,a.jsx)(t.em,{children:"Styled"}),": Can show bars with a single color w/o line."]}),"\n",(0,a.jsxs)(t.li,{children:[(0,a.jsx)(t.em,{children:"Rotated labels"}),": Can show labels rotated in -45 degrees."]}),"\n",(0,a.jsxs)(t.li,{children:[(0,a.jsx)(t.em,{children:"Tooltip"}),": Can show tooltip over x-axis ticks when the ticks are truncated."]}),"\n"]}),"\n"]}),"\n",(0,a.jsxs)(t.li,{children:[(0,a.jsx)(t.strong,{children:"Interaction"}),"\nFollowing are the interactions that are allowed for vertical bar chart:","\n",(0,a.jsxs)(t.ul,{children:["\n",(0,a.jsxs)(t.li,{children:[(0,a.jsx)(t.em,{children:"Mouse Events"}),":\na. Hover mouse over a bar, should call the corresponding handler and show the callout over that bar.\nb. On mouse move on Bar 1 (step 1) -> mouse leave (step 2) -> mouse move on Bar 2 (step 3), should render the callout of the Bar 2.\nc. On mouse over, callout should be defined, on mouse leave, callout should disappear.\nd. On mouse over on legends, should highlight the corresponding bar/line.\nf. On click on Bar, should highlight the corresponding bar.\ng. On mouse out after mouse over on first legend, should have opacity 0.1 for second bar initially (during mouseOver on first legend) and opacity set to 1 for both the bars on mouse out."]}),"\n",(0,a.jsxs)(t.li,{children:[(0,a.jsx)(t.em,{children:"Keyboard Events"}),":\na. On focus on a bar, should render the corresponding callout.\nb. On focus on a line, should highlight the corresponding line and its legend."]}),"\n"]}),"\n"]}),"\n",(0,a.jsxs)(t.li,{children:[(0,a.jsx)(t.strong,{children:"Some notable PRs and their brief description"}),"\n",(0,a.jsxs)(t.ul,{children:["\n",(0,a.jsx)(t.li,{children:(0,a.jsx)(t.a,{href:"https://github.com/microsoft/fluentui/pull/4954",children:"Adding the Vertical bar chart main component"})}),"\n",(0,a.jsx)(t.li,{children:(0,a.jsx)(t.a,{href:"https://github.com/microsoft/fluentui/commit/562ce21022cb4b5b33309a37712965909c7d15bd",children:"Refactoring Vertical Bar Chart via implementation of Cartesian charts"})}),"\n",(0,a.jsx)(t.li,{children:(0,a.jsx)(t.a,{href:"https://github.com/microsoft/fluentui/pull/28013",children:"Adding Tests for Vertical Bar Chart using React Testing Library"})}),"\n",(0,a.jsx)(t.li,{children:(0,a.jsx)(t.a,{href:"https://github.com/microsoft/fluentui/pull/19074",children:"Accessibility change for Vertical Bar Chart"})}),"\n"]}),"\n"]}),"\n",(0,a.jsxs)(t.li,{children:[(0,a.jsx)(t.strong,{children:"Learnings"}),"\n",(0,a.jsxs)(t.ul,{children:["\n",(0,a.jsx)(t.li,{children:"While implementing the tests using react testing library, it was found that certain browser functions like\xa0getComputedTextLength()\xa0cannot be unit tested and needs to be tested End-to-End only."}),"\n",(0,a.jsx)(t.li,{children:"Order of imports are important.\nFor example: for Vertical bar charts tests, improper sequencing of the imports (data first and then render) results in incorrect and incopmlete rendering of charts:"}),"\n"]}),"\n"]}),"\n"]}),"\n",(0,a.jsx)(t.pre,{children:(0,a.jsx)(t.code,{children:" - import { chartPoints } from '../VerticalBarChart/VerticalBarChart.test';\n - import { render, screen, queryAllByAttribute, fireEvent, act } from '@testing- \n - library/react';\n"})}),"\n",(0,a.jsx)(t.p,{children:"However, the following results in correct rendering:"}),"\n",(0,a.jsx)(t.pre,{children:(0,a.jsx)(t.code,{children:"import { render, screen, queryAllByAttribute } from '@testing-library/react';\n\nimport { chartPoints } from './VerticalBarChart.test';\n"})}),"\n",(0,a.jsxs)(t.ul,{children:["\n",(0,a.jsxs)(t.li,{children:["\n",(0,a.jsx)(t.p,{children:"Certain props need async await structure (waitFor in react testing library) for different props or nested SVGs to render."}),"\n"]}),"\n",(0,a.jsxs)(t.li,{children:["\n",(0,a.jsx)(t.p,{children:(0,a.jsx)(t.strong,{children:"Known issues"})}),"\n",(0,a.jsxs)(t.ul,{children:["\n",(0,a.jsx)(t.li,{children:"Setting the margins externally via the props may cut the x and y ticks if the margins provided are very less. Setting a minimum margin would prevent any such distortions."}),"\n"]}),"\n"]}),"\n",(0,a.jsxs)(t.li,{children:["\n",(0,a.jsx)(t.p,{children:(0,a.jsx)(t.strong,{children:"Future improvements"})}),"\n",(0,a.jsx)(t.p,{children:"Following are the list of future improvements for the vertical bar chart:"}),"\n",(0,a.jsxs)(t.ul,{children:["\n",(0,a.jsx)(t.li,{children:"Improved accessibility: While the component already provides accessibility data for screen readers, there is always room for improvement in this area. Adding support for keyboard navigation and improving the accessibility of the callout would make the component more accessible to users with disabilities."}),"\n",(0,a.jsx)(t.li,{children:"Support for animations: Adding support for animations, such as transitions between data updates or hover effects, would make the component more visually appealing and engaging for users."}),"\n",(0,a.jsxs)(t.li,{children:["Following error handling scenarios can be improved:","\n",(0,a.jsxs)(t.ul,{children:["\n",(0,a.jsx)(t.li,{children:"Invalid or missing chart dimensions: If the dimensions of the chart are invalid or missing, the chart will not render and a message will be displayed to the user."}),"\n",(0,a.jsx)(t.li,{children:"Invalid or missing axis parameters: If the parameters for the x-axis or y-axis are invalid or missing, the chart will not render and a message will be displayed to the user."}),"\n",(0,a.jsx)(t.li,{children:"Invalid or missing legends: If the legends for the chart are invalid or missing, the chart will not render and a message will be displayed to the user."}),"\n",(0,a.jsx)(t.li,{children:"Invalid bar width: If the bar width for the chart is invalid, the chart will not render and a message will be displayed to the user."}),"\n",(0,a.jsx)(t.li,{children:"Invalid or missing data for callout: If the data for the callout is invalid or missing, the callout will not render and a message will be displayed to the user."}),"\n",(0,a.jsx)(t.li,{children:"Invalid or missing accessibility data: If the accessibility data for the chart is invalid or missing, the chart will not render and a message will be displayed to the user."}),"\n"]}),"\n"]}),"\n",(0,a.jsx)(t.li,{children:"Localization support can be improved for all strings and numbers."}),"\n"]}),"\n"]}),"\n",(0,a.jsxs)(t.li,{children:["\n",(0,a.jsxs)(t.p,{children:[(0,a.jsx)(t.strong,{children:"Design figma"}),"\nVertical bar Chart Figma:\xa0",(0,a.jsx)(t.a,{href:"https://www.figma.com/file/WOoCs0CmNYZhYl9xXeCGpi/Data-viz-(Archive)?type=design&node-id=21153-80245&mode=design&t=eFKlPGUixdgy9xRs-0",children:"Link"}),"\xa0"]}),"\n"]}),"\n",(0,a.jsxs)(t.li,{children:["\n",(0,a.jsx)(t.p,{children:(0,a.jsx)(t.strong,{children:"Performance"})}),"\n",(0,a.jsx)(t.p,{children:"The performance aspect of a donut chart refers to how efficiently and effectively it conveys information to the viewer. Here are some key considerations regarding the performance of a line chart:"}),"\n",(0,a.jsxs)(t.ul,{children:["\n",(0,a.jsx)(t.li,{children:"Data Visualization Efficiency"}),"\n",(0,a.jsx)(t.li,{children:"Clarity and Simplicity"}),"\n",(0,a.jsx)(t.li,{children:"Responsiveness"}),"\n",(0,a.jsx)(t.li,{children:"Handling Large Datasets"}),"\n",(0,a.jsx)(t.li,{children:"Interactive Features"}),"\n"]}),"\n"]}),"\n"]}),"\n",(0,a.jsx)(t.p,{children:"We use Lighthouse tool for measuring the performance of our charts. Following are few of the scenarios for which we measure the performance score for vertical bar chart:"}),"\n",(0,a.jsxs)(t.ul,{children:["\n",(0,a.jsx)(t.li,{children:(0,a.jsx)(t.strong,{children:"References"})}),"\n"]}),"\n",(0,a.jsxs)(t.ol,{children:["\n",(0,a.jsxs)(t.li,{children:["D3-scale:","\n",(0,a.jsxs)(t.ul,{children:["\n",(0,a.jsx)(t.li,{children:(0,a.jsx)(t.a,{href:"https://github.com/d3/d3-scale/blob/main/README.md",children:"Link 1"})}),"\n",(0,a.jsx)(t.li,{children:(0,a.jsx)(t.a,{href:"https://d3js.org/d3-scale",children:"Link 2"})}),"\n"]}),"\n"]}),"\n",(0,a.jsx)(t.li,{children:(0,a.jsx)(t.a,{href:"https://github.com/d3/d3-shape/blob/main/README.md",children:"D3-shape"})}),"\n",(0,a.jsx)(t.li,{children:(0,a.jsx)(t.a,{href:"https://github.com/d3/d3-selection/blob/main/README.md",children:"D3-selection"})}),"\n",(0,a.jsx)(t.li,{children:(0,a.jsx)(t.a,{href:"https://github.com/d3/d3-array/blob/main/README.md",children:"D3-array"})}),"\n",(0,a.jsx)(t.li,{children:(0,a.jsx)(t.a,{href:"https://github.com/d3/d3-axis/blob/main/README.md",children:"D3-axis"})}),"\n",(0,a.jsx)(t.li,{children:(0,a.jsx)(t.a,{href:"https://github.com/microsoft/fluentui/wiki/How-to-apply-theme-to-Fluent-UI-React-components",children:"How to apply theme"})}),"\n",(0,a.jsx)(t.li,{children:(0,a.jsx)(t.a,{href:"https://github.com/microsoft/fluentui/wiki/Theming",children:"Theming"})}),"\n",(0,a.jsx)(t.li,{children:(0,a.jsx)(t.a,{href:"https://developer.microsoft.com/en-us/fluentui#/controls/web/verticalbarchart",children:"Vertical Bar Chart"})}),"\n"]}),"\n",(0,a.jsx)(t.p,{children:(0,a.jsx)(t.strong,{children:"Appendix:"})}),"\n",(0,a.jsx)(t.p,{children:"The mathematical formulae used in the Vertical bar chart component are as follows:"}),"\n",(0,a.jsxs)(t.ol,{children:["\n",(0,a.jsxs)(t.li,{children:["\n",(0,a.jsxs)(t.p,{children:["Formula for calculating the y scale using d3ScaleLinear:\n",(0,a.jsx)(t.img,{alt:"VBC_f1.png",src:n(8395).Z+"",width:"1566",height:"146"})]}),"\n"]}),"\n",(0,a.jsxs)(t.li,{children:["\n",(0,a.jsx)(t.p,{children:"Formula for calculating the x scale using d3ScaleBand:"}),"\n",(0,a.jsxs)(t.p,{children:["Numeric scale:\n",(0,a.jsx)(t.img,{alt:"VBC_f2.png",src:n(2055).Z+"",width:"1683",height:"353"})]}),"\n",(0,a.jsxs)(t.p,{children:["String scale:\n",(0,a.jsx)(t.img,{alt:"VBC_f3.png",src:n(7493).Z+"",width:"1827",height:"353"})]}),"\n"]}),"\n",(0,a.jsxs)(t.li,{children:["\n",(0,a.jsxs)(t.p,{children:["Formula for calculating the width of each bar:\n",(0,a.jsx)(t.img,{alt:"VBC_f4.png",src:n(2624).Z+"",width:"1154",height:"58"})]}),"\n",(0,a.jsx)(t.p,{children:"In order to maintain 2:1 spacing barWidth is replaced by the maxBandWidth."}),"\n"]}),"\n",(0,a.jsxs)(t.li,{children:["\n",(0,a.jsxs)(t.p,{children:["Formula for calculating the total width required to render the bars:\n",(0,a.jsx)(t.img,{alt:"VBC_f5.png",src:n(8874).Z+"",width:"1730",height:"122"})]}),"\n",(0,a.jsx)(t.pre,{children:(0,a.jsx)(t.code,{children:"MIN_DOMAIN_MARGIN = 8\n"})}),"\n"]}),"\n",(0,a.jsxs)(t.li,{children:["\n",(0,a.jsxs)(t.p,{children:["Formula for calculating the maximum possible bar width to maintain 2:1 spacing:\n",(0,a.jsx)(t.img,{alt:"VBC_f6.png",src:n(3443).Z+"",width:"1832",height:"81"})]}),"\n"]}),"\n",(0,a.jsxs)(t.li,{children:["\n",(0,a.jsxs)(t.p,{children:["Formula for calculating the domain margin\n",(0,a.jsx)(t.img,{alt:"VBC_f7.png",src:n(5e3).Z+"",width:"1454",height:"111"})]}),"\n",(0,a.jsx)(t.pre,{children:(0,a.jsx)(t.code,{children:"_domainMarging = MIN_DOMAIN_MARGIN\nMIN_DOMAIN_MARGIN = 8\n\nTo center align the chart by setting equal left and right margins for domain:\n"})}),"\n"]}),"\n"]})]})}function d(e={}){const{wrapper:t}={...(0,i.a)(),...e.components};return t?(0,a.jsx)(t,{...e,children:(0,a.jsx)(c,{...e})}):c(e)}},5387:(e,t,n)=>{n.d(t,{Z:()=>a});const a=n.p+"assets/images/VBC1-bb6595c22f4de60c6aebc16359482663.png"},2362:(e,t,n)=>{n.d(t,{Z:()=>a});const a=n.p+"assets/images/VBC2-8ab8b2b71a752a09e6160710baaab17a.png"},2521:(e,t,n)=>{n.d(t,{Z:()=>a});const a=n.p+"assets/images/VBC3-0446d2d3c1c321827e398d8ecd1c9057.png"},8395:(e,t,n)=>{n.d(t,{Z:()=>a});const a=n.p+"assets/images/VBC_f1-86ad6759ab4ed50b9f22c761d9645973.png"},2055:(e,t,n)=>{n.d(t,{Z:()=>a});const a=n.p+"assets/images/VBC_f2-2d56c3cf1651669a96c6ba1570f477df.png"},7493:(e,t,n)=>{n.d(t,{Z:()=>a});const a=n.p+"assets/images/VBC_f3-30c3db0ac6ae137e267c52d6b3a43746.png"},2624:(e,t,n)=>{n.d(t,{Z:()=>a});const a=n.p+"assets/images/VBC_f4-ffb3da2424b492b04995aab01fb70afa.png"},8874:(e,t,n)=>{n.d(t,{Z:()=>a});const a=n.p+"assets/images/VBC_f5-5815e87496c11f471d243c808a86a082.png"},3443:(e,t,n)=>{n.d(t,{Z:()=>a});const a=n.p+"assets/images/VBC_f6-12092fc4a1cd14cd8196d102472960ab.png"},5e3:(e,t,n)=>{n.d(t,{Z:()=>a});const a=n.p+"assets/images/VBC_f7-78ec7172b86cb7cd832f6025adad8fef.png"},1151:(e,t,n)=>{n.d(t,{Z:()=>h,a:()=>r});var a=n(7294);const i={},s=a.createContext(i);function r(e){const t=a.useContext(s);return a.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function h(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(i):e.components||i:r(e.components),a.createElement(s.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/5181bfc2.87d8f065.js b/assets/js/5181bfc2.87d8f065.js deleted file mode 100644 index bf03e54def..0000000000 --- a/assets/js/5181bfc2.87d8f065.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkdocsite=self.webpackChunkdocsite||[]).push([[7659],{5417:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>l,contentTitle:()=>a,default:()=>d,frontMatter:()=>r,metadata:()=>o,toc:()=>h});var s=n(5893),i=n(1151);const r={},a="Contributor guide: Stacked Bar Chart",o={id:"Charting-Concepts/StackedBarChart",title:"Contributor guide: Stacked Bar Chart",description:"A stacked bar chart is a type of data visualization that represents data using rectangular bars with lengths proportional to the values they represent. In a stacked bar chart, each bar is divided into segments, and the segments represent different categories or components. The segments are stacked next to each other to show the total value of each bar.",source:"@site/../../docs/Charting-Concepts/StackedBarChart.md",sourceDirName:"Charting-Concepts",slug:"/Charting-Concepts/StackedBarChart",permalink:"/fluentui-charting-contrib/docs/Charting-Concepts/StackedBarChart",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{},sidebar:"tutorialSidebar",previous:{title:"Contributor Guide: Sankey Chart",permalink:"/fluentui-charting-contrib/docs/Charting-Concepts/SankeyChart"},next:{title:"Debugging",permalink:"/fluentui-charting-contrib/docs/Debugging"}},l={},h=[{value:"Use cases",id:"use-cases",level:2},{value:"Dev Design details",id:"dev-design-details",level:2},{value:"Mathematical/Geometrical concepts",id:"mathematicalgeometrical-concepts",level:2},{value:"Performance",id:"performance",level:2},{value:"Accessibility",id:"accessibility",level:2},{value:"Testing",id:"testing",level:2},{value:"Variants",id:"variants",level:2},{value:"Theming",id:"theming",level:2},{value:"Debugging",id:"debugging",level:2},{value:"Error scenarios",id:"error-scenarios",level:2},{value:"Localization aspects",id:"localization-aspects",level:2},{value:"Some notable PRs and their brief description",id:"some-notable-prs-and-their-brief-description",level:2},{value:"Future improvements",id:"future-improvements",level:2},{value:"Rendering details",id:"rendering-details",level:2},{value:"Interactions",id:"interactions",level:2},{value:"Known issues",id:"known-issues",level:2},{value:"Design figma",id:"design-figma",level:2},{value:"Learnings",id:"learnings",level:2},{value:"Extensions",id:"extensions",level:2}];function c(e){const t={a:"a",code:"code",em:"em",h1:"h1",h2:"h2",img:"img",li:"li",ol:"ol",p:"p",strong:"strong",ul:"ul",...(0,i.a)(),...e.components};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(t.h1,{id:"contributor-guide-stacked-bar-chart",children:"Contributor guide: Stacked Bar Chart"}),"\n",(0,s.jsx)(t.p,{children:"A stacked bar chart is a type of data visualization that represents data using rectangular bars with lengths proportional to the values they represent. In a stacked bar chart, each bar is divided into segments, and the segments represent different categories or components. The segments are stacked next to each other to show the total value of each bar."}),"\n",(0,s.jsx)(t.h2,{id:"use-cases",children:"Use cases"}),"\n",(0,s.jsx)(t.p,{children:"Here are some common use cases for stacked bar charts:"}),"\n",(0,s.jsxs)(t.ul,{children:["\n",(0,s.jsx)(t.li,{children:"Tracking Trends Over Time: Show changes in category proportions over time, allowing you to analyze how the distribution of data points evolves."}),"\n",(0,s.jsx)(t.li,{children:"Highlighting Part-to-Whole Relationships: Emphasize the contribution of individual categories to the whole, helping viewers understand the significance of each component."}),"\n",(0,s.jsx)(t.li,{children:"Visualizing Survey Data: Present the distribution of responses in a survey across various answer choices for different questions, providing insights into the survey's results."}),"\n",(0,s.jsx)(t.li,{children:"Resource Allocation: Show how resources, such as budget or time, are allocated among various tasks, projects, or departments within an organization."}),"\n",(0,s.jsx)(t.li,{children:"Market Share Analysis: Illustrate the market share of different companies or products within a specific industry, helping in competitive analysis."}),"\n"]}),"\n",(0,s.jsx)(t.h2,{id:"dev-design-details",children:"Dev Design details"}),"\n",(0,s.jsx)(t.p,{children:"The stacked bar chart comprises the following components and subcomponents:"}),"\n",(0,s.jsxs)(t.p,{children:[(0,s.jsx)(t.strong,{children:"StackedBarChart"}),": This is the main component responsible for rendering and managing subcomponents, such as bar titles, bars, bar labels, benchmark and triangle indicators, and other components. It handles user interactions and provides the overall functionality of the chart."]}),"\n",(0,s.jsxs)(t.p,{children:[(0,s.jsx)(t.strong,{children:"FocusZone"}),": This component facilitates focus navigation within the chart. It allows users to navigate between focusable subcomponents, such as bars and bar segments, using the tab and arrow keys."]}),"\n",(0,s.jsxs)(t.p,{children:[(0,s.jsx)(t.strong,{children:"FocusableTooltipText"}),": This component is used to render a bar title with a tooltip. It monitors the size of the container to detect if the text content overflows. If it does, it truncates the text with ellipsis and enables users to view the tooltip with complete content by focusing or hovering over the element."]}),"\n",(0,s.jsxs)(t.p,{children:[(0,s.jsx)(t.strong,{children:"Legends"}),": Legends are a unique list of strings that identify each bar segment in the chart. The Legends component renders a button for each legend, enabling users to highlight the corresponding segment by hovering over or selecting the legend."]}),"\n",(0,s.jsxs)(t.p,{children:[(0,s.jsx)(t.strong,{children:"Callout"}),": This component functions as an anchored tip, offering additional information about the bar segment that is currently hovered over or focused without blocking the user."]}),"\n",(0,s.jsxs)(t.p,{children:[(0,s.jsx)(t.strong,{children:"ChartHoverCard"}),": This component acts as the body of the callout, presenting relevant details in a well-organized manner."]}),"\n",(0,s.jsxs)(t.p,{children:[(0,s.jsx)(t.strong,{children:"Benchmark & Target indicators"}),": Currently, these indicators are only supported by the stacked bar chart and not the multi-stacked bar chart. They act as visual reference points, making it easier for users to compare bar values to the benchmark/target value."]}),"\n",(0,s.jsx)(t.h2,{id:"mathematicalgeometrical-concepts",children:"Mathematical/Geometrical concepts"}),"\n",(0,s.jsx)(t.p,{children:"All calculations are performed in percentages to ensure the responsiveness of the chart."}),"\n",(0,s.jsxs)(t.ul,{children:["\n",(0,s.jsx)(t.li,{children:"First, the spacing between bar segments is determined as a percentage of the chart's width when the component mounts."}),"\n",(0,s.jsx)(t.li,{children:"The total width required for all the gaps between segments is calculated by multiplying the number of gaps (which is one less than the number of segments) by the width of a single gap, as calculated previously."}),"\n",(0,s.jsx)(t.li,{children:"The sum of widths for each segment is computed, ensuring that even segments with very small values remain visible and accessible to users. This sum is always equal to or greater than 100. In the absolute-scale variant of the multi-stacked bar chart, the width percentage of each segment is calculated against the total value of the longest bar."}),"\n",(0,s.jsx)(t.li,{children:"The total width required for rendering all the segments without any gaps is derived by subtracting the total width of all the gaps from 100. A scale factor is then obtained by dividing the real length (the total width of all segments without gaps) by the scale length (the sum of segment widths). This scale factor is used to calculate the precise width of each segment."}),"\n"]}),"\n",(0,s.jsx)(t.h2,{id:"performance",children:"Performance"}),"\n",(0,s.jsx)(t.h2,{id:"accessibility",children:"Accessibility"}),"\n",(0,s.jsx)(t.p,{children:"The following subcomponents are accessible using a screen reader:"}),"\n",(0,s.jsxs)(t.ol,{children:["\n",(0,s.jsxs)(t.li,{children:["\n",(0,s.jsxs)(t.p,{children:[(0,s.jsx)(t.strong,{children:"Chart title
"}),": It is already accessible to screen readers."]}),"\n"]}),"\n",(0,s.jsxs)(t.li,{children:["\n",(0,s.jsxs)(t.p,{children:[(0,s.jsx)(t.strong,{children:"Chart data
"}),": It is already accessible to screen readers. Users can provide a custom accessible name or description for it using the chartDataAccessibilityData prop."]}),"\n"]}),"\n",(0,s.jsxs)(t.li,{children:["\n",(0,s.jsxs)(t.p,{children:[(0,s.jsx)(t.strong,{children:"Chart "}),": The following attributes provide an accessible label for the bar."]}),"\n",(0,s.jsxs)(t.ul,{children:["\n",(0,s.jsxs)(t.li,{children:[(0,s.jsx)(t.code,{children:"aria-label"})," = the bar title, which is referred to as chartTitle in the component"]}),"\n"]}),"\n"]}),"\n",(0,s.jsxs)(t.li,{children:["\n",(0,s.jsxs)(t.p,{children:[(0,s.jsx)(t.strong,{children:"Bar segment "}),": The following attributes provide an accessible description for the bar segment."]}),"\n",(0,s.jsxs)(t.ul,{children:["\n",(0,s.jsxs)(t.li,{children:[(0,s.jsx)(t.code,{children:"role"}),' = "img"']}),"\n",(0,s.jsxs)(t.li,{children:[(0,s.jsx)(t.code,{children:"aria-label"}),' = "{legend}, {segmentValue}."']}),"\n"]}),"\n",(0,s.jsx)(t.p,{children:"Users can customize this description using the xAxisCalloutData, yAxisCalloutData and callOutAccessibilityData props."}),"\n"]}),"\n",(0,s.jsxs)(t.li,{children:["\n",(0,s.jsxs)(t.p,{children:[(0,s.jsx)(t.strong,{children:"Bar label "}),": The bar labels are limited to the absolute-scale variant of the multi-stacked bar chart. It is already accessible to screen readers, but the content doesn\u2019t convey complete information. The following attributes specify a different accessible name for the bar label."]}),"\n",(0,s.jsxs)(t.ul,{children:["\n",(0,s.jsxs)(t.li,{children:[(0,s.jsx)(t.code,{children:"role"}),' = "img"']}),"\n",(0,s.jsxs)(t.li,{children:[(0,s.jsx)(t.code,{children:"aria-label"}),' = "Total: {barTotalValue}"']}),"\n"]}),"\n"]}),"\n"]}),"\n",(0,s.jsx)(t.h2,{id:"testing",children:"Testing"}),"\n",(0,s.jsx)(t.p,{children:(0,s.jsx)(t.img,{alt:"Test coverage report",src:n(1968).Z+"",width:"3679",height:"1505"})}),"\n",(0,s.jsx)(t.p,{children:(0,s.jsx)(t.a,{href:"/fluentui-charting-contrib/docs/Test%20Plans/StackedBarChart/ComponentTests",children:"StackedBarChart test plan"})}),"\n",(0,s.jsx)(t.h2,{id:"variants",children:"Variants"}),"\n",(0,s.jsx)(t.p,{children:"Here are the props available for customizing the stacked bar chart:"}),"\n",(0,s.jsxs)(t.ul,{children:["\n",(0,s.jsxs)(t.li,{children:["\n",(0,s.jsxs)(t.p,{children:[(0,s.jsx)(t.strong,{children:"data"}),": Use this prop to provide a series of bar data, including colors and values, to populate the chart."]}),"\n"]}),"\n",(0,s.jsxs)(t.li,{children:["\n",(0,s.jsxs)(t.p,{children:[(0,s.jsx)(t.strong,{children:"width"}),": Use this prop to set the width of the chart. If not provided, the chart will occupy the total available width."]}),"\n"]}),"\n",(0,s.jsxs)(t.li,{children:["\n",(0,s.jsxs)(t.p,{children:[(0,s.jsx)(t.strong,{children:"barHeight"}),": Use this prop to set the height of the bars in the chart. If not provided, a default bar height of 12px is used."]}),"\n"]}),"\n",(0,s.jsxs)(t.li,{children:["\n",(0,s.jsxs)(t.p,{children:[(0,s.jsx)(t.strong,{children:"hideDenominator"}),": Use this prop to hide the denominator of the chart data when it is displayed as a fraction/ratio. In the case of the multi-stacked bar chart, it takes an array of booleans with length equal to the number of bars in the chart, where each element determines whether to hide the denominator for the corresponding bar."]}),"\n"]}),"\n",(0,s.jsxs)(t.li,{children:["\n",(0,s.jsxs)(t.p,{children:[(0,s.jsx)(t.strong,{children:"benchmarkData"})," (Stacked): Use this prop to show a benchmark indicator/triangle above the bar."]}),"\n"]}),"\n",(0,s.jsxs)(t.li,{children:["\n",(0,s.jsxs)(t.p,{children:[(0,s.jsx)(t.strong,{children:"targetData"})," (Stacked): Use this prop to show a target indicator/triangle above the bar."]}),"\n"]}),"\n",(0,s.jsxs)(t.li,{children:["\n",(0,s.jsxs)(t.p,{children:[(0,s.jsx)(t.strong,{children:"hideNumberDisplay"})," (Stacked): Use this prop to hide the chart data from above the bar."]}),"\n"]}),"\n",(0,s.jsxs)(t.li,{children:["\n",(0,s.jsxs)(t.p,{children:[(0,s.jsx)(t.strong,{children:"ignoreFixStyle"})," (Stacked): By default, the chart data with a length of 1 is displayed as a number, and a length of 2 is displayed as a fraction/ratio. Use this prop to ignore the default display pattern and hide the chart data, irrespective of its length."]}),"\n"]}),"\n",(0,s.jsxs)(t.li,{children:["\n",(0,s.jsxs)(t.p,{children:[(0,s.jsx)(t.strong,{children:"hideRatio"})," (Multi-Stacked): This prop takes an array of booleans with length equal to the number of bars in the chart, where each element determines whether to hide the chart data for the corresponding bar."]}),"\n"]}),"\n",(0,s.jsxs)(t.li,{children:["\n",(0,s.jsxs)(t.p,{children:[(0,s.jsx)(t.strong,{children:"variant"})," (Multi-Stacked): Select the presentation style of the multi-stacked bar chart from the following options:"]}),"\n",(0,s.jsxs)(t.ul,{children:["\n",(0,s.jsxs)(t.li,{children:[(0,s.jsx)(t.em,{children:"MultiStackedBarChartVariant.PartToWhole"})," (default): In this variant, each bar represents a part or segment of a whole. It is excellent for showing how each category or segment contributes to the total or whole."]}),"\n",(0,s.jsxs)(t.li,{children:[(0,s.jsx)(t.em,{children:"MultiStackedBarChartVariant.AbsoluteScale"}),": In this variant, each bar's length is directly proportional to its absolute value or quantity. It is useful for comparing magnitudes across different categories."]}),"\n"]}),"\n"]}),"\n",(0,s.jsxs)(t.li,{children:["\n",(0,s.jsxs)(t.p,{children:[(0,s.jsx)(t.strong,{children:"hideLabels"})," (Multi-Stacked): Use this prop to hide bar labels when using the AbsoluteScale variant."]}),"\n"]}),"\n"]}),"\n",(0,s.jsxs)(t.p,{children:["For more details, see ",(0,s.jsx)(t.a,{href:"https://developer.microsoft.com/en-us/fluentui#/controls/web/horizontalbarchart/stackedbarchart",children:"Fluent UI - Controls - React - HorizontalBarChart - Stacked"})," and ",(0,s.jsx)(t.a,{href:"https://developer.microsoft.com/en-us/fluentui#/controls/web/horizontalbarchart/multistackedbarchart",children:"Fluent UI - Controls - React - HorizontalBarChart - Multi Stacked"})]}),"\n",(0,s.jsx)(t.h2,{id:"theming",children:"Theming"}),"\n",(0,s.jsxs)(t.ul,{children:["\n",(0,s.jsxs)(t.li,{children:["The styles file contains a function called getStyles, which returns styles for different areas or subcomponents of the chart based on the props passed to it. The base component is wrapped with the styled HOC, which passes the theme (set by the user) and the concatenated styles (obtained from the styling function and any additional styles provided by the user) as props to the base component. Within the base component, the styles are applied to corresponding elements after converting them into class names. This conversion is done by passing theme and other style props as arguments to the function returned by the classNamesFunction utility. To learn more about component styling, refer ",(0,s.jsx)(t.a,{href:"https://github.com/microsoft/fluentui/wiki/Component-Styling",children:"this"}),"."]}),"\n"]}),"\n",(0,s.jsx)(t.h2,{id:"debugging",children:"Debugging"}),"\n",(0,s.jsx)(t.h2,{id:"error-scenarios",children:"Error scenarios"}),"\n",(0,s.jsx)(t.h2,{id:"localization-aspects",children:"Localization aspects"}),"\n",(0,s.jsx)(t.p,{children:"Currently, the chart supports localization only for the chart data texts and the callout content."}),"\n",(0,s.jsx)(t.h2,{id:"some-notable-prs-and-their-brief-description",children:"Some notable PRs and their brief description"}),"\n",(0,s.jsxs)(t.ul,{children:["\n",(0,s.jsx)(t.li,{children:(0,s.jsx)(t.a,{href:"https://github.com/microsoft/fluentui/pull/28414",children:"Focus indicator bug in bar charts by yush-singla \xb7 Pull Request #28414 \xb7 microsoft/fluentui (github.com)"})}),"\n",(0,s.jsx)(t.li,{children:(0,s.jsx)(t.a,{href:"https://github.com/microsoft/fluentui/pull/27580",children:"Disable focus on non-interactive elements by krkshitij \xb7 Pull Request #27580 \xb7 microsoft/fluentui (github.com)"})}),"\n",(0,s.jsx)(t.li,{children:(0,s.jsx)(t.a,{href:"https://github.com/microsoft/fluentui/pull/26082",children:"Add new variant to horizontal bar chart by krkshitij \xb7 Pull Request #26082 \xb7 microsoft/fluentui (github.com)"})}),"\n",(0,s.jsx)(t.li,{children:(0,s.jsx)(t.a,{href:"https://github.com/microsoft/fluentui/pull/24563",children:"Fix legends selection bugs by krkshitij \xb7 Pull Request #24563 \xb7 microsoft/fluentui (github.com)"})}),"\n",(0,s.jsx)(t.li,{children:(0,s.jsx)(t.a,{href:"https://github.com/microsoft/fluentui/pull/24835",children:"Set minimum width of 1% for multi stacked horizontal bar chart by AtishayMsft \xb7 Pull Request #24835 \xb7 microsoft/fluentui (github.com)"})}),"\n",(0,s.jsx)(t.li,{children:(0,s.jsx)(t.a,{href:"https://github.com/microsoft/fluentui/pull/24631",children:"Fix min width of bars as 1% for horizontal bar charts by AtishayMsft \xb7 Pull Request #24631 \xb7 microsoft/fluentui (github.com)"})}),"\n",(0,s.jsx)(t.li,{children:(0,s.jsx)(t.a,{href:"https://github.com/microsoft/fluentui/pull/21750",children:"Fix charting callout not hoverable using mouse and callout flickering by AtishayMsft \xb7 Pull Request #21750 \xb7 microsoft/fluentui (github.com)"})}),"\n"]}),"\n",(0,s.jsx)(t.h2,{id:"future-improvements",children:"Future improvements"}),"\n",(0,s.jsx)(t.h2,{id:"rendering-details",children:"Rendering details"}),"\n",(0,s.jsxs)(t.ul,{children:["\n",(0,s.jsx)(t.li,{children:"When no data is provided by the user, an empty div is rendered in place of the chart."}),"\n",(0,s.jsx)(t.li,{children:"By default, chart data with a length of 1 is displayed as a number, and data with a length of 2 is displayed as a fraction/ratio above the bar. However, in the absolute-scale variant of the multi-stacked bar chart, the sum of the values of all highlighted bar segments is displayed as a number beside the bar."}),"\n",(0,s.jsx)(t.li,{children:"Changes in layout direction do not affect the stacking order of the bars but rather the text anchor. Therefore, the stacking order of the bars is reversed by adjusting the x attribute according to the layout direction, making it easier for the respective users to read the chart."}),"\n"]}),"\n",(0,s.jsx)(t.h2,{id:"interactions",children:"Interactions"}),"\n",(0,s.jsx)(t.p,{children:"The chart is wrapped with a FocusZone component to allow focus on its interactive subcomponents. The following subcomponents are accessible using the keyboard:"}),"\n",(0,s.jsxs)(t.ol,{children:["\n",(0,s.jsxs)(t.li,{children:["\n",(0,s.jsx)(t.p,{children:(0,s.jsx)(t.strong,{children:"Bar segment "})}),"\n",(0,s.jsxs)(t.ul,{children:["\n",(0,s.jsxs)(t.li,{children:[(0,s.jsx)(t.code,{children:"data-is-focusable"}),": True if the hideTooltip prop is falsy."]}),"\n",(0,s.jsxs)(t.li,{children:[(0,s.jsx)(t.code,{children:"onFocus"}),": Shows a callout near the element containing the segment details."]}),"\n",(0,s.jsxs)(t.li,{children:[(0,s.jsx)(t.code,{children:"onBlur"}),": Does nothing."]}),"\n"]}),"\n"]}),"\n",(0,s.jsxs)(t.li,{children:["\n",(0,s.jsx)(t.p,{children:(0,s.jsx)(t.strong,{children:"Chart title "})}),"\n",(0,s.jsxs)(t.ul,{children:["\n",(0,s.jsxs)(t.li,{children:[(0,s.jsx)(t.code,{children:"data-is-focusable"}),": True if the text content overflows and is truncated."]}),"\n",(0,s.jsxs)(t.li,{children:[(0,s.jsx)(t.code,{children:"onFocus"}),": Shows a tooltip with complete content."]}),"\n",(0,s.jsxs)(t.li,{children:[(0,s.jsx)(t.code,{children:"onBlur"}),": Hides the tooltip if it is visible."]}),"\n"]}),"\n"]}),"\n",(0,s.jsxs)(t.li,{children:["\n",(0,s.jsx)(t.p,{children:(0,s.jsx)(t.strong,{children:"Legend FluentUI ChartingDocs

Accessibility

The react charting library is accessibility MAS C compliant. diff --git a/docs/CHANGELOG.html b/docs/CHANGELOG.html index c36609c812..39a7d82436 100644 --- a/docs/CHANGELOG.html +++ b/docs/CHANGELOG.html @@ -5,8 +5,8 @@ Release Log | FluentUI Charting Contrib Docsite - - + +

Release Log

diff --git a/docs/Charting-Concepts/AreaChart.html b/docs/Charting-Concepts/AreaChart.html index 93e57713d2..bc5dee8811 100644 --- a/docs/Charting-Concepts/AreaChart.html +++ b/docs/Charting-Concepts/AreaChart.html @@ -5,11 +5,11 @@ Contributor guide: Area Chart | FluentUI Charting Contrib Docsite - - + + -

Contributor guide: Area Chart

+

Contributor guide: Area Chart

Areachartpic1.png

Area charts are graphical representations of data that display quantitative data points connected by lines and filled with colors to create a visual representation of trends and patterns. The area between the line and the x-axis is filled, which helps in emphasizing the cumulative total or the overall magnitude of the data.

Use cases:

@@ -143,6 +143,6 @@

InteractionsExtension

While working on area chart if you are exploring or adding any new things , so if you are planning to contribute or fix something related to creation of line, interaction with the chart and data related things you should start exploring fluentui/packages/react-charting/src/components/AreaChart at master · microsoft/fluentui (github.com) If anything is related axis creation, domain range issues then one should start exploring cartesian chart code: -fluentui/packages/react-charting/src/components/CommonComponents at master · microsoft/fluentui · GitHub

+fluentui/packages/react-charting/src/components/CommonComponents at master · microsoft/fluentui · GitHub

\ No newline at end of file diff --git a/docs/Charting-Concepts/DonutChart.html b/docs/Charting-Concepts/DonutChart.html new file mode 100644 index 0000000000..fc4f0a52f7 --- /dev/null +++ b/docs/Charting-Concepts/DonutChart.html @@ -0,0 +1,213 @@ + + + + + +Contributor guide: Donut Chart | FluentUI Charting Contrib Docsite + + + + + +

Contributor guide: Donut Chart

+

DonutChart1.png

+

A Donut chart is a type of chart used to visualize data as a circular shape with the central area hollow. It is similar to a Pie chart, but with the area in the center cut out instead of a solid circle. +Donut charts are useful for displaying data as parts of a whole, where each segment represents a percentage or proportion of the total. The segments are typically colored differently to make them easier to distinguish.

+

Use cases

+

Donut charts are commonly used in business and finance to display financial data, such as revenue or expenses. They are also used in marketing to display customer demographics or market share. Here are some real-world use cases for Donut charts:

+
    +
  • Sales data: Donut charts can be used to display sales data, where each segment represents a product or service category. This can help businesses identify which products or services are performing well and which ones need improvement.
  • +
  • Budget data: Donut charts can be used to display budget data, where each segment represents a budget category. This can help businesses identify areas where they are overspending or underspending.
  • +
  • Demographic data: Donut charts can be used to display demographic data, where each segment represents a different demographic group. This can help businesses identify their target audience and tailor their marketing efforts accordingly.
  • +
  • Market share data: Donut charts can be used to display market share data, where each segment represents a different company or brand. This can help businesses identify their competitors and their position in the market.
  • +
  • Survey data: Donut charts can be used to display survey data, where each segment represents a different response option. This can help businesses identify the most popular responses and areas where improvements can be made.
  • +
+

Overall, Donut charts are useful for displaying data as parts of a whole, where each segment represents a percentage or proportion of the total. They are a popular choice for visualizing financial, marketing, and survey data.

+

Mathematical/Geometrical concepts

+

DonutChart2.png

+

The d3-shape library provides various functions for creating and manipulating shapes such as arcs, lines, and areas. Following are the main mathematical/geometrical concepts that are used while drawing a donut chart.

+
    +
  1. d3.arc(): Creates an arc generator function that can be used to create an SVG arc path. The arc generator function takes in an object that specifies the start and end angles of the arc, as well as the inner and outer radii of the arc. The following are some of the main props that the arc generator accepts:
  2. +
+
- startAngle: The starting angle of the arc, in radians. The default value is 0.
- endAngle: The ending angle of the arc, in radians. The default value is 2π (i.e., a full circle).
- innerRadius: The inner radius of the arc, in pixels. The default value is 0.
- outerRadius: The outer radius of the arc, in pixels. This prop is required.
- padAngle: The amount of padding to add between adjacent arcs, in radians. The default value is 0.
+
    +
  1. d3.pie(): creates a pie generator function that can be used to create a pie chart. The pie generator function takes in an array of data and returns an array of objects that represent each data point in the pie chart.
  2. +
+
    +
  • Pie formation: The function uses the data values to calculate the angles for each data point. It then uses the angles to create a series of arcs that represent each data point in the pie chart. The arcs are created using the d3.arc() function, which creates an SVG arc path based on the start and end angles of the arc.
  • +
  • Supported props: The function also provides various options for customizing the pie chart, such as the pie start angle, the pie end angle, and the sort order of the data points. These options can be used to create different types of pie charts, such as donut charts or exploded pie charts. +Here are the main props that can be passed to the pie generator function:
  • +
+
- data: the input datum; the corresponding element in the input data array.
- value: the numeric value of the arc.
- index: the zero-based sorted index of the arc.
- startAngle: The starting angle of the pie chart, in radians. The default value is 0.
- endAngle: The ending angle of the pie chart, in radians. The default value is 2π (i.e., a full circle).
- padAngle: The amount of padding to add between adjacent data points, in radians. The default zalue is 0.
+

Dev Design details

+

This section contains the technical design of various sub components of a donut chart and how they interact with each other. This section can also contain any key interface or class structure of the donut chart. +The Donut chart consists of the following sub-components:

+
    +
  1. Arc:
  2. +
+
    +
  • Arc creation: This component is used to render an arc in a pie chart, and it receives various props such as the arc data, color, and focus state. The component uses the d3-shape library to create the arc shape, and it also uses the @fluentui/react library to apply styles to the component.
  • +
  • Arc event handlers: The Arc component has several methods that handle events such as _onFocus, _hoverOn, _hoverOff, _onBlur and onClick. These methods are used to update the component's state and to trigger callbacks that are passed in as props. The component also has a method called _renderArcLabel that is used to render the label for the arc.
  • +
  • Arc update: The Arc component uses the getDerivedStateFromProps method to update the chart whenever new props are received. This method calls the _updateChart function, which updates the inner and outer radius of the arc based on the new props. +Overall, the Arc component is a reusable component that can be used to render an arc in a pie chart. It is highly customizable and can be used in a variety of contexts.
  • +
+
    +
  1. Pie:
  2. +
+
    +
  • Pie creation: This component is used to render a pie chart, and it receives various props such as the chart data, inner and outer radius, and callbacks for hover and focus events. The component uses the d3-shape library to create the pie chart shape, and it also uses the @fluentui/react library to apply styles to the component.
  • +
  • Constraint: The inner radius has to be greater than 0.
  • +
  • Pie handlers: The Pie component has several methods that handle events such as _focusCallback and _hoverCallback. These methods are used to update the component's state and to trigger callbacks that are passed in as props. The component also has a method called _computeTotalValue that is used to calculate the total value of the chart data.
  • +
  • Pie update: The Pie component uses the getDerivedStateFromProps method to update the chart whenever new props are received. This method calls the _updateChart function, which updates the inner and outer radius of the chart based on the new props. +Overall, the Pie component is a reusable component that can be used to render a pie chart. It is highly customizable and can be used in a variety of contexts.
  • +
+
    +
  1. Callout:
  2. +
+
    +
  • Callout creation: The DonutChart component has a method called _renderCallouts that is used to render callouts for the data points. This method creates a Callout component from the @fluentui/react library and passes in various props such as the target element, the callout ID, and the callout content. The method also sets up various actions for the callout, such as hover and dismiss actions.
  • +
  • Callout behaviour: The Callout component is used to display additional information about a data point when it is hovered over. It is positioned relative to the hovered data point and displays information such as the data point's legend, value, and color. The Callout component is highly customizable and can be used in a variety of contexts.
  • +
+
    +
  1. Legends:
  2. +
+
    +
  • Legend creation: The DonutChart component has a private method called _createLegends that is used to create the legends for the chart. This method takes in the chart data and color palette as arguments and returns a JSX element that contains the legends. The method maps over the chart data and creates a legend for each data point. It also sets up various actions for each legend, such as hover and click actions.
  • +
+
    +
  1. Inner Text:
  2. +
+
    +
  • Inner text description: The inner text in a Donut chart is the text displayed in the centre of the donut chart, inside the hollow region. This text can be used to display additional information about the data being displayed, such as the total value or the name of the data set.
  • +
+
    +
  1. Rendering details +The donut chart uses d3 SVG based rendering, which follows the following render cycles:
  2. +
+
Invocation cycle: Donut Chart -> Pie -> Arc
Rendering cycle: Donut chart <- d3.pie() <- d3.arc()
+
    +
  1. Error scenarios
  2. +
+

Currently, donut chart cannot handle long inner texts which overflows and results in error state. Fix for this issue is already in PR.

+
    +
  1. +

    Localization aspects +Currently, donut chart provides localization only for the inner text.

    +
  2. +
  3. +

    Testing +The manual, component and unit testing of donut charts have been completed. Following is the improvement in code coverage:

    +
  4. +
+

DonutChart3.png

+
    +
  1. Component Tests: +o Work item: https://uifabric.visualstudio.com/iss/_workitems/edit/6798/ +o Test plan: https://github.com/microsoft/fluentui/blob/master/packages/react-charting/docs/TestPlans/DonutChart/ComponentTests.md
  2. +
  3. Unit Tests: +o Work item: https://uifabric.visualstudio.com/iss/_workitems/edit/7403
  4. +
+
    +
  • +

    Accessibility +FAST pass checks resulted in no error for Donut chart. Link to the FAST pass tool: https://accessibilityinsights.io/docs/web/getstarted/fastpass/ +Our charts have elaborate accessibility support. The charts are WCAG 2.1 MAS C compliant for accessibility. +Consumers can define their own aria labels for each point by setting the xAxisCalloutAccessibilityData and callOutAccessibilityData properties.

    +
  • +
  • +

    Theming +The palette for donut chart is set from the "theme" prop as passed to the component during rendering. Both light and dark themes are supported and users can create there own theme too. Ref[3] and Ref[4] explains theming in detail.

    +
  • +
  • +

    Debugging +The detailed steps on debugging has been given in Debugging.

    +
  • +
  • +

    Variants +Following are the variants of donut chart: Ref2

    +
      +
    1. Basic Donut Chart: Only basic props are provided.
    2. +
    3. Dynamic Donut Chart: The data and pie colors can change.
    4. +
    5. Custom Callout: Can show customized callout data.
    6. +
    7. Custom Accessibility: Providing custom aria labels.
    8. +
    +
  • +
  • +

    Interaction +Following are the interactions that are allowed for donut chart:

    +
      +
    1. Mouse Events: +a. On mouse over on the donut chart, should render callout. +b. On mouse move on Pie 1 (step 1) -> mouse leave (step 2) -> mouse move on Pie 2 (step 3), should render the callout of the Pie 2. +c. On mouse over, callout should be defined, on mouse leave, callout should disappear. +d. On mouse over on legends, should highlight the corresponding pie. +e. On mouse over on legends, should change the value inside donut with the legend value. +f. On click on Pie, should highlight the corresponding pie with aria-selected set to “true” and tabIndex set to 0. +g. On mouse out after mouse over on first legend, should have opacity 0.1 for second Pie initially (during mouseOver on first legend) and opacity set to 1 for both the Pies on mouse out.
    2. +
    3. Keyboard Events: +a. On focus on a Pie, should render the corresponding callout. +b. On blur on a Pie, should remove focus from the corresponding Pie.
    4. +
    +
  • +
  • +

    Some notable PRs and their brief description

    +
      +
    1. Adding the Donut Chart main component
    2. +
    3. Adding Tests for Donut Chart using React Testing Library
    4. +
    5. Allow focus navigation with tab key in donut chart (Accessibility)
    6. +
    +
  • +
  • +

    Learnings

    +
  • +
+
    +
  1. +

    While implementing the tests using react testing library, it was found that certain browser functions like getComputedTextLength() cannot be unit tested and needs to be tested End-to-End only.

    +
  2. +
  3. +

    Order of imports are important. +For example: for Vertical bar charts tests, improper sequencing of the imports (data first and then render) results in incorrect and incopmlete rendering of charts:

    +
  4. +
+
import { chartPoints } from '../VerticalBarChart/VerticalBarChart.test';
import { render, screen, queryAllByAttribute, fireEvent, act } from '@testing-
library/react';
However, the following results in correct rendering:

import { render, screen, queryAllByAttribute } from '@testing-library/react';
import { chartPoints } from './VerticalBarChart.test';
+
    +
  1. Certain props need async await structure (waitFor in react testing library) for different props or nested SVGs to render.
  2. +
+
    +
  • Known issues
  • +
+

The value inside Donut chart overflows. Should be ideally wrapping inside the donut chart. Work item 5321 captures this bug. This item has already been fixed in this PR.

+
    +
  • Future improvements
  • +
+

Following are the list of future improvements for the donut chart:

+
    +
  1. The donut chart component can be extended to support Nested Donut Charts which can also be used to display multiple sets of data, where each ring represents a different data set.
  2. +
+
    +
  • +

    Design figma +Donut Chart Figma: Link

    +
  • +
  • +

    Performance

    +
  • +
+

The performance aspect of a donut chart refers to how efficiently and effectively it conveys information to the viewer. Here are some key considerations regarding the performance of a line chart:

+
    +
  • Data Visualization Efficiency
  • +
  • Clarity and Simplicity
  • +
  • Responsiveness
  • +
  • Handling Large Datasets
  • +
  • Interactive Features +We use Lighthouse tool for measuring the performance of our charts. Following are few of the scenarios for which we measure the performance score for donut chart: +
      +
    1. chart with 100 data points
    2. +
    3. charts with localized data +All of the above scenarios have 95+ Lighthouse score. We are efficient in terms of the performance of the donut chart.
    4. +
    +
  • +
+ + \ No newline at end of file diff --git a/docs/Charting-Concepts/GaugeChart.html b/docs/Charting-Concepts/GaugeChart.html index 052200885d..a1d007a694 100644 --- a/docs/Charting-Concepts/GaugeChart.html +++ b/docs/Charting-Concepts/GaugeChart.html @@ -5,11 +5,11 @@ Contributor guide: Gauge Chart | FluentUI Charting Contrib Docsite - - + + -

Contributor guide: Gauge Chart

+

Contributor guide: Gauge Chart

Gauge chart measures the progress of a metric against its target and its primary components are a speedometer and a needle. The speedometer usually consists of color-coded segments progressing value from left to right.

Use cases

Gauge chart offers a quick and intuitive way to evaluate a single value within a specific range and its relation to targets or thresholds. Here are some common use cases for gauge chart:

@@ -265,6 +265,6 @@

LearningsExtensions

+

Extensions

\ No newline at end of file diff --git a/docs/Charting-Concepts/GroupedVerticalBarChart.html b/docs/Charting-Concepts/GroupedVerticalBarChart.html new file mode 100644 index 0000000000..a94b422eae --- /dev/null +++ b/docs/Charting-Concepts/GroupedVerticalBarChart.html @@ -0,0 +1,566 @@ + + + + + +Contributor guide: Grouped Vertical Bar Chart | FluentUI Charting Contrib Docsite + + + + + +

Contributor guide: Grouped Vertical Bar Chart

+

GroupedVerticalBarChart1.png

+

A grouped vertical bar chart is a type of chart that displays multiple series of data as groups of bars, with each bar representing a category. The bars are grouped together side by side, with each group representing a different series.

+

In a grouped vertical bar chart, the x-axis represents the categories, while the y-axis represents the values of the series. Each bar in a group is colored differently to differentiate between the series.

+
    +
  • Use cases +Some common use cases for a Grouped Vertical Bar Chart are as follows: +
      +
    • Comparing the values of multiple series across categories
    • +
    • Displaying financial data, such as revenue and expenses, for different products or services
    • +
    • Displaying scientific research data for different treatments or conditions
    • +
    • Comparing the performance of different teams or departments in a company
    • +
    • Showing the distribution of different types of crimes in a city
    • +
    • Displaying the results of a survey for different age groups or genders
    • +
    • Comparing the sales of different products in a store
    • +
    • Showing the number of students enrolled in different courses in a school
    • +
    • Displaying the number of employees in different departments of a company
    • +
    • Comparing the number of visitors to different tourist attractions in a city
    • +
    +
  • +
  • Mathematical/Geometrical concepts
  • +
+

GroupedVerticalBarChart2.png

+

The major D3 functions that are involved in the creation of Vertical bar charts are:

+
    +
  • +

    d3-scale: +The d3-scale module is a part of the d3 library, which is a collection of JavaScript functions that are used for data visualization. The d3-scale module provides several functions for creating and manipulating scales, which are used to map data values to visual properties, such as position, size, and color.

    +

    The d3-scale module includes several scale types, including linear, logarithmic, power, and time scales. These scales are used to map continuous data values to a continuous range of visual properties. The module also includes ordinal and band scales, which are used to map categorical data values to a discrete range of visual properties.

    +
  • +
+

The d3-scale module provides several functions for creating and manipulating scales, including scaleLinear, scaleLog, scalePow, scaleTime, scaleOrdinal, and scaleBand. These functions take one or more arguments that define the domain and range of the scale, as well as any additional properties, such as the number of ticks or the padding between bands.

+

Application in Grouped Vertical bar chart: +Grouped vertical bar chart uses the d3-scale module to create a linear scale for the y-axis of the chart. The linear scale maps a continuous domain of data values to a continuous range of visual properties, such as position or height.

+
    +
  • +

    d3.scaleLinear(): The d3.scaleLinear is a function from the d3-scale module that is used to create a linear scale for the y-axis of the chart. The linear scale maps a continuous domain of data values to a continuous range of visual properties, such as position or height. The d3ScaleLinear function takes no arguments and returns a new linear scale. The scale can be customized using several methods, including domain, range, clamp, and nice. The domain method sets the domain of the scale, which is the range of data values that the scale maps to the range of visual properties. The range method sets the range of the scale, which is the range of visual properties that the scale maps to the domain of data values.

    +

    Application in Grouped Vertical bar chart:

    +
      +
    • In the Grouped Vertical Bar chart component, the d3.scaleLinear function from the d3-scale module is used to create a new linear scale for the y-axis of the chart.
    • +
    • The d3.scaleLinear function takes no arguments and returns a new linear scale. The scale maps a continuous input domain to a continuous output range. In this case, the input domain is the range of values for the y-axis data, while the output range is the range of pixel values for the y-axis on the chart.
    • +
    • The d3.scaleLinear function is used in the GroupedVerticalBarChart component to generate the y-axis scale for the chart. The yAxisScale property of the component is set to a new instance of the d3.scaleLinear function. The domain property of the yAxisScale object is set to an array of the minimum and maximum values of the y-axis data. The range property of the yAxisScale object is set to an array of the minimum and maximum pixel values for the y-axis on the chart.
    • +
    • The d3.scaleLinear function is used to generate a linear scale that maps the y-axis data to the pixel values on the chart. This allows the y-axis data to be displayed in a way that is visually meaningful and easy to interpret.
    • +
    +
  • +
  • +

    d3.scaleBand(): The d3.scaleBand is a function from the d3-scale module that is used to create a band scale for the x-axis of the chart. The band scale maps a discrete domain of data values to a discrete range of visual properties, such as position or width. The d3ScaleBand function takes no arguments and returns a new band scale. The scale can be customized using several methods, including domain, range, padding, and align. The domain method sets the domain of the scale, which is the range of data values that the scale maps to the range of visual properties. The range method sets the range of the scale, which is the range of visual properties that the scale maps to the domain of data values. The padding method sets the padding between the bands of the scale, which determines the width of the bands. The align method sets the alignment of the bands within the range of the scale.

    +

    Application in Grouped Vertical bar chart:

    +
  • +
+
- x0_inner_padding = space_between_groups /(space_between_groups + group_width)

- space_between_groups = 2 * bar_width

- group_width = this._keys.length * bar_width + (this._keys.length - 1) * space_between_bars
+
    +
  • In the Grouped Vertical Bar chart component, the d3.scaleBand function from the d3-scale module is used to create a new band scale for the x-axis of the chart.
  • +
  • The d3.scaleBand function takes no arguments and returns a new band scale. The scale maps a discrete input domain to a continuous output range. In this case, the input domain is an array of categories for the x-axis, while the output range is the range of pixel values for the x-axis on the chart.
  • +
  • The d3.scaleBand function is used in the GroupedVerticalBarChart component to generate the x-axis scale for the chart. The xAxisScale property of the component is set to a new instance of the d3.scaleBand function. The domain property of the xAxisScale object is set to an array of the categories for the x-axis. The range property of the xAxisScale object is set to an array of the minimum and maximum pixel values for the x-axis on the chart.
  • +
  • The d3.scaleBand function is used to generate a band scale that maps the categories for the x-axis to the pixel values on the chart. This allows the categories to be displayed in a way that is visually meaningful and easy to interpret. The paddingInner and paddingOuter properties of the xAxisScale object can be used to adjust the spacing between the bars and groups of bars on the chart.
  • +
+

Overall, the d3.scaleBand function is used to generate a band scale that maps the categories for the x-axis to the pixel values on the chart, allowing the categories to be displayed in a way that is visually meaningful and easy to interpret.

+
    +
  • +

    d3-selection: The d3-selection is a module from the d3 library that is used to select and manipulate DOM elements in the chart component. The d3-selection module provides several functions for selecting and manipulating DOM elements, including select, selectAll, append, attr, and style. The select function is used to select a single DOM element that matches a given selector. The selectAll function is used to select multiple DOM elements that match a given selector. The append function is used to append a new DOM element to a selected element. The attr function is used to set or get an attribute of a selected element. The style function is used to set or get a style property of a selected element.

    +

    Application in Grouped Vertical bar chart:

    +
      +
    • In the Grouped Vertical Bar chart component, the d3Select function from the d3-selection module is used to select an element from the DOM.
    • +
    • The d3Select function takes one argument, which is a SVG node element for the element to be selected. The function returns a new selection object that represents the selected element.
    • +
    +
  • +
+

Overall, the d3Select function from the d3-selection module is used to select an element from the DOM, which allows the GroupedVerticalBarChart component to interact with and modify the chart elements.

+
    +
  • +

    d3-array: The d3-array is a module from the d3 library that is used to manipulate arrays of data in the chart component. The d3-array module provides several functions for manipulating arrays of data, including max, min, extent, sum, and mean. The max function is used to find the maximum value in an array of data. The min function is used to find the minimum value in an array of data. The extent function is used to find the minimum and maximum values in an array of data. The sum function is used to find the sum of the values in an array of data. The mean function is used to find the mean (average) of the values in an array of data.

    +

    Application in Grouped Vertical bar chart:

    +
      +
    • In the Grouped Vertical Bar chart component, the d3Max function from the d3-array module is used to find the maximum value in an array of numbers.
    • +
    • The d3Max function takes two arguments: the first argument is the array of numbers to be searched, and the second argument is an optional function that specifies how to extract the numeric value from each element in the array. If the second argument is not provided, the d3Max function assumes that the array contains only numeric values.
    • +
    +
  • +
+

Overall, the d3Max function from the d3-array module is used to find the maximum value in an array of numbers, which allows the GroupedVerticalBarChart component to set the y-axis scale domain based on the maximum value of the y-axis data.

+
    +
  • +

    d3-format: The d3-format is a module from the d3 library that is used to format numbers and strings in the chart component. The d3-format module provides several functions for formatting numbers and strings, including format, formatPrefix, precisionFixed, and precisionRound.

    +

    The format function is used to format a number or string using a specified format string. The format string can include placeholders for the value, such as % for a percentage or , for a comma-separated number. The formatPrefix function is used to format a number using a prefix notation that rounds the value to a specified precision and appends a prefix, such as K for thousands or M for millions. The precisionFixed function is used to format a number using a fixed number of decimal places. The precisionRound function is used to format a number using a variable number of decimal places that is determined by the magnitude of the value.

    +
  • +
+

Application in Grouped Vertical bar chart:

+
    +
  • In the Grouped Vertical Bar chart component, the d3FormatPrefix function from the d3-format module is used to format numbers with SI-prefixes.
  • +
  • The d3FormatPrefix function takes one argument, which is a numeric value. The function returns a string that represents the value with an SI-prefix, such as "K" for thousands or "M" for millions.
  • +
  • The d3FormatPrefix function is used in the GroupedVerticalBarChart component to format the bar labels for groups.
  • +
+

Overall, the d3FormatPrefix function from the d3-format module is used to format numbers, which allows the component to display the bar labels in a way that is visually meaningful and easy to interpret.

+
    +
  • +

    d3-axis: The d3-axis module is a part of the d3 library, which is a collection of JavaScript functions that are used for data visualization. The d3-axis module provides several functions for creating and manipulating axes, which are used to display the scales of a chart component.

    +

    In data visualization, axes are used to display the scales of a chart component, such as the x-axis and y-axis of a bar chart. Axes provide visual cues to help readers interpret the data values of a chart component, such as the range and domain of the data values.

    +
  • +
+

The d3-axis module provides several types of axes, including bottom, top, left, and right axes. Each type of axis has its own set of methods for customizing the axis and displaying the tick values.

+

Overall, the d3-axis module is an essential part of data visualization, as it provides a powerful and flexible way to display the scales of a chart component and help readers interpret the data values of the chart.

+

Application in Grouped Vertical bar chart: +In the Vertical stacked bar chart, d3-axis is used to create and render the x and y axes of the chart.

+
    +
  • The d3-axis library provides various methods for creating and rendering axes, such as axisBottom(), axisLeft(), and tickFormat(). In this case, the d3-axis library is used to create and render the x and y axes of the chart.
  • +
  • To create the x and y axes, the d3-axis library's axisBottom() and axisLeft() methods are used, respectively. These methods take a scale function as an argument and return a new axis function that can be used to render the axis.
  • +
  • The resulting x and y axis functions are then used to render the x and y axes of the chart. The call() method of the selection object is used to call the axis function and render the axis.
  • +
  • The tickFormat() method of the y-axis scale is also used to set the tick format function for the y-axis. This method takes the format function created using the d3-format library as an argument and sets it as the tick format function for the y-axis.
  • +
+

Overall, the d3-axis library is used to create and render the x and y axes of the chart by using the axisBottom() and axisLeft() methods to create the axis functions and the call() method to render the axes. The tickFormat() method is also used to set the tick format function for the y-axis.

+
    +
  • Dev Deisgn Details: +Following are the major components that contribute towards creating a complete grouped vertical bar chart: +
      +
    • Axes: +
        +
      • +

        _createX0Scale(): This method is responsible for generating the x and y scales that are used to map the data points to the chart dimensions. The scales are generated using the d3-scale library, which provides several scale types for different types of data.

        +

        Function arguments:

        +
          +
        • containerWidth: It is a number representing the width of the container element for the chart. This argument is used to calculate the range of the x-axis scale.
        • +
        +
      • +
      +
    • +
    +
  • +
+

Working algorithm:

+
    +
  • +

    The _createX0Scale method first creates a new d3ScaleBand object called x0Axis. The domain property of the x0Axis object is set to the _xAxisLabels array, which contains the labels for the main x-axis of the chart. The range property of the x0Axis object is set to an array that defines the range of the main x-axis scale. The range is calculated based on the containerWidth, the margins of the chart, and the _domainMargin property, which is the margin between the edge of the chart and the first and last bars.

    +
  • +
  • +

    The paddingInner property of the x0Axis object is set to a value that defines the inner padding between groups of bars in the chart. The value is calculated based on the number of keys in the chart, which is the number of series in each data point, and the BAR_GAP_RATE property, which is the ratio of the space between bars to the width of a bar.

    +
  • +
  • +

    Finally, the _createX0Scale method returns the x0Axis object.

    +
  • +
  • +

    _createX1Scale(): This method generates the grouped x-axis scale for the chart. The method creates a new d3ScaleBand object and sets its domain, range, and paddingInner properties based on the _keys array, the bandwidth of the main x-axis scale, the _isRtl property, and the X1_INNER_PADDING and BAR_GAP_RATE properties. The method returns the d3ScaleBand object.

    +

    Function arguments:

    +
      +
    • xScale0: This argument is a scale function that is used to calculate the width of each bar in the chart. The function returns a new scale function that is used to calculate the position of each bar within a group.
    • +
    +
  • +
+

Working algorithm:

+
    +
  • +

    The _createX1Scale method first creates a new d3ScaleBand object say x1Axis. The domain property of the x1Axis object is set to the _keys array, which contains the keys for each series in the chart. The range property of the x1Axis object is set to an array that defines the range of the grouped x-axis scale. The range is calculated based on the bandwidth of the main x-axis scale, the _isRtl property, which is a boolean that indicates whether the chart is in right-to-left mode.

    +
  • +
  • +

    The paddingInner property of the x1Axis object is set to a value that defines the inner padding between groups of bars in the chart. The value is calculated based on the X1_INNER_PADDING property whose value is 0.1.

    +
  • +
  • +

    Finally, the _createX1Scale method returns the x1Axis object.

    +
  • +
  • +

    _getDomainMargins(): This method calculates the margins of the chart based on the available width of the chart container and the required width to render the bars in the chart. The method calculates the barWidth and groupWidth variables based on the barwidth prop, the number of keys in the chart, and the BAR_GAP_RATE property. If the available width is greater than or equal to the required width, the method centers the chart by setting equal left and right margins for the domain. If the available width is less than the required width, the method calculates the maximum possible group width to maintain a 2:1 spacing between bars and groups of bars and recalculates the barWidth variable. The method returns an object that represents the margins of the chart.

    +

    Function arguments:

    +
      +
    • containerWidth: It is a number representing the width of the container in which the chart is being rendered.
    • +
    +
  • +
+

Formulae:

+
x1_inner_padding = space_between_bars / (space_between_bars + bar_width)

=> space_between_bars = (x1_inner_padding / (1 - x1_inner_padding)) \* bar_width

BAR_GAP_RATE = Rate at which the space between the bars in a group changes wrt the bar width

BAR_GAP_RATE = X1_INNER_PADDING / (1 - X1_INNER_PADDING)

X1_INNER_PADDING = 0.1

Maximum possible group width to maintain 2:1 spacing:

InitialBarWidth = Math.min(props.barwidth || 16, 24);

(i) InitialGroupWidth = _keys.length * InitialBarWidth+ (_keys.length - 1) * BAR_GAP_RATE * InitialBarWidth

Total width required to render the bars. Directly proportional to bar width:

(ii) ReqWidth = _xAxisLabels.length * InitialGroupWidth + (_xAxisLabels.length - 1) * 2 * InitialBarWidth

From (i) and (ii)

Maximum possible group width to maintain 2:1 spacing

MaxBandwidth = totalWidth / (_xAxisLabels.length +

(_xAxisLabels.length - 1) \* (2 / (_keys.length + (_keys.length - 1) * BAR_GAP_RATE)))

FinalGroupWidth = MaxBandwidth;

From (i)

FinalBarWidth = FinalGroupWidth / (_keys.length + (_keys.length - 1) * BAR_GAP_RATE)
+

Working algorithm:

+
    +
  • +

    The _getDomainMargins method first calculates the total width available to render the bars in the chart. The total width is calculated based on the containerWidth, the margins of the chart, and the MIN_DOMAIN_MARGIN property, which is the minimum margin between the edge of the chart and the first and last bars. The method then sets the barWidth variable to the minimum of the barwidth prop or 16, and the groupWidth variable to the product of the number of keys in the chart, the barWidth, and the BAR_GAP_RATE property, which is the ratio of the space between bars to the width of a bar, plus the space between groups of bars.

    +
  • +
  • +

    The method then calculates the total width required to render the bars in the chart. The total width is calculated based on the length of the _xAxisLabels array, the groupWidth, the barWidth, and the space between groups of bars. If the total width available to render the bars is greater than or equal to the total width required to render the bars, the method sets the _domainMargin property to half of the difference between the total width available and the total width required. This centers the chart by setting equal left and right margins for the domain.

    +
  • +
  • +

    If the total width available to render the bars is less than the total width required to render the bars, the method calculates the maximum possible group width to maintain a 2:1 spacing between bars and groups of bars. The method then sets the groupWidth variable to the maximum possible group width and recalculates the barWidth variable based on the groupWidth and the BAR_GAP_RATE property. The _domainMargin property is set to the MIN_DOMAIN_MARGIN.

    +
  • +
  • +

    Finally, the _getDomainMargins method returns an object that represents the margins of the chart. The left and right margins of the chart are updated to include the _domainMargin.

    +
  • +
  • +

    createNumericXAxis(): The code above is a function called createNumericXAxis in the utilities.ts file. This function is responsible for creating a numeric x-axis for a chart component. The function takes two arguments: xAxisParams and chartType. xAxisParams is an object that contains several properties, including domainNRangeValues, showRoundOffXTickValues, xAxistickSize, tickPadding, xAxisCount, and xAxisElement. chartType is an enumeration that specifies the type of chart component.

    +

    Function arguments:

    +
      +
    • xAxisParams of type IXAxisParams which is an object containing the following properties: +
        +
      • domainNRangeValues of type IDomainNRange which is an object containing the domain and range values for the x-axis.
      • +
      • showRoundOffXTickValues of type boolean which is an optional property that determines whether to round off the x-axis tick values.
      • +
      • xAxistickSize of type number which is an optional property that determines the size of the x-axis ticks.
      • +
      • tickPadding of type number which is an optional property that determines the padding between the x-axis ticks and the x-axis labels.
      • +
      • xAxisCount of type number which is an optional property that determines the number of x-axis ticks.
      • +
      • xAxisElement of type SVGElement | null which is an optional property that represents the x-axis element.
      • +
      +
    • +
    • chartType of type ChartTypes which is an enum that represents the type of chart.
    • +
    • culture of type string which is an optional paramter represents the locale into which the numeric x-axis labels will be localized.
    • +
    +
  • +
+

Working algorithm:

+
    +
  • The function first extracts the properties of the xAxisParams object using destructuring. The domainNRangeValues property is an object that contains the start and end values of the domain and range of the x-axis. The showRoundOffXTickValues property is a boolean that specifies whether to round off the tick values of the x-axis. The xAxistickSize property is a number that specifies the size of the ticks of the x-axis. The tickPadding property is a number that specifies the padding between the ticks and the labels of the x-axis. The xAxisCount property is a number that specifies the number of ticks of the x-axis. The xAxisElement property is a reference to the DOM node that contains the x-axis of the chart.
  • +
  • The function then creates a linear scale for the x-axis using the d3ScaleLinear function from the d3-scale module. The scale is customized using the domain and range methods, which set the domain and range of the scale, respectively. If the showRoundOffXTickValues property is true, the nice method is called on the scale to round off the tick values of the x-axis.
  • +
  • The function then creates a bottom axis for the x-axis using the d3AxisBottom function from the d3-axis module. The axis is customized using the tickSize, tickPadding, ticks, and tickFormat methods. The tickSize method sets the size of the ticks of the x-axis. The tickPadding method sets the padding between the ticks and the labels of the x-axis. The ticks method sets the number of ticks of the x-axis. The tickFormat method formats the tick values of the x-axis using the convertToLocaleString function and the culture parameter.
  • +
  • If the xAxisElement property is not null, the axis is rendered on the DOM node using the call method of the d3-selection module. The selectAll method is called on the axis to select all the text elements of the x-axis, and the attr method is called to set the aria-hidden attribute of the text elements to true.
  • +
  • Finally, the function computes the tick values of the x-axis using the ticks and tickFormat methods of the scale, and returns an object that contains the x-axis scale and the tick values.
  • +
+

Overall, the createNumericXAxis function is responsible for creating a numeric x-axis for a chart component. The function creates a linear scale for the x-axis and a bottom axis for the x-axis using the d3-scale and d3-axis modules, respectively. The function customizes the scale and axis using several methods, including domain, range, tickSize, tickPadding, ticks, and tickFormat. The function also renders the axis on the DOM node and computes the tick values of the x-axis.

+
    +
  • createStringXAxis(): This function is responsible for creating a string x-axis for a chart component. The function takes four arguments: xAxisParams, tickParams, dataset, and culture. xAxisParams is an object that contains several properties, including domainNRangeValues, xAxisCount, xAxistickSize, tickPadding, xAxisPadding, xAxisInnerPadding, and xAxisOuterPadding. tickParams is an object that contains several properties, including tickValues and tickFormat. dataset is an array of strings that contains the values of the x-axis. culture is a string that specifies the locale into which the x-axis labels can be localized.
  • +
+

Function Arguments:

+
    +
  • xAxisParams: An object containing the parameters for the x-axis, including the domain and range values, tick size, tick padding, number of ticks, padding for the inner and outer edges of the axis, and the element to render the axis.
  • +
  • tickParams: An object containing the parameters for the ticks on the x-axis, including the tick values and tick format.
  • +
  • dataset: An array of strings representing the data points for the x-axis.
  • +
  • culture: An optional string representing the culture to use for formatting the tick labels on the x-axis. However, the localization works only if the string can be converted to a numeric value. Otherwise, the x-axis labels remain unlocalized.
  • +
+

Working algorithm:

+
    +
  • The function first extracts the properties of the xAxisParams object using destructuring. The domainNRangeValues property is an object that contains the start and end values of the domain and range of the x-axis. The xAxisCount property is a number that specifies the number of ticks of the x-axis. The xAxistickSize property is a number that specifies the size of the ticks of the x-axis. The tickPadding property is a number that specifies the padding between the ticks and the labels of the x-axis. The xAxisPadding property is a number that specifies the padding between the bars of the chart. The xAxisInnerPadding property is a number that specifies the inner padding between the bars of the chart. The xAxisOuterPadding property is a number that specifies the outer padding between the bars of the chart.
  • +
  • The function then creates a band scale for the x-axis using the d3ScaleBand function from the d3-scale module. The scale is customized using the domain and range methods, which set the domain and range of the scale, respectively. The paddingInner and paddingOuter methods are used to set the inner and outer padding between the bars of the chart, respectively.
  • +
  • The function then creates a bottom axis for the x-axis using the d3AxisBottom function from the d3-axis module. The axis is customized using the tickSize, tickPadding, ticks, and tickFormat methods. The tickSize method sets the size of the ticks of the x-axis. The tickPadding method sets the padding between the ticks and the labels of the x-axis. The ticks method sets the number of ticks of the x-axis. The tickFormat method formats the tick values of the x-axis using the convertToLocaleString function and the culture parameter.
  • +
  • If the xAxisParams.xAxisElement property is not null, the axis is rendered on the DOM node using the call method of the d3-selection module. The selectAll method is called on the axis to select all the text elements of the x-axis, and the attr method is called to set the aria-hidden attribute of the text elements to true.
  • +
  • Finally, the function computes the tick values of the x-axis using the tickFormat method of the axis, and returns an object that contains the x-axis scale and the tick values.
  • +
+

Overall, the createStringXAxis function is responsible for creating a string x-axis for a chart component. The function creates a band scale for the x-axis and a bottom axis for the x-axis using the d3-scale and d3-axis modules, respectively. The function customizes the scale and axis using several methods, including domain, range, paddingInner, paddingOuter, tickSize, tickPadding, ticks, and tickFormat. The function also renders the axis on the DOM node and computes the tick values of the x-axis.

+
    +
  • +

    createYAxis(): In the Vertical bar chart component, the d3-axis module is used to create and customize the y-axis of a vertical bar chart. The createYAxis function is responsible for creating the y-axis using the createYAxisForOtherCharts function. The function takes in several parameters, including yAxisParams, isRtl, axisData, and useSecondaryYScale. These parameters are used to customize the y-axis, such as setting the tick values, tick format, and tick padding.

    +

    Function arguments:

    +
      +
    • yAxisParams: An object that contains various parameters related to the y-axis of the chart. It has the following properties: +
        +
      • yMinMaxValues: An object that contains the start and end values of the y-axis.
      • +
      • yAxisElement: The DOM element that represents the y-axis.
      • +
      • yMaxValue: The maximum value of the y-axis.
      • +
      • yMinValue: The minimum value of the y-axis.
      • +
      • containerHeight: The height of the container that holds the chart.
      • +
      • containerWidth: The width of the container that holds the chart.
      • +
      • margins: An object that contains the margins of the chart.
      • +
      • tickPadding: The padding between the ticks and the axis line.
      • +
      • maxOfYVal: The maximum value of the y-axis for area chart and Grouped vertical bar chart.
      • +
      • yAxisTickFormat: The format of the y-axis tick labels.
      • +
      • yAxisTickCount: The number of ticks on the y-axis.
      • +
      • eventAnnotationProps: An object that contains the properties of the event annotation.
      • +
      • eventLabelHeight: The height of the event label.
      • +
      +
    • +
    • isRtl: A boolean value that indicates whether the chart is in right-to-left mode.
    • +
    • axisData: An object that contains the data related to the axis of the chart.
    • +
    • useSecondaryYScale: A boolean value that indicates whether to use a secondary y-axis scale.
    • +
    +
  • +
+

Working algorithm:

+
    +
  • +

    The function first extracts the necessary parameters from the yAxisParams object, such as the yMinMaxValues, yAxisElement, containerHeight, and containerWidth. It then calculates the final maximum and minimum values for the y-axis, based on the maxOfYVal, yMaxValue, and yMinValue parameters.

    +
  • +
  • +

    The function then prepares the datapoints for the y-axis using the prepareDatapoints function, which calculates the tick values based on the maximum and minimum values of the y-axis. It then creates a linear scale for the y-axis using the d3ScaleLinear function from the d3-scale library.

    +
  • +
  • +

    The function then creates the y-axis using the d3AxisLeft or d3AxisRight function from the d3-axis library, depending on the isRtl and useSecondaryYScale parameters. It sets the tick padding, tick values, and tick size for the y-axis, and formats the tick labels using the yAxisTickFormat parameter.

    +
  • +
  • +

    Finally, the function uses the d3Select function to select the yAxisElement and apply the y-axis to it using the call method. It also sets the aria-hidden attribute of the y-axis text elements to true to improve accessibility.

    +
  • +
  • +

    createStringYAxis(): In the Vertical bar chart component, the d3-axis module is used to create and customize the y-axis of a vertical bar chart. The createStringYAxis function is responsible for creating the y-axis that use string values for the y-axis using the createStringYAxisForOtherCharts function. The function takes in several parameters, including yAxisParams, dataPoints, and isRtl. These parameters are used to customize the y-axis, such as setting the tick values, tick format, and tick padding.

    +

    Function arguments:

    +
      +
    • yAxisParams: An object that contains the parameters for the y-axis, including containerHeight, tickPadding, margins, yAxisTickFormat, yAxisElement, and yAxisPadding.
    • +
    • dataPoints: An array of strings that represent the data points for the y-axis.
    • +
    • isRtl: A boolean value that indicates whether the chart is in right-to-left mode.
    • +
    +
  • +
+

Working algorithm:

+
    +
  • The function first extracts the necessary parameters from the yAxisParams object, such as the containerHeight, margins, yAxisTickFormat, yAxisElement, and yAxisPadding. It then creates a band scale for the y-axis using the d3ScaleBand function from the d3-scale library.
  • +
  • The band scale is defined using the dataPoints array as the domain, and the containerHeight and margins parameters as the range. The padding method is used to set the padding between the bands in the y-axis.
  • +
  • The function then creates the y-axis using the d3AxisLeft or d3AxisRight function from the d3-axis library, depending on the isRtl parameter. It sets the tick padding, tick values, and tick size for the y-axis, and formats the tick labels using the yAxisTickFormat parameter.
  • +
  • Finally, the function uses the d3Select function to select the yAxisElement and apply the y-axis to it using the call method. It also selects all the text elements of the y-axis and returns the y-axis scale.
  • +
  • Bars: +
      +
    • +

      _getGraphData(): This method generates the set of bars for each data point in the chart. The method creates two new x-axis scales, iterates over the _datasetForBars array, and calls the _buildGraph method to generate a set of bars for each data point. The sets of bars are added to an array, which is then assigned to the _groupedVerticalBarGraph variable.

      +

      Function arguments:

      +
        +
      • xScale: A StringAxis or NumericAxis object that represents the x-axis scale of the chart.
      • +
      • yScale: A NumericAxis object that represents the y-axis scale of the chart.
      • +
      • containerHeight: A number that represents the height of the chart container.
      • +
      • containerWidth: A number that represents the width of the chart container.
      • +
      • xElement: An optional SVGElement or null that represents the x-axis element of the chart.
      • +
      +
    • +
    +
  • +
+

Working algorithm:

+
    +
  • +

    The _getGraphData method first creates two new x-axis scales using the _createX0Scale and _createX1Scale methods. The _createX0Scale method creates a new x-axis scale for the main x-axis of the chart, while the _createX1Scale method creates a new x-axis scale for the grouped bars in the chart.

    +
  • +
  • +

    The method then creates an empty array called allGroupsBars. The _datasetForBars array is then iterated over, and for each data point in the array, the _buildGraph method is called to generate a set of bars for the data point. The _buildGraph method takes the current data point, the two x-axis scales, the container height, and the optional x-axis element as arguments and returns a set of bars as a JSX element.

    +
  • +
  • +

    The set of bars for each data point is added to the allGroupsBars array. Finally, the _groupedVerticalBarGraph variable is set to the allGroupsBars array.

    +
  • +
  • +

    _buildGraph(): The method generates a set of bars for a single data point in the chart. The method iterates over each series in the data point and creates a rect element for each series. If the data property of the series is not null, the method also creates a text element to display the value of the data point above the bar. If the wrapXAxisLables prop is false and the showXAxisLablesTooltip prop is true, the method also displays a tooltip at the x-axis label. The method returns a g element that contains the set of bars and labels.

    +

    Function arguments:

    +
      +
    • singleSet: This is an object that contains the data for a single set of bars.
    • +
    • xScale0: This is a scale function that maps the domain values to the range values for the x-axis.
    • +
    • xScale1: This is a scale function that maps the domain values to the range values for the x-axis.
    • +
    • containerHeight: This is the height of the container that holds the chart. It is of type number.
    • +
    • xElement: This is the SVG element that represents the x-axis. It is of type SVGElement.
    • +
    +
  • +
+

Working algorithm:

+
    +
  • The _buildGraph method first creates two empty arrays called singleGroup and barLabelsForGroup. The yBarScale variable is then set to a new d3ScaleLinear object that represents the y-axis scale of the chart.
  • +
  • The method then iterates over each series in the current data point. For each series, the method calculates the x and y coordinates of the bar using the xScale1 and yBarScale scales, respectively. If the data property of the series is not null, the method creates a new rect element and adds it to the singleGroup array. The rect element has properties that define its position, size, color, and event handlers. If the data property of the series is not null and the hideLabels prop is false and the _barWidth property is greater than or equal to 16, the method creates a new text element and adds it to the barLabelsForGroup array. The text element displays the value of the data point above the bar.
  • +
  • If the wrapXAxisLables prop is false and the showXAxisLablesTooltip prop is true, the method creates a new tooltipProps object and calls the tooltipOfXAxislabels function to display a tooltip at the x-axis label.
  • +
  • Finally, the method returns a g element that contains the singleGroup and barLabelsForGroup arrays. The g element is translated to the x-coordinate of the current data point on the main x-axis using the xScale0 scale.
  • +
  • Legends: +
      +
    • +

      _getLegendData(): The method generates the legend for the chart. The method iterates over each data point and series in the chart and creates a legend object for each unique series. The method returns a Legends component that renders the legend using the legend objects.

      +

      Function arguments:

      +
        +
      • points: An array of IGroupedVerticalBarChartData objects, which contain the data points for the chart.
      • +
      • palette: An object of type IPalette, which contains the color palette for the chart. +The function returns a JSX element that renders the legend for the chart.
      • +
      +
    • +
    +
  • +
+

Working algorithm:

+
    +
  • The _getLegendData method starts by defining some variables. The data variable is set to the points argument. The defaultPalette variable is set to an array of colors to use for the legend. The actions variable is set to an empty array.
  • +
  • The method then iterates over each data point in the data array. For each data point, the method iterates over each series in the data point. For each series, the method checks if a similar legend has already been added to the actions array. If a similar legend exists, the method skips to the next series. If a similar legend does not exist, the method creates a new legend object and adds it to the actions array. The legend object contains a title property, which is set to the legend property of the current series, a color property, which is set to a random color from the defaultPalette array if the color property of the current series is not defined, and action, hoverAction, and onMouseOutAction properties, which are functions that handle click, hover, and mouse out events for the legend.
  • +
  • Finally, the method returns a Legends component that renders the legend for the chart. The legends prop is set to the actions array. The overflowProps, enabledWrapLines, focusZonePropsInHoverCard, and legendProps props are set to values from the props object.
  • +
  • Callouts: +
      +
    • _getCustomizedCallout(): The method returns a customized callout for a data point in the chart. The callout is rendered using the onRenderCalloutPerDataPoint prop, which is a function that takes a dataPointCalloutProps object as an argument and returns a React element.
    • +
    +
  • +
+

Working algorithm:

+
    +
  • The _getCustomizedCallout method first checks if the onRenderCalloutPerDataPoint prop is defined. If it is, the method calls the onRenderCalloutPerDataPoint function and passes in the dataPointCalloutProps object as an argument. The dataPointCalloutProps object contains information about the current data point, including its x and y values, as well as its color and data properties.
  • +
  • If the onRenderCalloutPerDataPoint prop is not defined, the _getCustomizedCallout method returns null.
  • +
  • Rendering details +The Grouped vertical bar chart uses d3 SVG based rendering, which follows the following render cycles: +
    - Invocation cycle: Grouped Vertical bar Chart -> Cartesian base chart -> X-axis -> X-axis labels -> Y-axis -> Y-axis labels -> bars, legends, callouts
    - Rendering cycle: Grouped vertical bar chart <- Bars (rect), Legends, Callouts <- Axes (d3.axis, d3.scale)
    +
  • +
+

Following are the detailed steps:

+
    +
  • The rendering of the grouped vertical bar chart is done using SVG elements. The chart is rendered inside a svg element that is created using the React.createElement() method.
  • +
  • The chart is divided into two main sections: the x-axis and the bars. The x-axis is created using the d3.axis() function and is rendered as a g element inside the svg element. The bars are created using the rect element and are rendered as a g element inside the svg element.
  • +
  • The rect elements are created using the datasetForBars array that is created using the _createDataset() method. The datasetForBars array contains an array of objects, where each object represents a group of bars. Each group of bars is rendered as a g element inside the svg element.
  • +
  • Inside each group of bars, the rect elements are created using the map() method on the data array. The map() method creates a new array of rect elements, where each rect element represents a bar in the group. The rect elements are positioned using the x and y attributes, which are calculated based on the data and the scales that were created earlier in the file.
  • +
  • The rect elements are also styled using various attributes such as fill, stroke, and strokeWidth. The fill attribute is set to a color that is based on the index of the rect element in the group. The stroke and strokeWidth attributes are used to create a border around each rect element.
  • +
  • The _onBarHover() method is used to handle the hover event on the bars. This method is called when the user hovers over a bar in the chart. The method updates the state of the component to show the callout for the hovered bar.
  • +
+

Overall, the grouped vertical bar chart is rendered using SVG elements that are created using the React.createElement() method. The chart is divided into two main sections: the x-axis and the bars. The bars are created using the rect element and are positioned and styled based on the data and the scales that were created earlier in the file. The _onBarHover() method is used to handle the hover event on the bars and show the callout for the hovered bar.

+
    +
  • Error scenarios +The Grouped Vertical bar chart handles the following error scenario: +
      +
    • Empty data: If the data passed to the chart component is empty, the chart will not render and a message will be narrated to the user. _isChartEmpty functions handles that scenario.
    • +
    +
  • +
  • Localization aspects +Currently, although the component has a support for culture prop, but it does not support localization yet.
  • +
  • Testing +The testing for Grouped Vertical bar chart have not been started. The document will be updated as and when the tests are completed. +GroupedVerticalBarChart3.png +
      +
    • Component Tests: + +
    • +
    • Unit Tests: + +
    • +
    • Manual Tests: + +
    • +
    • Accessibility Tests: + +
    • +
    +
  • +
  • Accessibility +FAST pass checks resulted in no error for Grouped Vertical bar chart. Link to the FAST pass tool +Our charts have elaborate accessibility support. The charts are WCAG 2.1 MAS C compliant for accessibility. +Consumers can define their own aria labels for each point by setting the callOutAccessibilityData property.
  • +
  • Theming +The palette for vertical bar chart is set from the "theme" prop as passed to the component during rendering. Both light and dark themes are supported and users can create there own theme too. Ref6  and Ref7  explains theming in detail.
  • +
  • Debugging +The detailed steps on debugging has been given in Debugging.
  • +
  • Variants +Following are the variants of vertical bar chart: Ref8  +
      +
    • Basic Grouped Vertical bar Chart: Only basic props are provided.
    • +
    • Custom Accessibility: Providing custom aria labels.
    • +
    • Styled: Can show bars with increased bar width.
    • +
    • Tooltip: Can show tooltip over x-axis ticks when the ticks are truncated.
    • +
    +
  • +
  • Interaction +Following are the interactions that are allowed for donut chart: +
      +
    • Mouse Events: +a. Hover mouse over a bar, should call the corresponding handler and show the callout over that bar. +b. On mouse move on Bar 1 (step 1) -> mouse leave (step 2) -> mouse move on Bar 2 (step 3), should render the callout of the Bar 2. +c. On mouse over, callout should be defined, on mouse leave, callout should disappear. +d. On mouse over on legends, should highlight the corresponding bar. +f. On click on Bar, should highlight the corresponding bar. +g. On mouse out after mouse over on first legend, should have opacity 0.1 for second bar initially (during mouseOver on first legend) and opacity set to 1 for both the bars on mouse out.
    • +
    • Keyboard Events: +a. On focus on a bar, should render the corresponding callout.
    • +
    +
  • +
  • Some notable PRs and their brief description + +
  • +
  • Learnings +
      +
    • While implementing the tests using react testing library, it was found that certain browser functions like getComputedTextLength() cannot be unit tested and needs to be tested End-to-End only.
    • +
    • Order of imports are important. +For example: for Vertical bar charts tests, improper sequencing of the imports (data first and then render) results in incorrect and incopmlete rendering of charts:
    • +
    +
  • +
+
  - import { chartPoints } from '../VerticalBarChart/VerticalBarChart.test';
- import { render, screen, queryAllByAttribute, fireEvent, act } from '@testing-library/react';
+

However, the following results in correct rendering:

+
import { render, screen, queryAllByAttribute } from '@testing-library/react';

import { chartPoints } from './VerticalBarChart.test';
+
    +
  • +

    Certain props need async await structure (waitFor in react testing library) for different props or nested SVGs to render.

    +
  • +
  • +

    Known issues

    +
      +
    • Setting the margins externally via the props may cut the x and y ticks if the margins provided are very less. Setting a minimum margin would prevent any such distortions.
    • +
    +
  • +
  • +

    Future improvements

    +

    Following are the list of future improvements for the vertical bar chart:

    +
      +
    • Improved accessibility: While the component already provides accessibility data for screen readers, there is always room for improvement in this area. Adding support for keyboard navigation and improving the accessibility of the callout would make the component more accessible to users with disabilities.
    • +
    • Support for animations: Adding support for animations, such as transitions between data updates or hover effects, would make the component more visually appealing and engaging for users.
    • +
    • Following error handling scenarios can be improved: +
        +
      • Invalid or missing chart dimensions: If the dimensions of the chart are invalid or missing, the chart will not render and a message will be displayed to the user.
      • +
      • Invalid or missing axis parameters: If the parameters for the x-axis or y-axis are invalid or missing, the chart will not render and a message will be displayed to the user.
      • +
      • Invalid or missing legends: If the legends for the chart are invalid or missing, the chart will not render and a message will be displayed to the user.
      • +
      • Invalid bar width: If the bar width for the chart is invalid, the chart will not render and a message will be displayed to the user.
      • +
      • Invalid or missing data for callout: If the data for the callout is invalid or missing, the callout will not render and a message will be displayed to the user.
      • +
      • Invalid or missing accessibility data: If the accessibility data for the chart is invalid or missing, the chart will not render and a message will be displayed to the user.
      • +
      +
    • +
    • Localization support can be improved for all strings and numbers.
    • +
    +
  • +
  • +

    Design figma +Vertical bar Chart Figma: Link 

    +
  • +
  • +

    Performance

    +

    The performance aspect of a donut chart refers to how efficiently and effectively it conveys information to the viewer. Here are some key considerations regarding the performance of a line chart:

    +
      +
    • Data Visualization Efficiency
    • +
    • Clarity and Simplicity
    • +
    • Responsiveness
    • +
    • Handling Large Datasets
    • +
    • Interactive Features
    • +
    +
  • +
+

We use Lighthouse tool for measuring the performance of our charts. Following are few of the scenarios for which we measure the performance score for vertical bar chart:

+
    +
  • References
  • +
+
    +
  1. D3-scale
  2. +
  3. D3-selection
  4. +
  5. D3-array
  6. +
  7. D3-axis
  8. +
  9. How to apply theme
  10. +
  11. Theming
  12. +
  13. Grouped Vertical Bar Chart
  14. +
+
    +
  • Appendix +The mathematical formulae used in the Grouped vertical bar chart component are as follows:
  • +
+
    +
  1. Formula for calculating the x0 scale using d3ScaleBand:
  2. +
+
x0 = d3ScaleBand()

.domain(data.map(d => d.category))

.range([0, width])

.paddingInner(x0_inner_padding)

- x0_inner_padding = space_between_groups/(space_between_groups + group_width)

- space_between_groups = 2 * bar_width

- group_width = this._keys.length * bar_width + (this._keys.length - 1) * space_between_bars
+
    +
  1. Formula for calculating the maximum value of the y-axis data using d3Max:
  2. +
+
const maxYValue = d3Max(data, d => d3Max(\_keys, key => d[key]))
+
    +
  1. Formula for calculating the y scale using d3ScaleLinear:
  2. +
+
y = d3ScaleLinear()

.domain([0, maxYValue])

.range([0, height])

height = containerHeight - marginsBottom - marginsTop
+
    +
  1. Formula for calculating the bar gap rate:
  2. +
+
x1_inner_padding = space_between_bars / (space_between_bars + bar_width)

=> space_between_bars = (x1_inner_padding / (1 - x1_inner_padding)) * bar_width

Rate at which the space between the bars in a group changes wrt the bar width

BAR_GAP_RATE = X1_INNER_PADDING / (1 - X1_INNER_PADDING)

X1_INNER_PADDING = 0.1
+
    +
  1. Formula for calculating the group width and bar width:
  2. +
+

Maximum possible group width to maintain 2:1 spacing:

+

InitialBarWidth = Math.min(props.barwidth || 16, 24);

+
(i) InitialGroupWidth = _keys.length * InitialBarWidth+ (_keys.length - 1) * BAR_GAP_RATE * InitialBarWidth
+

Total width required to render the bars. Directly proportional to bar width:

+
(ii) ReqWidth = _xAxisLabels.length * InitialGroupWidth  + (_xAxisLabels.length - 1) * 2 * InitialBarWidth

From (i) and (ii)

Maximum possible group width to maintain 2:1 spacing

MaxBandwidth = totalWidth / (_xAxisLabels.length +

(_xAxisLabels.length - 1) * (2 / (_keys.length + (_keys.length - 1) * BAR_GAP_RATE)))

FinalGroupWidth = MaxBandwidth;

From (i)

FinalBarWidth = FinalGroupWidth / (_keys.length + (_keys.length - 1) * BAR_GAP_RATE)
+
    +
  1. Formula for calculating the width of each bar:
  2. +
+
barWidth = (x0.bandwidth() - spaceBetweenBars) / this._keys.length
+ + \ No newline at end of file diff --git a/docs/Charting-Concepts/HeatMapChart.html b/docs/Charting-Concepts/HeatMapChart.html index 25989f4cbc..50e95ca2bb 100644 --- a/docs/Charting-Concepts/HeatMapChart.html +++ b/docs/Charting-Concepts/HeatMapChart.html @@ -5,11 +5,11 @@ Contributor guide: Heatmap Chart | FluentUI Charting Contrib Docsite - - + + -

Contributor guide: Heatmap Chart

+

Contributor guide: Heatmap Chart

A heatmap chart is a type of data visualization that represents data values as colors in a grid of rectangles. Each cell's color intensity corresponds to the value it represents, making it easy to spot patterns and variations in the data.

Use cases

Here are some common use cases for heatmap charts:

@@ -163,6 +163,6 @@

LearningsExtensions

+

Extensions

\ No newline at end of file diff --git a/docs/Charting-Concepts/HorizontalBarChart.html b/docs/Charting-Concepts/HorizontalBarChart.html index c93e1f5850..c1e09f3fc9 100644 --- a/docs/Charting-Concepts/HorizontalBarChart.html +++ b/docs/Charting-Concepts/HorizontalBarChart.html @@ -5,11 +5,11 @@ Contributor guide: Horizontal Bar Chart | FluentUI Charting Contrib Docsite - - + + -

Contributor guide: Horizontal Bar Chart

+

Contributor guide: Horizontal Bar Chart

A horizontal bar chart is a chart that presents categorical data with rectangular bars with lengths proportional to the values they represent. This type of chart is particularly useful when the intention is to show comparisons among different categories and the labels for those categories are long.

Use cases

Here are some common use cases for horizontal bar charts:

diff --git a/docs/Charting-Concepts/LineChart.html b/docs/Charting-Concepts/LineChart.html index b2c5e2246a..c0f0167160 100644 --- a/docs/Charting-Concepts/LineChart.html +++ b/docs/Charting-Concepts/LineChart.html @@ -5,11 +5,11 @@ Contributor guide: Line Chart | FluentUI Charting Contrib Docsite - - + + -

Contributor guide: Line Chart

+

Contributor guide: Line Chart

Line charts are a versatile type of graph used to visualize data trends over time. They are commonly used in various fields and industries for different purposes.

Use cases:

Line charts are used for various use cases which involve Trend Analysis, Performance Monitoring , Comparisions , Forecasting , Monitoring Changes , Communicating Data etc.

diff --git a/docs/Charting-Concepts/SankeyChart.html b/docs/Charting-Concepts/SankeyChart.html index 4227f07de0..d0002c0523 100644 --- a/docs/Charting-Concepts/SankeyChart.html +++ b/docs/Charting-Concepts/SankeyChart.html @@ -5,11 +5,11 @@ Contributor Guide: Sankey Chart | FluentUI Charting Contrib Docsite - - + + -

Contributor Guide: Sankey Chart

+

Contributor Guide: Sankey Chart

Sankey charts are a type of data visualization that are particularly useful for showing the flow of resources, energy, or information through a system. They are characterized by their flowing, interconnected arrows that represent the quantity or value of something as it moves from one stage or category to another.

Use cases:

Sankey charts are used for various use cases which involve Energy Flows, Material Flow Analysis, Website User Flow, Customer Journey Mapping, Water Usage and Conservation, Financial Flows, Environmental Impact, Project Management etc.

@@ -116,6 +116,6 @@

Hover Over

Hovering on the node with height less than 24px will display a callout with details of node name and weight.

When the user hovers over a link, the entire flow will be highlighted. All nodes will retain their original colors, while the links themselves will adopt a gradient color derived from the source and target nodes. Additionally, a callout will appear, displaying details about the link, such as the source node's name, weight, and the target node's name. To enhance the visual appeal, the link border will also transition into a gradient when the link is hovered over. Below is an example of a link being hovered over, in this case, between node 4 and node 12.

-

image.png

+

image.png

\ No newline at end of file diff --git a/docs/Charting-Concepts/SparklineChart.html b/docs/Charting-Concepts/SparklineChart.html new file mode 100644 index 0000000000..cd36e9a6c6 --- /dev/null +++ b/docs/Charting-Concepts/SparklineChart.html @@ -0,0 +1,212 @@ + + + + + +Contributor guide: Sparkline Chart | FluentUI Charting Contrib Docsite + + + + + +

Contributor guide: Sparkline Chart

+

Sparkline1.png

+

A Sparkline chart is a small, simple chart that is used to display trends over time or changes in data. It is typically used in dashboards or reports where space is limited. The chart consists of a line that shows the trend over time, and an area that shows the range of the data. The chart is designed to be small and compact, so it can be used in dashboards or reports where space is limited.

+
    +
  • Use cases +Following are some use cases for Sparkline Chart: +
      +
    • Displaying trends over time: Sparkline charts are great for showing trends over time, such as stock prices, website traffic, or weather patterns. By compressing the data into a small space, sparklines can quickly show whether the trend is up, down, or flat.
    • +
    • Showing changes in data: Sparkline charts can also be used to show changes in data, such as the number of sales per day or the number of website visitors per hour. By comparing the data points to each other, sparklines can show whether the changes are significant or not.
    • +
    • Comparing multiple data sets: Sparkline charts can be used to compare multiple data sets, such as the sales of different products or the performance of different teams. By placing the sparklines side by side, it's easy to see which data set is performing better.
    • +
    • Visualizing data in a small space: Sparkline charts are great for visualizing data in a small space, such as a dashboard or a report. By compressing the data into a small chart, sparklines can provide a quick overview of the data without taking up too much space.
    • +
    • Providing a quick overview of data: Sparkline charts can be used to provide a quick overview of data, such as the performance of a website or the progress of a project. By placing the sparkline chart in a prominent location, it's easy to see whether the data is trending in the right direction.
    • +
    • Displaying data in a dashboard or report: Sparkline charts are often used in dashboards or reports to provide a quick overview of data. By combining sparkline charts with other types of charts and graphs, it's possible to create a comprehensive view of the data.
    • +
    +
  • +
  • Mathematical/Geometrical concepts +The major D3 functions that are involved in the creation of Vertical bar charts are: +
      +
    • +

      d3-scale: +The d3-scale module is a part of the d3 library, which is a collection of JavaScript functions that are used for data visualization. The d3-scale module provides several functions for creating and manipulating scales, which are used to map data values to visual properties, such as position, size, and color.

      +

      The d3-scale module includes several scale types, including linear, logarithmic, power, and time scales. These scales are used to map continuous data values to a continuous range of visual properties. The module also includes ordinal and band scales, which are used to map categorical data values to a discrete range of visual properties.

      +
    • +
    +
  • +
+

The d3-scale module provides several functions for creating and manipulating scales, including scaleLinear, scaleLog, scalePow, scaleTime, scaleOrdinal, and scaleBand. These functions take one or more arguments that define the domain and range of the scale, as well as any additional properties, such as the number of ticks or the padding between bands.

+

Application in Sparkline chart: +In Sparkline chart, d3Scale is used to create a linear scale for the x and y axes of the sparkline chart.

+
    +
  • +

    d3.scaleLinear(): The d3.scaleLinear is a function from the d3-scale module that is used to create a linear scale for the y-axis of the chart. The linear scale maps a continuous domain of data values to a continuous range of visual properties, such as position or height. The d3ScaleLinear function takes no arguments and returns a new linear scale. The scale can be customized using several methods, including domain, range, clamp, and nice. The domain method sets the domain of the scale, which is the range of data values that the scale maps to the range of visual properties. The range method sets the range of the scale, which is the range of visual properties that the scale maps to the domain of data values.

    +

    Application in Sparkline chart:

    +
      +
    • In Sparkline chart, d3.scaleLinear() is used to create a linear scale for the x and y axes of the sparkline chart.
    • +
    • The x scale is created using the d3.scaleLinear() function and is defined by the minimum and maximum values of the x-axis data points.
    • +
    • The y scale is also created using the d3.scaleLinear() function and is defined by the minimum and maximum values of the y-axis data points.
    • +
    • These scales are then used to map the data points to the corresponding positions on the chart.
    • +
    +
  • +
  • +

    d3-shape: The d3-shape library provides various functions for creating and manipulating shapes such as arcs, lines, and areas. Following are the main mathematical/geometrical concepts that are used while drawing a Sparkline chart. +Application in Sparkline chart:

    +
      +
    • d3.area(): In Sparkline chart, d3.area() is used to create an area chart for the Sparkline component. It is initialized in the componentDidMount method and takes in an array of data points as input. The x and y values of each data point are used to create the shape of the area chart. The x value is mapped to the x-axis and the y value is mapped to the y-axis. The area chart is then rendered using the drawSparkline method, which returns a path element with the class name "area". The fill color of the area chart is set to the color of the line chart data point and the opacity is set to 0.2. The aria-label attribute is also set to the legend of the line chart data point.
    • +
    • d3.line(): In Sparkline chart, d3Line is used to create a line generator function that is used to generate a line path for the Sparkline chart. The line generator function takes an array of data points and generates a path string that represents the line connecting those points. The x and y values of each data point are mapped to the x and y coordinates of the line path using the x and y scales created using d3.scaleLinear(). The curveLinear function is used to specify the type of curve used to interpolate between the data points. The resulting line path is then rendered in the SVG element of the Sparkline chart.
    • +
    • d3.curveLinear(): In the Sparkline chart, d3.curveLinear() is used to define the curve type for the line and area charts in the Sparkline component. It is used in the componentDidMount method to create an area and line function that will be used to draw the chart. The curve method is called on both the area and line functions, passing in d3.curveLinear() as the argument. This sets the curve type to be a straight line between each data point. This means that the line and area charts will be drawn with straight lines connecting each data point, rather than a curved line.
    • +
    +
  • +
  • +

    d3-array: The d3-array is a module from the d3 library that is used to manipulate arrays of data in the chart component. The d3-array module provides several functions for manipulating arrays of data, including max, min, extent, sum, and mean. The max function is used to find the maximum value in an array of data. The min function is used to find the minimum value in an array of data. The extent function is used to find the minimum and maximum values in an array of data. The sum function is used to find the sum of the values in an array of data. The mean function is used to find the mean (average) of the values in an array of data.

    +

    Application in Sparkline chart:

    +
      +
    • d3.max(): In Sparkline chart, d3.max() is used to find the maximum value of the y-axis domain for the Sparkline chart. It takes an array of data points and a function that returns the value to be compared. In this case, it compares the y value of each data point. The maximum y value is then used to set the upper limit of the y-axis scale.
    • +
    • d3.extent(): In Sparkline chart, d3.extent() is used to calculate the minimum and maximum values of the x-axis of the sparkline chart. It takes an array of data points as its first argument and a function that returns the value to be used for the extent calculation as its second argument. In this case, the function returns the x-value of each data point. The resulting array of minimum and maximum values is then used to set the domain of the x-axis scale.
    • +
    +
  • +
  • +

    Dev Design details +This section contains the technical design of various sub-components of a Sparkline chart and how they interact with each other. This section can also contain any key interface or class structure of the donut chart. +The Sparkline chart consists of the following sub-components:

    +

    1. Line:

    +
      +
    • +

      Line creation: In the Sparkline chart, the line is created using the d3Line() function from the d3-shape library. The d3Line() function generates a line generator function that can be used to generate a line path string for the given data points.

      +

      In the Sparkline component, the line variable is assigned to the line generator function created using d3Line(). The x and y values for each data point are specified using the x() and y() methods of the line generator function, respectively. The curve() method is used to specify the type of curve to use for the line.

      +
    • +
    +
  • +
+

Finally, the line path string is generated by calling the line() method of the line generator function with the array of data points as its argument. This path string is then used to draw the line in the chart.

+

2. Area:

+
    +
  • Area creation: The area in the Sparkline chart is created using the d3.area() function from the d3-shape library. The d3.area() function generates an area shape for the given data points. In this code, the d3.area() function is called with the following parameters: +
      +
    • .x((d: any) => this.x(d.x)): This sets the x-coordinate of each point in the area to the corresponding x-coordinate of the data point.
    • +
    • .y0(this.state._height): This sets the y-coordinate of the bottom of the area to the height of the Sparkline chart.
    • +
    • .y1((d: any) => this.y(d.y)): This sets the y-coordinate of each point in the area to the corresponding y-coordinate of the data point.
    • +
    • .curve(d3curveLinear): This sets the curve of the area to a linear curve.
    • +
    +
  • +
+

The resulting area shape is then rendered in the drawSparkline method of the Sparkline component.

+

3. Legend:

+
    +
  • If showLegend prop is set to true, the chart displays the value of the legend which is mentioned in the provided data. Otherwise, no value is displayed.
  • +
  • Rendering details
  • +
+
    +
  1. +

    A Sparkline chart is drawn using a line and an area that represent the trend of the data over time. The line shows the trend of the data, while the area shows the range of the data. The chart is typically small and compact, making it ideal for displaying trends and changes in data in a small space.

    +
  2. +
  3. +

    The chart is drawn using the D3 (Data-Driven Documents) library. The drawSparkline method of the Sparkline component returns a JSX element that contains two SVG paths, one for the line and one for the area.

    +
  4. +
  5. +

    The line and area variables are created using the d3.line() and d3.area() functions respectively. These functions take an array of data points and generate a path string that can be used to draw the line or area.

    +
  6. +
  7. +

    The x and y scales are created using the d3.scaleLinear() function, which maps the data points to the x and y coordinates of the chart. The domain method sets the range of the data, while the range method sets the range of the chart.

    +
  8. +
  9. +

    Once the scales are created, the line and area functions are called with the data points to generate the path strings. These path strings are then used to draw the line and area on the chart.

    +
  10. +
  11. +

    The drawSparkline method also sets the stroke and fill colors of the line and area based on the color property of the lineChartData object. The opacity and fillOpacity properties are also set to control the transparency of the chart.

    +
  12. +
  13. +

    Finally, the aria-label property is set to provide an accessible label for the chart. This label includes the legend text of the lineChartData object.

    +

    Overall, the Sparkline chart is drawn using D3 to generate the path strings for the line and area of the chart and sets the properties of the chart based on the lineChartData object.

    +
  14. +
+
    +
  • Error scenarios +
      +
    • The Sparkline chart handles the scenario where there is no data to display. In this case, it displays a message stating that the graph has no data to display. This is done by rendering a div with an id of _SparklineChart_empty and setting its opacity to 0. The div has an aria-label attribute with the value "Graph has no data to display".
    • +
    +
  • +
  • Localization aspects +Currently, Sparkline chart does not provide any localization support.
  • +
  • Testing +Following is the test report for Sparkline Chart: +Sparkline2.png
  • +
  • Accessibility +FAST pass checks resulted in no error for Sparkline chart. Link to the FAST pass tool  +Our charts have elaborate accessibility support. The charts are WCAG 2.1 MAS C compliant for accessibility.
  • +
  • Theming +The palette for donut chart is set from the "theme" prop as passed to the component during rendering. Both light and dark themes are supported and users can create there own theme too. Ref3  and Ref4  explains theming in detail.
  • +
  • Debugging +The detailed steps on debugging has been given in Debugging.
  • +
  • Variants +Following are the variants of donut chart: Ref2  +
      +
    • Basic Sparkline Chart: Only basic props are provided.
    • +
    +
  • +
  • Interaction +Following are the interactions that are allowed for Sparkline chart: +
      +
    • The Sparkline charts are focusable using mouse and keyboard.
    • +
    +
  • +
  • Some notable PRs and their brief description + +
  • +
  • Learnings +
      +
    • While implementing the tests using react testing library, it was found that certain browser functions like getComputedTextLength() cannot be unit tested and needs to be tested End-to-End only.
    • +
    • Order of imports are important. +For example: for Vertical bar charts tests, improper sequencing of the imports (data first and then render) results in incorrect and incomplete rendering of charts:
    • +
    +
  • +
+
  - import { chartPoints } from '../VerticalBarChart/VerticalBarChart.test';
- import { render, screen, queryAllByAttribute, fireEvent, act } from '@testing-library/react';
+

However, the following results in correct rendering:

+
import { render, screen, queryAllByAttribute } from '@testing-library/react';

import { chartPoints } from './VerticalBarChart.test';
+
    +
  • +

    Certain props need async await structure (waitFor in react testing library) for different props or nested SVGs to render.

    +
  • +
  • +

    Future improvements

    +

    Following are the list of potential future improvements for the Sparkline chart:

    +
      +
    • Add sub-components: Callouts can be added on hover over a point on Sparkline chart.
    • +
    • Add support for multiple data series: Currently, the component only supports a single data series. It could be improved to allow for multiple series to be displayed on the same chart.
    • +
    • Improve accessibility: The component could be improved to better support accessibility, such as by adding support for keyboard navigation and improving the use of ARIA attributes.
    • +
    • Add support for custom styling: Currently, the component has a limited set of styles that can be customized. It could be improved to allow for more customization, such as by allowing users to specify custom CSS classes or inline styles.
    • +
    • Improve performance: Depending on the size of the data set, the component could potentially have performance issues. It could be improved to better handle large data sets or to use more performant rendering techniques, such as canvas rendering.
    • +
    +
  • +
  • +

    Design figma +Sparkline Chart Figma: Link 

    +
  • +
  • +

    Performance

    +

    The performance aspect of a donut chart refers to how efficiently and effectively it conveys information to the viewer. Here are some key considerations regarding the performance of a line chart:

    +
      +
    • Data Visualization Efficiency
    • +
    • Clarity and Simplicity
    • +
    • Responsiveness
    • +
    • Handling Large Datasets +-Interactive Features
    • +
    +
  • +
  • +

    References

    +
  • +
+
    +
  1. D3-shape
  2. +
  3. Sparkline Chart
  4. +
  5. Theming 
  6. +
  7. How to apply theme
  8. +
+ + \ No newline at end of file diff --git a/docs/Charting-Concepts/StackedBarChart.html b/docs/Charting-Concepts/StackedBarChart.html index 0e309da213..553b50b184 100644 --- a/docs/Charting-Concepts/StackedBarChart.html +++ b/docs/Charting-Concepts/StackedBarChart.html @@ -5,11 +5,11 @@ Contributor guide: Stacked Bar Chart | FluentUI Charting Contrib Docsite - - + + -

Contributor guide: Stacked Bar Chart

+

Contributor guide: Stacked Bar Chart

A stacked bar chart is a type of data visualization that represents data using rectangular bars with lengths proportional to the values they represent. In a stacked bar chart, each bar is divided into segments, and the segments represent different categories or components. The segments are stacked next to each other to show the total value of each bar.

Use cases

Here are some common use cases for stacked bar charts:

@@ -205,6 +205,6 @@

Design figmaHorizontal stacked bar chart – Figma

Learnings

-

Extensions

+

Extensions

\ No newline at end of file diff --git a/docs/Charting-Concepts/VerticalBarChart.html b/docs/Charting-Concepts/VerticalBarChart.html new file mode 100644 index 0000000000..b8bc794ff4 --- /dev/null +++ b/docs/Charting-Concepts/VerticalBarChart.html @@ -0,0 +1,617 @@ + + + + + +Contributor guide: Vertical Bar Chart | FluentUI Charting Contrib Docsite + + + + + +

Contributor guide: Vertical Bar Chart

+

VerticalBarChart1.png

+

A vertical bar chart is a type of chart that displays data as a series of vertical bars, with each bar representing a category and the height of the bar representing the value of that category. It is commonly used to compare the values of different categories. In addition, it can also include a line chart that displays a trend line or a target line. This type of chart is commonly used to show the relationship between the actual values and the target values or to show the trend of the data over time.

+
    +
  • Use cases +Some common use cases of vertical bar charts are as follows: +
      +
    • Comparing values of different categories
    • +
    • Showing changes in data over time
    • +
    • Displaying data that can be easily divided into categories
    • +
    • Highlighting the highest or lowest values in a dataset
    • +
    • Showing the distribution of data across categories
    • +
    • Displaying survey results or feedback data
    • +
    • Comparing performance metrics of different products or services
    • +
    • Analyzing sales data by region or product category
    • +
    • Displaying financial data such as revenue or profit by quarter or year
    • +
    +
  • +
  • Mathematical/Geometrical concepts
  • +
+

VerticalBarChart2.png

+

The major D3 functions that are involved in the creation of Vertical bar charts are:

+
    +
  • +

    d3-scale: +The d3-scale module is a part of the d3 library, which is a collection of JavaScript functions that are used for data visualization. The d3-scale module provides several functions for creating and manipulating scales, which are used to map data values to visual properties, such as position, size, and color.

    +

    The d3-scale module includes several scale types, including linear, logarithmic, power, and time scales. These scales are used to map continuous data values to a continuous range of visual properties. The module also includes ordinal and band scales, which are used to map categorical data values to a discrete range of visual properties.

    +
  • +
+

The d3-scale module provides several functions for creating and manipulating scales, including scaleLinear, scaleLog, scalePow, scaleTime, scaleOrdinal, and scaleBand. These functions take one or more arguments that define the domain and range of the scale, as well as any additional properties, such as the number of ticks or the padding between bands.

+

Application in Vertical bar chart: +Vertical bar chart uses the d3-scale module to create a linear scale for the y-axis of the chart. The linear scale maps a continuous domain of data values to a continuous range of visual properties, such as position or height.

+

In Vertical bar chart, the d3ScaleLinear function is used to create the xBarScale, yBarScale and colorScale properties of the component.

+
    +
  • +

    xBarScale: It is a function that can be used to map input values to positions on the x-axis of the chart. When an input value is passed to the xBarScale function, it will return a position value that corresponds to the input value based on the specified domain and range. d3.scaleLinear() is used to create xBarScale for Numeric scales. Otherwise, d3.scaleBand() is used.

    +
  • +
  • +

    yBarScale: It is a function that can be used to map input values to positions on the y-axis of the chart. When an input value is passed to the yBarScale function, it will return a position value that corresponds to the input value based on the specified domain and range.

    +
  • +
  • +

    colorScale: It is a function that can be used to map input values to colors. When an input value is passed to the colorScale function, it will return a color value that corresponds to the input value based on the specified domain and range.

    +
  • +
  • +

    d3-shape: The d3-shape library provides various functions for creating and manipulating shapes such as arcs, lines, and areas. Following are the main mathematical/geometrical concepts that are used while drawing a vertical bar chart.

    +

    Application in Vertical bar chart: +In Vertical bar chart, d3.line() is a function from the d3-shape module that is used to create a line generator for the line chart in the chart component. The line generator is used to generate a path element that represents the line chart based on the data points and the x and y scales.

    +
      +
    • +

      d3.line(): The d3Line function takes no arguments and returns a new line generator. The line generator can be customized using several methods, including x, y, defined, and curve. The x and y methods set the x and y accessors for the line generator, which define how the x and y values of the data points are mapped to the x and y positions of the line. The defined method sets a function that determines whether a data point is defined or not, which can be used to handle missing or invalid data. The curve method sets the curve interpolation for the line, which determines how the line is smoothed between the data points.

      +

      Application in Vertical bar chart: +In Vertical bar chart, the d3Line function is used to create the linePath of the component, which is the line generator for the line chart on top of the vertical bar chart. The linePath variable is created using the d3Line function and is customized using the x and y methods.

      +
    • +
    +
  • +
+

The x method uses a ternary operator to check if the x-axis is a numeric axis or not. If the x-axis is not a numeric axis, the function uses the xBarScale function to calculate the x-coordinate of the line chart. The xBarScale function is a scale function that maps the x-axis values to the x-coordinates of the vertical bars in the chart. If the x-axis is a numeric axis, the function uses the xScale function to calculate the x-coordinate of the line chart. The xScale function is a scale function that maps the x-axis values to the x-coordinates of the chart.

+

The y method uses a ternary operator to check if the data point should use the secondary y-axis or not. If the data point should use the secondary y-axis, the function uses the yScaleSecondary function to calculate the y-coordinate of the line chart. The yScaleSecondary function is a scale function that maps the y-axis values to the y-coordinates of the secondary y-axis. If the data point should not use the secondary y-axis, the function uses the yScale function to calculate the y-coordinate of the line chart. The yScale function is a scale function that maps the y-axis values to the y-coordinates of the chart.

+
    +
  • +

    d3-selection: The d3-selection is a module from the d3 library that is used to select and manipulate DOM elements in the chart component. The d3-selection module provides several functions for selecting and manipulating DOM elements, including select, selectAll, append, attr, and style. The select function is used to select a single DOM element that matches a given selector. The selectAll function is used to select multiple DOM elements that match a given selector. The append function is used to append a new DOM element to a selected element. The attr function is used to set or get an attribute of a selected element. The style function is used to set or get a style property of a selected element.

    +

    Application in Vertical bar chart: +In Vertical bar chart, the d3-selection module is used to select and manipulate several DOM elements in the chart component. For example, the d3Selection.select function is used to select the xElement element, which is a reference to the SVG element that contains the x-axis.

    +
  • +
  • +

    d3-array: The d3-array is a module from the d3 library that is used to manipulate arrays of data in the chart component. The d3-array module provides several functions for manipulating arrays of data, including max, min, extent, sum, and mean. The max function is used to find the maximum value in an array of data. The min function is used to find the minimum value in an array of data. The extent function is used to find the minimum and maximum values in an array of data. The sum function is used to find the sum of the values in an array of data. The mean function is used to find the mean (average) of the values in an array of data.

    +

    Application in Vertical bar chart: +In Vertical bar chart, the d3-array module is used to manipulate the data array that represents the data points in the chart component. For example, the d3Array.max function is used to find the maximum value of the y-values in the data array, which is used to set the domain of the y-axis scale. The d3Array.min function is used to find the minimum value of the y-values in the data array, which is also used to set the domain of the y-axis scale.

    +
  • +
  • +

    d3-format: The d3-format is a module from the d3 library that is used to format numbers and strings in the chart component. The d3-format module provides several functions for formatting numbers and strings, including format, formatPrefix, precisionFixed, and precisionRound.

    +

    The format function is used to format a number or string using a specified format string. The format string can include placeholders for the value, such as % for a percentage or , for a comma-separated number. The formatPrefix function is used to format a number using a prefix notation that rounds the value to a specified precision and appends a prefix, such as k for thousands or M for millions. The precisionFixed function is used to format a number using a fixed number of decimal places. The precisionRound function is used to format a number using a variable number of decimal places that is determined by the magnitude of the value.

    +
  • +
+

Application in Vertical bar chart: +In Vertical bar chart, the d3-format module is used to format the labels for the bars in the chart component. For example, the _renderBarLabel method uses the d3FormatPrefix function to format the value of the bar using a prefix notation that rounds the value to two decimal places if the value is less than 1000, or to one decimal place if the value is greater than or equal to 1000. The formatted value is then appended to the text element as its content.

+
    +
  • +

    d3-axis: The d3-axis module is a part of the d3 library, which is a collection of JavaScript functions that are used for data visualization. The d3-axis module provides several functions for creating and manipulating axes, which are used to display the scales of a chart component.

    +

    In data visualization, axes are used to display the scales of a chart component, such as the x-axis and y-axis of a bar chart. Axes provide visual cues to help readers interpret the data values of a chart component, such as the range and domain of the data values.

    +
  • +
+

The d3-axis module provides several types of axes, including bottom, top, left, and right axes. Each type of axis has its own set of methods for customizing the axis and displaying the tick values.

+

Application in Vertical bar chart: +In the Vertical stacked bar chart, d3-axis is used to create and render the x and y axes of the chart.

+
    +
  • +

    The d3-axis library provides various methods for creating and rendering axes, such as axisBottom(), axisLeft(), and tickFormat(). In this case, the d3-axis library is used to create and render the x and y axes of the chart.

    +
  • +
  • +

    To create the x and y axes, the d3-axis library's axisBottom() and axisLeft() methods are used, respectively. These methods take a scale function as an argument and return a new axis function that can be used to render the axis.

    +
  • +
  • +

    The resulting x and y axis functions are then used to render the x and y axes of the chart. The call() method of the selection object is used to call the axis function and render the axis.

    +
  • +
  • +

    The tickFormat() method of the y-axis scale is also used to set the tick format function for the y-axis. This method takes the format function created using the d3-format library as an argument and sets it as the tick format function for the y-axis.

    +
  • +
  • +

    Dev Deisgn Details: +Following are the major components that contribute towards creating a complete vertical bar chart:

    +
      +
    • Axes: +
        +
      • +

        _getScales(): This method is responsible for generating the x and y scales that are used to map the data points to the chart dimensions. The scales are generated using the d3-scale library, which provides several scale types for different types of data.

        +

        Function arguments:

        +
          +
        • containerHeight: a number representing the height of the container element that the chart is rendered in.
        • +
        • containerWidth: a number representing the width of the container element that the chart is rendered in.
        • +
        • isNumericScale: a boolean value indicating whether the x-axis scale is numeric or not.
        • +
        +
      • +
      +
    • +
    +
  • +
+

Working algorithm:

+
    +
  • +

    The _getScales method takes several arguments, including containerHeight, containerWidth, and isNumericScale. These arguments are used to define the dimensions of the chart and to determine whether the x-axis is a numeric or categorical axis.

    +
  • +
  • +

    If the x-axis is a numeric axis, the method uses the d3ScaleLinear function to create a linear scale for the x-axis. It first calculates the maximum and minimum x-values in the data using the d3Max and d3Min functions, respectively. It then creates a linear scale that maps the x-values to the chart dimensions using the domain and range methods. The nice method is also called on the x-axis scale to ensure that the tick values are rounded to the nearest integer.

    +
  • +
  • +

    If the x-axis is a categorical axis, the method uses the d3ScaleBand function to create a band scale for the x-axis. It first extracts the x-axis labels from the data and uses them to define the domain of the scale. It then creates a band scale that maps the x-axis labels to the chart dimensions using the domain and range methods. The paddingInner method is also called on the x-axis scale to ensure that there is some space between the bars.

    +
  • +
  • +

    For the y-axis, the method always uses the d3ScaleLinear function to create a linear scale that maps the y-values to the chart dimensions. It first defines the domain of the scale as [0, this._yMax], where _yMax is the maximum y-value in the data. It then defines the range of the scale as [0, containerHeight - this.margins.bottom! - this.margins.top!], where containerHeight is the height of the chart container and this.margins.bottom! and this.margins.top! are the bottom and top margins of the chart, respectively.

    +
  • +
  • +

    Finally, the method returns an object that contains the x and y scales for the chart. The x and y scales are returned as separate properties of the object.

    +
  • +
  • +

    _getDomainMargins(): This method is responsible for calculating the margins for the chart based on the available container width and the number of x-axis labels. The margins are used to center the chart and to ensure that the bars are evenly spaced.

    +

    Function arguments:

    +
      +
    • containerWidth which is a number representing the width of the container in which the chart is being rendered.
    • +
    +
  • +
+

Working algorithm:

+
    +
  • +

    The _getDomainMargins method takes one argument, containerWidth, which is the width of the container that the chart is rendered in. It first checks whether the x-axis is a numeric axis or a categorical axis. If the x-axis is a categorical axis, the method returns the margins defined in the margins prop.

    +
  • +
  • +

    If the x-axis is a numeric axis, the method calculates the total width available to render the bars by subtracting the left and right margins and the minimum domain margin from the container width. It then calculates the required width to render the bars based on the number of x-axis labels and the bar width. If the total width is greater than or equal to the required width, the method centers the chart by setting equal left and right margins for the domain. If the total width is less than the required width, the method calculates the maximum possible bar width to maintain a 2:1 spacing between the bars.

    +
  • +
  • +

    The method then sets the _domainMargin and _barWidth properties of the component based on the calculated margins and bar width. It returns an object that contains the updated margins, with the left and right margins increased by the _domainMargin value.

    +
  • +
  • +

    createNumericXAxis(): This function is responsible for creating a numeric x-axis for a chart component. The function takes two arguments: xAxisParams and chartType. xAxisParams is an object that contains several properties, including domainNRangeValues, showRoundOffXTickValues, xAxistickSize, tickPadding, xAxisCount, and xAxisElement. chartType is an enumeration that specifies the type of chart component.

    +

    Function arguments:

    +
      +
    • xAxisParams of type IXAxisParams which is an object containing the following properties: +
        +
      • domainNRangeValues of type IDomainNRange which is an object containing the domain and range values for the x-axis.
      • +
      • showRoundOffXTickValues of type boolean which is an optional property that determines whether to round off the x-axis tick values.
      • +
      • xAxistickSize of type number which is an optional property that determines the size of the x-axis ticks.
      • +
      • tickPadding of type number which is an optional property that determines the padding between the x-axis ticks and the x-axis labels.
      • +
      • xAxisCount of type number which is an optional property that determines the number of x-axis ticks.
      • +
      • xAxisElement of type SVGElement | null which is an optional property that represents the x-axis element.
      • +
      +
    • +
    • chartType of type ChartTypes which is an enum that represents the type of chart.
    • +
    • culture of type string which is an optional paramter represents the locale into which the numeric x-axis labels will be localized.
    • +
    +
  • +
+

Working algorithm:

+
    +
  • The function first extracts the properties of the xAxisParams object using destructuring. The domainNRangeValues property is an object that contains the start and end values of the domain and range of the x-axis. The showRoundOffXTickValues property is a boolean that specifies whether to round off the tick values of the x-axis. The xAxistickSize property is a number that specifies the size of the ticks of the x-axis. The tickPadding property is a number that specifies the padding between the ticks and the labels of the x-axis. The xAxisCount property is a number that specifies the number of ticks of the x-axis. The xAxisElement property is a reference to the DOM node that contains the x-axis of the chart.
  • +
  • The function then creates a linear scale for the x-axis using the d3ScaleLinear function from the d3-scale module. The scale is customized using the domain and range methods, which set the domain and range of the scale, respectively. If the showRoundOffXTickValues property is true, the nice method is called on the scale to round off the tick values of the x-axis.
  • +
  • The function then creates a bottom axis for the x-axis using the d3AxisBottom function from the d3-axis module. The axis is customized using the tickSize, tickPadding, ticks, and tickFormat methods. The tickSize method sets the size of the ticks of the x-axis. The tickPadding method sets the padding between the ticks and the labels of the x-axis. The ticks method sets the number of ticks of the x-axis. The tickFormat method formats the tick values of the x-axis using the convertToLocaleString function and the culture parameter.
  • +
  • If the xAxisElement property is not null, the axis is rendered on the DOM node using the call method of the d3-selection module. The selectAll method is called on the axis to select all the text elements of the x-axis, and the attr method is called to set the aria-hidden attribute of the text elements to true.
  • +
  • Finally, the function computes the tick values of the x-axis using the ticks and tickFormat methods of the scale, and returns an object that contains the x-axis scale and the tick values.
  • +
  • createStringXAxis(): This function is responsible for creating a string x-axis for a chart component. The function takes four arguments: xAxisParams, tickParams, dataset, and culture. xAxisParams is an object that contains several properties, including domainNRangeValues, xAxisCount, xAxistickSize, tickPadding, xAxisPadding, xAxisInnerPadding, and xAxisOuterPadding. tickParams is an object that contains several properties, including tickValues and tickFormat. dataset is an array of strings that contains the values of the x-axis. culture is a string that specifies the locale into which the x-axis labels can be localized.
  • +
+

Function Arguments:

+
    +
  • xAxisParams: An object containing the parameters for the x-axis, including the domain and range values, tick size, tick padding, number of ticks, padding for the inner and outer edges of the axis, and the element to render the axis.
  • +
  • tickParams: An object containing the parameters for the ticks on the x-axis, including the tick values and tick format.
  • +
  • dataset: An array of strings representing the data points for the x-axis.
  • +
  • culture: An optional string representing the culture to use for formatting the tick labels on the x-axis. However, the localization works only if the string can be converted to a numeric value. Otherwise, the x-axis labels remain unlocalized.
  • +
+

Working algorithm:

+
    +
  • +

    The function first extracts the properties of the xAxisParams object using destructuring. The domainNRangeValues property is an object that contains the start and end values of the domain and range of the x-axis. The xAxisCount property is a number that specifies the number of ticks of the x-axis. The xAxistickSize property is a number that specifies the size of the ticks of the x-axis. The tickPadding property is a number that specifies the padding between the ticks and the labels of the x-axis. The xAxisPadding property is a number that specifies the padding between the bars of the chart. The xAxisInnerPadding property is a number that specifies the inner padding between the bars of the chart. The xAxisOuterPadding property is a number that specifies the outer padding between the bars of the chart.

    +
  • +
  • +

    The function then creates a band scale for the x-axis using the d3ScaleBand function from the d3-scale module. The scale is customized using the domain and range methods, which set the domain and range of the scale, respectively. The paddingInner and paddingOuter methods are used to set the inner and outer padding between the bars of the chart, respectively.

    +
  • +
  • +

    The function then creates a bottom axis for the x-axis using the d3AxisBottom function from the d3-axis module. The axis is customized using the tickSize, tickPadding, ticks, and tickFormat methods. The tickSize method sets the size of the ticks of the x-axis. The tickPadding method sets the padding between the ticks and the labels of the x-axis. The ticks method sets the number of ticks of the x-axis. The tickFormat method formats the tick values of the x-axis using the convertToLocaleString function and the culture parameter.

    +
  • +
  • +

    If the xAxisParams.xAxisElement property is not null, the axis is rendered on the DOM node using the call method of the d3-selection module. The selectAll method is called on the axis to select all the text elements of the x-axis, and the attr method is called to set the aria-hidden attribute of the text elements to true.

    +
  • +
  • +

    Finally, the function computes the tick values of the x-axis using the tickFormat method of the axis, and returns an object that contains the x-axis scale and the tick values.

    +
  • +
  • +

    createYAxis(): In the Vertical bar chart component, the d3-axis module is used to create and customize the y-axis of a vertical bar chart. The createYAxis function is responsible for creating the y-axis using the createYAxisForOtherCharts function. The function takes in several parameters, including yAxisParams, isRtl, axisData, and useSecondaryYScale. These parameters are used to customize the y-axis, such as setting the tick values, tick format, and tick padding.

    +

    Function arguments:

    +
      +
    • yAxisParams: An object that contains various parameters related to the y-axis of the chart. It has the following properties: +
        +
      • yMinMaxValues: An object that contains the start and end values of the y-axis.
      • +
      • yAxisElement: The DOM element that represents the y-axis.
      • +
      • yMaxValue: The maximum value of the y-axis.
      • +
      • yMinValue: The minimum value of the y-axis.
      • +
      • containerHeight: The height of the container that holds the chart.
      • +
      • containerWidth: The width of the container that holds the chart.
      • +
      • margins: An object that contains the margins of the chart.
      • +
      • tickPadding: The padding between the ticks and the axis line.
      • +
      • maxOfYVal: The maximum value of the y-axis for area chart and Grouped vertical bar chart.
      • +
      • yAxisTickFormat: The format of the y-axis tick labels.
      • +
      • yAxisTickCount: The number of ticks on the y-axis.
      • +
      • eventAnnotationProps: An object that contains the properties of the event annotation.
      • +
      • eventLabelHeight: The height of the event label.
      • +
      +
    • +
    • isRtl: A boolean value that indicates whether the chart is in right-to-left mode.
    • +
    • axisData: An object that contains the data related to the axis of the chart.
    • +
    • useSecondaryYScale: A boolean value that indicates whether to use a secondary y-axis scale.
    • +
    +
  • +
+

Working algorithm:

+
    +
  • +

    The function first extracts the necessary parameters from the yAxisParams object, such as the yMinMaxValues, yAxisElement, containerHeight, and containerWidth. It then calculates the final maximum and minimum values for the y-axis, based on the maxOfYVal, yMaxValue, and yMinValue parameters.

    +
  • +
  • +

    The function then prepares the datapoints for the y-axis using the prepareDatapoints function, which calculates the tick values based on the maximum and minimum values of the y-axis. It then creates a linear scale for the y-axis using the d3ScaleLinear function from the d3-scale library.

    +
  • +
  • +

    The function then creates the y-axis using the d3AxisLeft or d3AxisRight function from the d3-axis library, depending on the isRtl and useSecondaryYScale parameters. It sets the tick padding, tick values, and tick size for the y-axis, and formats the tick labels using the yAxisTickFormat parameter.

    +
  • +
  • +

    Finally, the function uses the d3Select function to select the yAxisElement and apply the y-axis to it using the call method. It also sets the aria-hidden attribute of the y-axis text elements to true to improve accessibility.

    +
  • +
  • +

    createStringYAxis(): In the Vertical bar chart component, the d3-axis module is used to create and customize the y-axis of a vertical bar chart. The createStringYAxis function is responsible for creating the y-axis that use string values for the y-axis using the createStringYAxisForOtherCharts function. The function takes in several parameters, including yAxisParams, dataPoints, and isRtl. These parameters are used to customize the y-axis, such as setting the tick values, tick format, and tick padding.

    +

    Function arguments:

    +
      +
    • yAxisParams: An object that contains the parameters for the y-axis, including containerHeight, tickPadding, margins, yAxisTickFormat, yAxisElement, and yAxisPadding.
    • +
    • dataPoints: An array of strings that represent the data points for the y-axis.
    • +
    • isRtl: A boolean value that indicates whether the chart is in right-to-left mode.
    • +
    +
  • +
+

Working algorithm:

+
    +
  • The function first extracts the necessary parameters from the yAxisParams object, such as the containerHeight, margins, yAxisTickFormat, yAxisElement, and yAxisPadding. It then creates a band scale for the y-axis using the d3ScaleBand function from the d3-scale library.
  • +
  • The band scale is defined using the dataPoints array as the domain, and the containerHeight and margins parameters as the range. The padding method is used to set the padding between the bands in the y-axis.
  • +
  • The function then creates the y-axis using the d3AxisLeft or d3AxisRight function from the d3-axis library, depending on the isRtl parameter. It sets the tick padding, tick values, and tick size for the y-axis, and formats the tick labels using the yAxisTickFormat parameter.
  • +
  • Finally, the function uses the d3Select function to select the yAxisElement and apply the y-axis to it using the call method. It also selects all the text elements of the y-axis and returns the y-axis scale.
  • +
  • Bars: +
      +
    • +

      Numeric bars (_createNumericBars()): This method is responsible for generating the vertical bars for the chart when the x-axis is a numeric axis. The bars are generated using the d3 library, which provides several functions for creating and manipulating SVG elements.

      +

      Function arguments:

      +
        +
      • containerHeight - a number representing the height of the container in which the chart is rendered.
      • +
      • containerWidth - a number representing the width of the container in which the chart is rendered.
      • +
      • xElement - an SVGElement representing the x-axis element of the chart.
      • +
      +
    • +
    +
  • +
+

Working algorithm:

+
    +
  • +

    The _createNumericBars method takes several arguments, including containerHeight, containerWidth, and xElement. These arguments are used to define the dimensions of the chart and to create the x-axis scale.

    +
  • +
  • +

    The method first extracts several props from the props object, including useSingleColor, which determines whether all bars should be the same color, and xBarScale and yBarScale, which are the x and y scales for the chart. It also creates a color scale using the _createColors method, which generates a range of colors based on the number of data points.

    +
  • +
  • +

    The method then iterates over each data point in the _points array and generates a vertical bar for each point. It first checks whether the bar should be highlighted based on the legend or whether any legend is highlighted. It then generates a class name for the bar using the getClassNames function, which applies styles based on the theme and whether the bar should be highlighted.

    +
  • +
  • +

    The height of the bar is determined by the yBarScale function, which maps the y-value of the data point to the chart dimensions. If the height of the bar is less than 1, the method returns an empty React.Fragment element.

    +
  • +
  • +

    The method then calculates the x and y positions of the bar using the xBarScale and yBarScale functions, respectively. It generates a rect element for the bar and sets its attributes, including the x, y, width, height, and fill attributes. It also sets several event handlers for the bar, including onClick, onMouseOver, onMouseLeave, onFocus, and onBlur, which are used to display the callout and tooltip for the bar.

    +
  • +
  • +

    Finally, the method returns an array of g elements that contain the rect elements for each bar. It also removes any unwanted tooltip divs from the DOM and displays the tooltip at the x-axis labels if the showXAxisLablesTooltip prop is set to true.

    +
  • +
  • +

    String bars (_createStringBars()): This method is responsible for generating the vertical bars for the chart when the x-axis is a categorical axis. The bars are generated using the d3 library, which provides several functions for creating and manipulating SVG elements.

    +

    Function arguments:

    +
      +
    • containerHeight (number): The height of the container in which the chart is rendered.
    • +
    • containerWidth (number): The width of the container in which the chart is rendered.
    • +
    • xElement (SVGElement): The SVG element that represents the x-axis of the chart.
    • +
    +
  • +
+

Working algorithm:

+
    +
  • The _createStringBars method takes several arguments, including containerHeight, containerWidth, and xElement. These arguments are used to define the dimensions of the chart and to create the x-axis scale.
  • +
  • The method first extracts several props from the props object, including xBarScale and yBarScale, which are the x and y scales for the chart, and colorScale, which is a color scale generated using the _createColors method. It also generates a React.Fragment element for any bars that have a height less than 1.
  • +
  • The method then iterates over each data point in the _points array and generates a vertical bar for each point. It first calculates the height of the bar using the yBarScale function, which maps the y-value of the data point to the chart dimensions. If the height of the bar is less than 1, the method returns an empty React.Fragment element.
  • +
  • The method then calculates the x and y positions of the bar using the xBarScale and yBarScale functions, respectively. It generates a rect element for the bar and sets its attributes, including the x, y, width, height, and fill attributes. It also sets several event handlers for the bar, including onClick, onMouseOver, onMouseLeave, onFocus, and onBlur, which are used to display the callout and tooltip for the bar.
  • +
  • Finally, the method returns an array of g elements that contain the rect elements for each bar. It also removes any unwanted tooltip divs from the DOM and displays the tooltip at the x-axis labels if the showXAxisLablesTooltip prop is set to true.
  • +
  • Lines: +
      +
    • +

      _createLine(): This method is responsible for creating a line chart that can be overlaid on top of the vertical bar chart. The line chart is created using the d3.line function, which generates a path element based on an array of data points.

      +

      Function arguments:

      +
        +
      • xScale: A scale function that maps values from the x domain to the x range.
      • +
      • yScale: A scale function that maps values from the y domain to the y range.
      • +
      • containerHeight: The height of the container element that the chart is rendered in.
      • +
      • containerWidth: The width of the container element that the chart is rendered in.
      • +
      • yScaleSecondary: An optional scale function that maps values from the secondary y domain to the secondary y range. This is used when the chart has a secondary y axis.
      • +
      +
    • +
    +
  • +
+

Working algorithm:

+
    +
  • The _createLine method takes several arguments, including xScale, yScale, containerHeight, containerWidth, and yScaleSecondary. These arguments are used to define the scales and dimensions of the chart, as well as to extract the data needed to create the line chart.
  • +
  • The method first checks whether the x-axis is a numeric axis or a categorical axis, and then creates the necessary scales and color scales based on this information. It then extracts the data points from the data prop that have a lineData property, which contains the y-value for each point on the line chart.
  • +
  • The method then creates a linePath function using the d3.line function, which maps the x and y values of each data point to the chart dimensions using the xScale and yScale functions. If a yScaleSecondary function is provided, it is used instead of yScale for data points that have a useSecondaryYScale property set to true.
  • +
  • The method then creates a line array that contains two path elements: one for the line itself, and one for the line border. The line element has a stroke color that is set to the lineLegendColor prop, which defaults to yellow. The lineBorder element has a white stroke color and a width that is determined by the lineBorderWidth prop.
  • +
  • Finally, the method creates a dots array that contains a circle element for each data point on the line chart. These circles have a white fill color and a stroke color that matches the lineLegendColor prop. They also have a visibility property that is set to show if the data point is currently active and hide otherwise.
  • +
  • Legends: +
      +
    • +

      _getLegendData(): This method is responsible for generating the legend for the chart, which displays the color and label for each data point on the chart. The legend is generated using the Legends component, which is a reusable component that displays a list of legends with customizable styles and behaviors.

      +

      Function arguments:

      +
        +
      • data: an array of IVerticalBarChartDataPoint objects, which contain the data points for the chart.
      • +
      • palette: an object of type IPalette, which contains the color palette to be used for the chart.
      • +
      +
    • +
    +
  • +
+

Working algorithm:

+
    +
  • The _getLegendData method takes two arguments, data and palette, which are arrays of data points and a color palette, respectively. It also extracts several props from the props object, including theme, useSingleColor, lineLegendText, and lineLegendColor. These props are used to determine the color and label for each legend item.
  • +
  • The method then iterates over each data point in the data array and generates a legend item for each point. It first calculates the color of the legend item using the color property of the data point, or by generating a new color using the _createColors method if no color is defined. It then creates a new object called legend that contains the title, color, and several event handlers for the legend item. These event handlers are used to handle mouse events on the legend item, such as clicking, hovering, and leaving.
  • +
  • The method then adds the legend object to an array called actions, which is used to store all of the legend items for the chart. If the chart includes a line chart and the lineLegendText and lineLegendColor props are defined, the method adds a new legend item to the beginning of the actions array that represents the line chart. This legend item includes the lineLegendText and lineLegendColor props, as well as an additional property called isLineLegendInBarChart, which is used to style the legend item differently from the other legend items.
  • +
  • Finally, the method returns a Legends component that displays the legend items in a list. The Legends component takes several props that are used to customize the styles and behaviors of the legend items, including enabledWrapLines, overflowProps, focusZonePropsInHoverCard, and overflowText.
  • +
  • Callouts: +
      +
    • _getCalloutContentForLineAndBar(): This method is responsible for generating the content that is displayed in the callout when the user hovers over a data point on the chart. The callout content includes the y-values for both the vertical bar and the line chart, as well as any associated callout data.
    • +
    +
  • +
+

Working algorithm:

+
    +
  • The _getCalloutContentForLineAndBar method takes a single argument, point, which is an object that contains the x and y values for the data point that the user is hovering over. The method first initializes an empty array called YValueHover, which will be used to store the y-values and callout data for the vertical bar and line chart.
  • +
  • The method then extracts several props from the props object, including data, lineLegendText, and lineLegendColor. It uses these props to filter the data array and find the data point that matches the x-value of the hovered point. If the chart includes a line chart and the selected data point has a lineData property with a defined y-value, the method adds a new object to the YValueHover array that contains the y-value and callout data for the line chart. This object also includes the legend text and color for the line chart, which are defined by the lineLegendText and lineLegendColor props.
  • +
  • The method then adds a second object to the YValueHover array that contains the y-value and callout data for the vertical bar. This object includes the legend text, y-value, and color for the vertical bar, as well as any associated callout data. The color of the vertical bar is determined by the color property of the selected data point, or by generating a new color using the _createColors method if no color is defined.
  • +
  • Finally, the method returns an object that contains the YValueHover array and the x-value of the hovered point. The x-value is determined by the xAxisCalloutData property of the selected data point, or by using the x-value of the point if no xAxisCalloutData is defined.
  • +
  • Bar labels: +
      +
    • +

      _renderBarLabel(): This method is responsible for rendering the labels for the bars in the chart component. The method takes three arguments: xPoint, yPoint, and barValue. xPoint and yPoint are the x and y positions of the bar, respectively, and barValue is the value of the bar.

      +

      Working algorithm:

      +
        +
      • The method first checks if the hideLabels prop is set to true or if the width of the bar is less than 16 pixels. If either of these conditions is true, the method returns null, which means that no label is rendered for the bar.
      • +
      • If the hideLabels prop is false and the width of the bar is greater than or equal to 16 pixels, the method returns a text element that represents the label for the bar. The text element is positioned at the center of the bar using the xPoint and yPoint arguments. The textAnchor attribute is set to middle, which centers the text horizontally. The className attribute is set to a CSS class that is used to style the label. The aria-hidden attribute is set to true, which means that the label is hidden from screen readers.
      • +
      • The content of the text element is generated using the d3FormatPrefix function from the d3-format module. The d3FormatPrefix function formats the barValue argument using a prefix notation that rounds the value to two decimal places if the value is less than 1000, or to one decimal place if the value is greater than or equal to 1000. The formatted value is then appended to the text element as its content.
      • +
      +
    • +
    +
  • +
  • Ticks: +
      +
    • +

      Rotated x-axis ticks (rotateXAxisLabels()): This function is responsible for rotating the labels of the x-axis of a chart component. The function takes an object called rotateLabelProps as an argument, which contains two properties: node and xAxis. node is a reference to the DOM node that contains the chart component, and xAxis is a reference to the x-axis of the chart.

      +

      Working algorithm:

      +
        +
      • The function first checks if either node or xAxis is null.
      • +
      • If either of these values is null, the function returns undefined, which means that no rotation is performed.
      • +
      • The function then initializes a variable called maxHeight to 0 and an array called xAxisTranslations to store the x-axis translations. It uses d3Select to select the chart node and call the x-axis function. It then selects all the tick elements and loops through them. For each tick element, the function checks whether it has already been rotated. If it hasn't, the function extracts the x-axis translation value and pushes it to the xAxisTranslations array. The function then sets the transform attribute of the tick element to translate it by the x-axis translation value and rotate it by -45 degrees. The function also computes the height of the tick element and stores it in the maxHeight variable if it's greater than the current maxHeight.
      • +
      • The function then loops through the tick elements again and sets their transform attribute to translate them by the corresponding x-axis translation value, translate them vertically by half of the maxHeight, and rotate them by -45 degrees.
      • +
      • Finally, the function returns the vertical height of the labels by computing maxHeight/tanInverse(45).
      • +
      +
    • +
    +
  • +
  • Rendering details +The Vertical bar chart uses d3 SVG based rendering, which follows the following render cycles: +
    - Invocation cycle: Vertical bar Chart -> Cartesian base chart -> X-axis -> X-axis labels -> Y-axis -> Y-axis labels -> bars, legends, callouts
    - Rendering cycle: Vertical bar chart <- Bars (rect), lines (d3.line), Legends, Callouts <- Axes (d3.axis, d3.scale)
    +
  • +
+

Following are the detailed steps:

+
    +
  1. The VerticalBarChart component renders a vertical bar chart with optional line chart overlay. The chart is rendered using D3.js and SVG elements. The chart can be customized with various props, including data points, axis labels, legend, colors, and more.
  2. +
  3. The chart is rendered within an SVG element with a specified width and height. The chart is composed of several elements, including the x-axis, y-axis, bars, and line chart. The x-axis and y-axis are rendered using D3.js axis functions, and the bars and line chart are rendered using D3.js scales and data binding.
  4. +
  5. The chart data is passed in as an array of IVerticalBarChartDataPoint objects, which contain x and y values, a legend label, and an optional color. The chart can also display a line chart overlay, which is passed in as an array of IVerticalBarChartDataPoint objects with an additional lineData property.
  6. +
  7. The legend is rendered using the Legends component, which is passed an array of ILegend objects. The chart can also display callout labels for each bar, which are rendered using SVG text elements.
  8. +
  9. The chart can be customized with various props, including barWidth, colors, theme, lineLegendText, yAxisTickCount, and more. The chart also supports accessibility features, including aria labels and keyboard navigation.
  10. +
+
    +
  • +

    Error scenarios +The Vertical bar chart handles the following error scenario:

    +
      +
    • Empty data: If the data passed to the chart component is empty, the chart will not render and a message will be narrated to the user. _isChartEmpty functions handles that scenario.
    • +
    +
  • +
  • +

    Localization aspects +The component has a culture prop, which is used to set the culture for the chart. This prop is used to format the x-axis labels and the callout values based on the specified culture. Currently, vertical bar chart provides localization only for the x-axis ticks if they are numbers.

    +
  • +
  • +

    Testing +The manual and component tests for Vertical bar chart has been completed and unit testing are in progress. Following is the current code coverage for Vertical bar chart:

    +

    VerticalBarChart3.png

    +
  • +
+
    +
  1. Component Tests: +
      +
    1. Work item 7435
    2. +
    3. Test plan: https://github.com/microsoft/fluentui/blob/master/packages/react-charting/docs/TestPlans/VerticalBarChart/ComponentTests.md 
    4. +
    +
  2. +
  3. Unit Tests: +
      +
    1. Work item 7436
    2. +
    +
  4. +
  5. Manual Tests: +
      +
    1. Work item 8604
    2. +
    +
  6. +
  7. Accessibility Tests: +
      +
    1. Work item 7434
    2. +
    +
  8. +
+
    +
  • Accessibility +Vertical bar chart is tested for fast pass accessibility. +Link to the FAST pass tool +Our charts have elaborate accessibility support. The charts are WCAG 2.1 MAS C compliant for accessibility. +Consumers can define their own aria labels for each point by setting the callOutAccessibilityData property.
  • +
  • Theming +The palette for vertical bar chart is set from the "theme" prop as passed to the component during rendering. Both light and dark themes are supported and users can create there own theme too. Ref6  and Ref7  explains theming in detail.
  • +
  • Debugging +The detailed steps on debugging has been given in Debugging.
  • +
  • Variants +Following are the variants of vertical bar chart: Ref8 +
      +
    • Basic Vertical bar Chart: Only basic props are provided.
    • +
    • Dynamic Vertical bar Chart: The data and bar colors can change.
    • +
    • Custom Callout: Can show customized callout data.
    • +
    • Custom Accessibility: Providing custom aria labels.
    • +
    • Styled: Can show bars with a single color w/o line.
    • +
    • Rotated labels: Can show labels rotated in -45 degrees.
    • +
    • Tooltip: Can show tooltip over x-axis ticks when the ticks are truncated.
    • +
    +
  • +
  • Interaction +Following are the interactions that are allowed for vertical bar chart: +
      +
    • Mouse Events: +a. Hover mouse over a bar, should call the corresponding handler and show the callout over that bar. +b. On mouse move on Bar 1 (step 1) -> mouse leave (step 2) -> mouse move on Bar 2 (step 3), should render the callout of the Bar 2. +c. On mouse over, callout should be defined, on mouse leave, callout should disappear. +d. On mouse over on legends, should highlight the corresponding bar/line. +f. On click on Bar, should highlight the corresponding bar. +g. On mouse out after mouse over on first legend, should have opacity 0.1 for second bar initially (during mouseOver on first legend) and opacity set to 1 for both the bars on mouse out.
    • +
    • Keyboard Events: +a. On focus on a bar, should render the corresponding callout. +b. On focus on a line, should highlight the corresponding line and its legend.
    • +
    +
  • +
  • Some notable PRs and their brief description + +
  • +
  • Learnings +
      +
    • While implementing the tests using react testing library, it was found that certain browser functions like getComputedTextLength() cannot be unit tested and needs to be tested End-to-End only.
    • +
    • Order of imports are important. +For example: for Vertical bar charts tests, improper sequencing of the imports (data first and then render) results in incorrect and incopmlete rendering of charts:
    • +
    +
  • +
+
  - import { chartPoints } from '../VerticalBarChart/VerticalBarChart.test';
- import { render, screen, queryAllByAttribute, fireEvent, act } from '@testing-
- library/react';
+

However, the following results in correct rendering:

+
import { render, screen, queryAllByAttribute } from '@testing-library/react';

import { chartPoints } from './VerticalBarChart.test';
+
    +
  • +

    Certain props need async await structure (waitFor in react testing library) for different props or nested SVGs to render.

    +
  • +
  • +

    Known issues

    +
      +
    • Setting the margins externally via the props may cut the x and y ticks if the margins provided are very less. Setting a minimum margin would prevent any such distortions.
    • +
    +
  • +
  • +

    Future improvements

    +

    Following are the list of future improvements for the vertical bar chart:

    +
      +
    • Improved accessibility: While the component already provides accessibility data for screen readers, there is always room for improvement in this area. Adding support for keyboard navigation and improving the accessibility of the callout would make the component more accessible to users with disabilities.
    • +
    • Support for animations: Adding support for animations, such as transitions between data updates or hover effects, would make the component more visually appealing and engaging for users.
    • +
    • Following error handling scenarios can be improved: +
        +
      • Invalid or missing chart dimensions: If the dimensions of the chart are invalid or missing, the chart will not render and a message will be displayed to the user.
      • +
      • Invalid or missing axis parameters: If the parameters for the x-axis or y-axis are invalid or missing, the chart will not render and a message will be displayed to the user.
      • +
      • Invalid or missing legends: If the legends for the chart are invalid or missing, the chart will not render and a message will be displayed to the user.
      • +
      • Invalid bar width: If the bar width for the chart is invalid, the chart will not render and a message will be displayed to the user.
      • +
      • Invalid or missing data for callout: If the data for the callout is invalid or missing, the callout will not render and a message will be displayed to the user.
      • +
      • Invalid or missing accessibility data: If the accessibility data for the chart is invalid or missing, the chart will not render and a message will be displayed to the user.
      • +
      +
    • +
    • Localization support can be improved for all strings and numbers.
    • +
    +
  • +
  • +

    Design figma +Vertical bar Chart Figma: Link 

    +
  • +
  • +

    Performance

    +

    The performance aspect of a donut chart refers to how efficiently and effectively it conveys information to the viewer. Here are some key considerations regarding the performance of a line chart:

    +
      +
    • Data Visualization Efficiency
    • +
    • Clarity and Simplicity
    • +
    • Responsiveness
    • +
    • Handling Large Datasets
    • +
    • Interactive Features
    • +
    +
  • +
+

We use Lighthouse tool for measuring the performance of our charts. Following are few of the scenarios for which we measure the performance score for vertical bar chart:

+
    +
  • References
  • +
+
    +
  1. D3-scale: + +
  2. +
  3. D3-shape
  4. +
  5. D3-selection
  6. +
  7. D3-array
  8. +
  9. D3-axis
  10. +
  11. How to apply theme
  12. +
  13. Theming
  14. +
  15. Vertical Bar Chart
  16. +
+

Appendix:

+

The mathematical formulae used in the Vertical bar chart component are as follows:

+
    +
  1. +

    Formula for calculating the y scale using d3ScaleLinear: +VBC_f1.png

    +
  2. +
  3. +

    Formula for calculating the x scale using d3ScaleBand:

    +

    Numeric scale: +VBC_f2.png

    +

    String scale: +VBC_f3.png

    +
  4. +
  5. +

    Formula for calculating the width of each bar: +VBC_f4.png

    +

    In order to maintain 2:1 spacing barWidth is replaced by the maxBandWidth.

    +
  6. +
  7. +

    Formula for calculating the total width required to render the bars: +VBC_f5.png

    +
    MIN_DOMAIN_MARGIN = 8
    +
  8. +
  9. +

    Formula for calculating the maximum possible bar width to maintain 2:1 spacing: +VBC_f6.png

    +
  10. +
  11. +

    Formula for calculating the domain margin +VBC_f7.png

    +
    _domainMarging = MIN_DOMAIN_MARGIN
    MIN_DOMAIN_MARGIN = 8

    To center align the chart by setting equal left and right margins for domain:
    +
  12. +
+ + \ No newline at end of file diff --git a/docs/Charting-Concepts/VerticalStackedBarChart.html b/docs/Charting-Concepts/VerticalStackedBarChart.html new file mode 100644 index 0000000000..34311d4017 --- /dev/null +++ b/docs/Charting-Concepts/VerticalStackedBarChart.html @@ -0,0 +1,627 @@ + + + + + +Contributor guide: Vertical Stacked Bar Chart | FluentUI Charting Contrib Docsite + + + + + +

Contributor guide: Vertical Stacked Bar Chart

+

VerticalStackedBarChart1.png

+

A vertical stacked bar chart is a type of chart that displays multiple series of data as stacked bars, with each bar representing a category. The bars are stacked on top of each other, with the height of each bar representing the total value of the series at that category.

+

In a vertical stacked bar chart, the x-axis represents the categories, while the y-axis represents the values of the series. Each bar is divided into segments, with each segment representing a different series. The segments are colored differently to differentiate between the series.

+
    +
  • Use cases +Here are some common use cases for a vertical stacked bar chart: +
      +
    • Comparing the total size of different categories over time
    • +
    • Analyzing the composition of a whole category into subcategories
    • +
    • Identifying trends in the distribution of data over time
    • +
    • Comparing the relative sizes of different categories at a single point in time
    • +
    • Highlighting the contribution of each subcategory to the whole category
    • +
    +
  • +
  • Mathematical/Geometrical concepts
  • +
+

VerticalStackedBarChart2.png

+

The major D3 functions that are involved in the creation of Vertical bar charts are:

+
    +
  • +

    d3-scale: +The d3-scale module is a part of the d3 library, which is a collection of JavaScript functions that are used for data visualization. The d3-scale module provides several functions for creating and manipulating scales, which are used to map data values to visual properties, such as position, size, and color.

    +

    The d3-scale module includes several scale types, including linear, logarithmic, power, and time scales. These scales are used to map continuous data values to a continuous range of visual properties. The module also includes ordinal and band scales, which are used to map categorical data values to a discrete range of visual properties.

    +
  • +
+

The d3-scale module provides several functions for creating and manipulating scales, including scaleLinear, scaleLog, scalePow, scaleTime, scaleOrdinal, and scaleBand. These functions take one or more arguments that define the domain and range of the scale, as well as any additional properties, such as the number of ticks or the padding between bands.

+

Application in Vertical Stacked bar chart: +In the Vertical Stacked Bar Chart, d3-scale is used to create scales for the x and y axes of the chart. The d3-scale library provides a set of functions for creating different types of scales, such as linear, logarithmic, and ordinal scales. Here, the d3-scale library is used to create a linear scale for the y-axis of the chart.

+
    +
  • +

    d3.scaleLinear(): The d3ScaleLinear is a function from the d3-scale module that is used to create a linear scale for the y-axis of the chart. The linear scale maps a continuous domain of data values to a continuous range of visual properties, such as position or height. The d3ScaleLinear function takes no arguments and returns a new linear scale. The scale can be customized using several methods, including domain, range, clamp, and nice. The domain method sets the domain of the scale, which is the range of data values that the scale maps to the range of visual properties. The range method sets the range of the scale, which is the range of visual properties that the scale maps to the domain of data values.

    +

    Application in Vertical Stacked bar chart: +In Vertical stacked bar chart, d3.scaleLinear() is used to create a linear scale for the y-axis of the chart.

    +
      +
    • A linear scale is a mapping function that maps a continuous input domain to a continuous output range. In this case, the input domain is the range of data values to be plotted on the y-axis, and the output range is the range of pixel values available for the y-axis on the chart.
    • +
    • The scaleLinear() method of the d3 library returns a new linear scale function. This function can be used to map data values to pixel values on the y-axis of the chart.
    • +
    • To create the scale, the domain() method is used to set the minimum and maximum values of the data array as the input domain. The range() method is used to set the height of the chart minus the top and bottom margins as the output range.
    • +
    • The resulting yScale function can then be used to map data values to pixel values on the y-axis of the chart.
    • +
    +
  • +
  • +

    d3.scaleBand(): The d3ScaleBand is a function from the d3-scale module that is used to create a band scale for the x-axis of the chart. The band scale maps a discrete domain of data values to a discrete range of visual properties, such as position or width. The d3ScaleBand function takes no arguments and returns a new band scale. The scale can be customized using several methods, including domain, range, padding, and align. The domain method sets the domain of the scale, which is the range of data values that the scale maps to the range of visual properties. The range method sets the range of the scale, which is the range of visual properties that the scale maps to the domain of data values. The padding method sets the padding between the bands of the scale, which determines the width of the bands. The align method sets the alignment of the bands within the range of the scale.

    +

    Application in Vertical Stacked bar chart: +In the vertical stacked bar chart, d3.scaleBand() is used to create a band scale for the x-axis of the chart.

    +
      +
    • A band scale is a mapping function that maps a discrete input domain to a continuous output range. In this case, the input domain is an array of discrete values to be plotted on the x-axis, and the output range is the range of pixel values available for the x-axis on the chart.
    • +
    • The scaleBand() method of the d3 library returns a new band scale function. This function can be used to map data values to pixel values on the x-axis of the chart.
    • +
    • To create the scale, the domain() method is used to set the array of discrete values as the input domain. The range() method is used to set the width of the chart minus the left and right margins as the output range.
    • +
    • The padding() method can be used to set the padding between the bands in the scale. The paddingInner() and paddingOuter() methods can be used to set the inner and outer padding, respectively.
    • +
    • The resulting xScale function can then be used to map data values to pixel values on the x-axis of the chart.
    • +
    +
  • +
  • +

    d3-selection: The d3-selection is a module from the d3 library that is used to select and manipulate DOM elements in the chart component. The d3-selection module provides several functions for selecting and manipulating DOM elements, including select, selectAll, append, attr, and style. The select function is used to select a single DOM element that matches a given selector. The selectAll function is used to select multiple DOM elements that match a given selector. The append function is used to append a new DOM element to a selected element. The attr function is used to set or get an attribute of a selected element. The style function is used to set or get a style property of a selected element.

    +

    Application in Vertical Stacked bar chart: +In the Vertical stacked bar chart, d3-selection is used to select and manipulate DOM elements in the chart.

    +
      +
    • The d3-selection library provides various methods for selecting and manipulating DOM elements, such as select(), selectAll(), append(), and attr(). In this case, the d3-selection library is used to select the svg element that holds the chart and to create and manipulate the rect elements that represent the bars in the chart.
    • +
    • To select the svg element, the d3-selection library's select() method is used. This method takes SVG node as an argument and returns a new selection object that represents the selected element. The resulting selection object can then be used to manipulate the selected element.
    • +
    +
  • +
  • +

    d3-array: The d3-array is a module from the d3 library that is used to manipulate arrays of data in the chart component. The d3-array module provides several functions for manipulating arrays of data, including max, min, extent, sum, and mean. The max function is used to find the maximum value in an array of data. The min function is used to find the minimum value in an array of data. The extent function is used to find the minimum and maximum values in an array of data. The sum function is used to find the sum of the values in an array of data. The mean function is used to find the mean (average) of the values in an array of data.

    +

    Application in Vertical Stacked bar chart: +In the Vertical stacked bar chart, d3-array is used to calculate the minimum and maximum values of the data array.

    +
      +
    • The d3-array library provides various methods for working with arrays of data, such as min(), max(), and sum(). In this case, the d3-array library is used to calculate the minimum and maximum values of the data array.
    • +
    • To calculate the minimum and maximum values of the data array, the d3-array library's min() and max() methods are used. These methods take an array of data as an argument and return the minimum and maximum values of the array, respectively.
    • +
    • The resulting minimum and maximum values are then used to set the input domain of the y-axis scale created using the d3-scale library.
    • +
    • Overall, the d3-array library is used to calculate the minimum and maximum values of the data array by using the min() and max() methods. These values are then used to set the input domain of the y-axis scale created using the d3-scale library.
    • +
    +
  • +
  • +

    d3-format: The d3-format is a module from the d3 library that is used to format numbers and strings in the chart component. The d3-format module provides several functions for formatting numbers and strings, including format, formatPrefix, precisionFixed, and precisionRound.

    +

    The format function is used to format a number or string using a specified format string. The format string can include placeholders for the value, such as % for a percentage or , for a comma-separated number. The formatPrefix function is used to format a number using a prefix notation that rounds the value to a specified precision and appends a prefix, such as k for thousands or M for millions. The precisionFixed function is used to format a number using a fixed number of decimal places. The precisionRound function is used to format a number using a variable number of decimal places that is determined by the magnitude of the value.

    +
  • +
+

Application in Vertical Stacked bar chart: +In the Vertical stacked bar chart, d3-format is used to format the tick values on the y-axis of the chart.

+
    +
  • +

    The d3-format library provides various methods for formatting numbers, such as format(), formatPrefix(), and precisionRound(). In this case, the d3-format library is used to format the tick values on the y-axis of the chart.

    +
  • +
  • +

    To format the tick values, the d3-format library's format() method is used. This method takes a format string as an argument and returns a new function that can be used to format numbers according to the specified format.

    +
  • +
  • +

    The resulting format function is then used to format the tick values on the y-axis of the chart. The tick values are generated using the ticks() method of the y-axis scale created using the d3-scale library.

    +
  • +
  • +

    The tickFormat() method of the y-axis scale is then used to set the tick format function. This method takes the format function as an argument and sets it as the tick format function for the y-axis scale.

    +
  • +
  • +

    Overall, the d3-format library is used to format the tick values on the y-axis of the chart by using the format() method to create a format function and setting this function as the tick format function for the y-axis scale using the tickFormat() method.

    +
  • +
  • +

    d3-axis: The d3-axis module is a part of the d3 library, which is a collection of JavaScript functions that are used for data visualization. The d3-axis module provides several functions for creating and manipulating axes, which are used to display the scales of a chart component.

    +

    In data visualization, axes are used to display the scales of a chart component, such as the x-axis and y-axis of a bar chart. Axes provide visual cues to help readers interpret the data values of a chart component, such as the range and domain of the data values.

    +
  • +
+

The d3-axis module provides several types of axes, including bottom, top, left, and right axes. Each type of axis has its own set of methods for customizing the axis and displaying the tick values.

+

Overall, the d3-axis module is an essential part of data visualization, as it provides a powerful and flexible way to display the scales of a chart component and help readers interpret the data values of the chart.

+

Application in Vertical Stacked bar chart: +In the Vertical stacked bar chart, d3-axis is used to create and render the x and y axes of the chart.

+
    +
  • The d3-axis library provides various methods for creating and rendering axes, such as axisBottom(), axisLeft(), and tickFormat(). In this case, the d3-axis library is used to create and render the x and y axes of the chart.
  • +
  • To create the x and y axes, the d3-axis library's axisBottom() and axisLeft() methods are used, respectively. These methods take a scale function as an argument and return a new axis function that can be used to render the axis.
  • +
  • The resulting x and y axis functions are then used to render the x and y axes of the chart. The call() method of the selection object is used to call the axis function and render the axis.
  • +
  • The tickFormat() method of the y-axis scale is also used to set the tick format function for the y-axis. This method takes the format function created using the d3-format library as an argument and sets it as the tick format function for the y-axis.
  • +
+

Overall, the d3-axis library is used to create and render the x and y axes of the chart by using the axisBottom() and axisLeft() methods to create the axis functions and the call() method to render the axes. The tickFormat() method is also used to set the tick format function for the y-axis.

+
    +
  • Dev Design details +Following are the major components that contribute towards creating a complete vertical stacked bar chart: +
      +
    • Axes: +
        +
      • +

        _getScales(): This method is responsible for creating the x and y scales for the chart.

        +

        Function arguments:

        +
          +
        • containerHeight: a number representing the height of the container in which the chart will be rendered.
        • +
        • containerWidth: a number representing the width of the container in which the chart will be rendered.
        • +
        • isNumeric: a boolean value indicating whether the x-axis data is numeric or not. If true, the x-axis data is numeric, otherwise it is not.
        • +
        +
      • +
      +
    • +
    +
  • +
+

Working algorithm:

+
    +
  • The method takes several arguments, including the container height and width, and a boolean value indicating whether the x-axis is numeric or categorical.
  • +
  • The method first calculates the maximum y-value of the chart data and creates a linear scale for the y-axis using the d3-scale library's scaleLinear() method. The domain of the y-axis scale is set to [0, yMax], where yMax is the maximum y-value of the chart data. The range of the y-axis scale is set to [0, containerHeight - this.margins.bottom! - this.margins.top!], where containerHeight is the height of the chart container and this.margins.bottom! and this.margins.top! are the bottom and top margins of the chart, respectively.
  • +
  • If the x-axis is numeric, the method calculates the minimum and maximum x-values of the chart data using the d3-array library's d3Min() and d3Max() methods. It then creates a linear scale for the x-axis using the d3-scale library's scaleLinear() method. The domain of the x-axis scale is set to [xMin, xMax] or [xMax, xMin] if the chart is right-to-left, where xMin and xMax are the minimum and maximum x-values of the chart data, respectively. The range of the x-axis scale is set to [this.margins.left! + this._domainMargin, containerWidth - this.margins.right! - this._barWidth - this._domainMargin], where this.margins.left! and this.margins.right! are the left and right margins of the chart, respectively, and this._barWidth and this._domainMargin are properties of the chart.
  • +
  • If the x-axis is categorical, the method creates a band scale for the x-axis using the d3-scale library's scaleBand() method. The domain of the x-axis scale is set to the unique x-axis labels of the chart data. The range of the x-axis scale is set to [this.margins.left! + this._domainMargin, containerWidth - this.margins.right! - this._domainMargin], where this.margins.left! and this.margins.right! are the left and right margins of the chart, respectively, and this._domainMargin is a property of the chart. The paddingInner() method is used to set the inner padding of the bars to 2 / 3.
  • +
  • Finally, the method returns an object with the x and y scales.
  • +
+

Overall, the _getScales method is responsible for creating the x and y scales for the chart using the d3-scale library's scaleLinear() and scaleBand() methods. The method calculates the domain and range of the scales based on the chart data and properties of the chart.

+
    +
  • +

    _getDomainMargins(): This method is responsible for calculating the margins for the x-axis domain based on the width of the chart container and the width of the bars.

    +

    Function arguments:

    +
      +
    • containerWidth which is a number representing the width of the container in which the chart is being rendered.
    • +
    +
  • +
+

Working algorithm:

+
    +
  • The method takes a single argument, containerWidth, which is the width of the chart container.
  • +
  • The method first checks whether the x-axis is numeric or categorical. If the x-axis is not numeric, the method calculates the total width available to render the bars by subtracting the left and right margins and the minimum domain margin from the container width. It then calculates the required width to render the bars based on the number of x-axis labels and the bar width. If the total width available is greater than or equal to the required width, the method sets the domain margin to half of the difference between the total width available and the required width to center align the chart. If the total width available is less than the required width, the method calculates the maximum possible bar width to maintain a 2:1 spacing between the bars and sets the domain margin to the minimum domain margin.
  • +
  • The method then sets the bar width and domain margin properties of the chart based on the calculated values.
  • +
  • Finally, the method returns an object with the margins for the x-axis domain, which includes the left and right margins and the domain margin.
  • +
+

Overall, the _getDomainMargins method is responsible for calculating the margins for the x-axis domain based on the width of the chart container and the width of the bars. The method calculates the total width available to render the bars, the required width to render the bars, and the maximum possible bar width to maintain a 2:1 spacing between the bars. The method then sets the domain margin and bar width properties of the chart based on the calculated values.

+
    +
  • +

    createNumericXAxis(): The code above is a function called createNumericXAxis in the utilities.ts file. This function is responsible for creating a numeric x-axis for a chart component. The function takes two arguments: xAxisParams and chartType. xAxisParams is an object that contains several properties, including domainNRangeValues, showRoundOffXTickValues, xAxistickSize, tickPadding, xAxisCount, and xAxisElement. chartType is an enumeration that specifies the type of chart component.

    +

    Function arguments:

    +
      +
    • xAxisParams of type IXAxisParams which is an object containing the following properties: +
        +
      • domainNRangeValues of type IDomainNRange which is an object containing the domain and range values for the x-axis.
      • +
      • showRoundOffXTickValues of type boolean which is an optional property that determines whether to round off the x-axis tick values.
      • +
      • xAxistickSize of type number which is an optional property that determines the size of the x-axis ticks.
      • +
      • tickPadding of type number which is an optional property that determines the padding between the x-axis ticks and the x-axis labels.
      • +
      • xAxisCount of type number which is an optional property that determines the number of x-axis ticks.
      • +
      • xAxisElement of type SVGElement | null which is an optional property that represents the x-axis element.
      • +
      +
    • +
    • chartType of type ChartTypes which is an enum that represents the type of chart.
    • +
    • culture of type string which is an optional paramter represents the locale into which the numeric x-axis labels will be localized.
    • +
    +
  • +
+

Working algorithm:

+
    +
  • The function first extracts the properties of the xAxisParams object using destructuring. The domainNRangeValues property is an object that contains the start and end values of the domain and range of the x-axis. The showRoundOffXTickValues property is a boolean that specifies whether to round off the tick values of the x-axis. The xAxistickSize property is a number that specifies the size of the ticks of the x-axis. The tickPadding property is a number that specifies the padding between the ticks and the labels of the x-axis. The xAxisCount property is a number that specifies the number of ticks of the x-axis. The xAxisElement property is a reference to the DOM node that contains the x-axis of the chart.
  • +
  • The function then creates a linear scale for the x-axis using the d3ScaleLinear function from the d3-scale module. The scale is customized using the domain and range methods, which set the domain and range of the scale, respectively. If the showRoundOffXTickValues property is true, the nice method is called on the scale to round off the tick values of the x-axis.
  • +
  • The function then creates a bottom axis for the x-axis using the d3AxisBottom function from the d3-axis module. The axis is customized using the tickSize, tickPadding, ticks, and tickFormat methods. The tickSize method sets the size of the ticks of the x-axis. The tickPadding method sets the padding between the ticks and the labels of the x-axis. The ticks method sets the number of ticks of the x-axis. The tickFormat method formats the tick values of the x-axis using the convertToLocaleString function and the culture parameter.
  • +
  • If the xAxisElement property is not null, the axis is rendered on the DOM node using the call method of the d3-selection module. The selectAll method is called on the axis to select all the text elements of the x-axis, and the attr method is called to set the aria-hidden attribute of the text elements to true.
  • +
  • Finally, the function computes the tick values of the x-axis using the ticks and tickFormat methods of the scale, and returns an object that contains the x-axis scale and the tick values.
  • +
+

Overall, the createNumericXAxis function is responsible for creating a numeric x-axis for a chart component. The function creates a linear scale for the x-axis and a bottom axis for the x-axis using the d3-scale and d3-axis modules, respectively. The function customizes the scale and axis using several methods, including domain, range, tickSize, tickPadding, ticks, and tickFormat. The function also renders the axis on the DOM node and computes the tick values of the x-axis.

+
    +
  • +

    createStringXAxis(): This function is responsible for creating a string x-axis for a chart component. The function takes four arguments: xAxisParams, tickParams, dataset, and culture. xAxisParams is an object that contains several properties, including domainNRangeValues, xAxisCount, xAxistickSize, tickPadding, xAxisPadding, xAxisInnerPadding, and xAxisOuterPadding. tickParams is an object that contains several properties, including tickValues and tickFormat. dataset is an array of strings that contains the values of the x-axis. culture is a string that specifies the locale into which the x-axis labels can be localized.

    +

    Function Arguments:

    +
      +
    • xAxisParams: An object containing the parameters for the x-axis, including the domain and range values, tick size, tick padding, number of ticks, padding for the inner and outer edges of the axis, and the element to render the axis.
    • +
    • tickParams: An object containing the parameters for the ticks on the x-axis, including the tick values and tick format.
    • +
    • dataset: An array of strings representing the data points for the x-axis.
    • +
    • culture: An optional string representing the culture to use for formatting the tick labels on the x-axis. However, the localization works only if the string can be converted to a numeric value. Otherwise, the x-axis labels remain unlocalized.
    • +
    +
  • +
+

Working algorithm:

+
    +
  • The function first extracts the properties of the xAxisParams object using destructuring. The domainNRangeValues property is an object that contains the start and end values of the domain and range of the x-axis. The xAxisCount property is a number that specifies the number of ticks of the x-axis. The xAxistickSize property is a number that specifies the size of the ticks of the x-axis. The tickPadding property is a number that specifies the padding between the ticks and the labels of the x-axis. The xAxisPadding property is a number that specifies the padding between the bars of the chart. The xAxisInnerPadding property is a number that specifies the inner padding between the bars of the chart. The xAxisOuterPadding property is a number that specifies the outer padding between the bars of the chart.
  • +
  • The function then creates a band scale for the x-axis using the d3ScaleBand function from the d3-scale module. The scale is customized using the domain and range methods, which set the domain and range of the scale, respectively. The paddingInner and paddingOuter methods are used to set the inner and outer padding between the bars of the chart, respectively.
  • +
  • The function then creates a bottom axis for the x-axis using the d3AxisBottom function from the d3-axis module. The axis is customized using the tickSize, tickPadding, ticks, and tickFormat methods. The tickSize method sets the size of the ticks of the x-axis. The tickPadding method sets the padding between the ticks and the labels of the x-axis. The ticks method sets the number of ticks of the x-axis. The tickFormat method formats the tick values of the x-axis using the convertToLocaleString function and the culture parameter.
  • +
  • If the xAxisParams.xAxisElement property is not null, the axis is rendered on the DOM node using the call method of the d3-selection module. The selectAll method is called on the axis to select all the text elements of the x-axis, and the attr method is called to set the aria-hidden attribute of the text elements to true.
  • +
  • Finally, the function computes the tick values of the x-axis using the tickFormat method of the axis, and returns an object that contains the x-axis scale and the tick values.
  • +
+

Overall, the createStringXAxis function is responsible for creating a string x-axis for a chart component. The function creates a band scale for the x-axis and a bottom axis for the x-axis using the d3-scale and d3-axis modules, respectively. The function customizes the scale and axis using several methods, including domain, range, paddingInner, paddingOuter, tickSize, tickPadding, ticks, and tickFormat. The function also renders the axis on the DOM node and computes the tick values of the x-axis.

+
    +
  • +

    createYAxis(): In the Vertical bar chart component, the d3-axis module is used to create and customize the y-axis of a vertical bar chart. The createYAxis function is responsible for creating the y-axis using the createYAxisForOtherCharts function. The function takes in several parameters, including yAxisParams, isRtl, axisData, and useSecondaryYScale. These parameters are used to customize the y-axis, such as setting the tick values, tick format, and tick padding.

    +

    Function arguments:

    +
      +
    • yAxisParams: An object that contains various parameters related to the y-axis of the chart. It has the following properties: +
        +
      • yMinMaxValues: An object that contains the start and end values of the y-axis.
      • +
      • yAxisElement: The DOM element that represents the y-axis.
      • +
      • yMaxValue: The maximum value of the y-axis.
      • +
      • yMinValue: The minimum value of the y-axis.
      • +
      • containerHeight: The height of the container that holds the chart.
      • +
      • containerWidth: The width of the container that holds the chart.
      • +
      • margins: An object that contains the margins of the chart.
      • +
      • tickPadding: The padding between the ticks and the axis line.
      • +
      • maxOfYVal: The maximum value of the y-axis for area chart and Grouped vertical bar chart.
      • +
      • yAxisTickFormat: The format of the y-axis tick labels.
      • +
      • yAxisTickCount: The number of ticks on the y-axis.
      • +
      • eventAnnotationProps: An object that contains the properties of the event annotation.
      • +
      • eventLabelHeight: The height of the event label.
      • +
      +
    • +
    • isRtl: A boolean value that indicates whether the chart is in right-to-left mode.
    • +
    • axisData: An object that contains the data related to the axis of the chart.
    • +
    • useSecondaryYScale: A boolean value that indicates whether to use a secondary y-axis scale.
    • +
    +
  • +
+

Working algorithm:

+
    +
  • +

    The function first extracts the necessary parameters from the yAxisParams object, such as the yMinMaxValues, yAxisElement, containerHeight, and containerWidth. It then calculates the final maximum and minimum values for the y-axis, based on the maxOfYVal, yMaxValue, and yMinValue parameters.

    +
  • +
  • +

    The function then prepares the datapoints for the y-axis using the prepareDatapoints function, which calculates the tick values based on the maximum and minimum values of the y-axis. It then creates a linear scale for the y-axis using the d3ScaleLinear function from the d3-scale library.

    +
  • +
  • +

    The function then creates the y-axis using the d3AxisLeft or d3AxisRight function from the d3-axis library, depending on the isRtl and useSecondaryYScale parameters. It sets the tick padding, tick values, and tick size for the y-axis, and formats the tick labels using the yAxisTickFormat parameter.

    +
  • +
  • +

    Finally, the function uses the d3Select function to select the yAxisElement and apply the y-axis to it using the call method. It also sets the aria-hidden attribute of the y-axis text elements to true to improve accessibility.

    +
  • +
  • +

    createStringYAxis(): In the Vertical bar chart component, the d3-axis module is used to create and customize the y-axis of a vertical bar chart. The createStringYAxis function is responsible for creating the y-axis that use string values for the y-axis using the createStringYAxisForOtherCharts function. The function takes in several parameters, including yAxisParams, dataPoints, and isRtl. These parameters are used to customize the y-axis, such as setting the tick values, tick format, and tick padding.

    +

    Function arguments:

    +
      +
    • yAxisParams: An object that contains the parameters for the y-axis, including containerHeight, tickPadding, margins, yAxisTickFormat, yAxisElement, and yAxisPadding.
    • +
    • dataPoints: An array of strings that represent the data points for the y-axis.
    • +
    • isRtl: A boolean value that indicates whether the chart is in right-to-left mode.
    • +
    +
  • +
+

Working algorithm:

+
    +
  • The function first extracts the necessary parameters from the yAxisParams object, such as the containerHeight, margins, yAxisTickFormat, yAxisElement, and yAxisPadding. It then creates a band scale for the y-axis using the d3ScaleBand function from the d3-scale library.
  • +
  • The band scale is defined using the dataPoints array as the domain, and the containerHeight and margins parameters as the range. The padding method is used to set the padding between the bands in the y-axis.
  • +
  • The function then creates the y-axis using the d3AxisLeft or d3AxisRight function from the d3-axis library, depending on the isRtl parameter. It sets the tick padding, tick values, and tick size for the y-axis, and formats the tick labels using the yAxisTickFormat parameter.
  • +
  • Finally, the function uses the d3Select function to select the yAxisElement and apply the y-axis to it using the call method. It also selects all the text elements of the y-axis and returns the y-axis scale.
  • +
  • Bars: +
      +
    • +

      _createBar(): This method is responsible for creating and rendering the bars of the chart.

      +

      Function arguments: +The _createBar function takes four arguments:

      +
        +
      • xBarScale: This is a scaling function that maps the x-axis data points to the corresponding x-axis positions on the chart. The type of this argument is any, which means that it can be any type of scaling function.
      • +
      • yBarScale: This is a scaling function that maps the y-axis data points to the corresponding y-axis positions on the chart. The type of this argument is NumericScale, which is a custom type defined elsewhere in the code.
      • +
      • containerHeight: This is the height of the container element that holds the chart. This is used to calculate the y-axis position of the bars.
      • +
      • xElement: This is an SVG element that represents the x-axis of the chart. This is used to calculate the x-axis position of the bars.
      • +
      +
    • +
    +
  • +
+

Working algorithm:

+
    +
  • +

    The method takes several arguments, including the x and y scales, the container height and width, and an SVG element for the x-axis. It first checks whether the chart has any line data and whether to focus on the whole stack or not.

    +
  • +
  • +

    The method then iterates over each item in the chart data and calculates the x and y coordinates for each bar using the scales and the bar width. It also calculates the height of each bar based on the data and the y scale. If the bar height is less than the minimum bar height, it sets the height to the minimum bar height.

    +
  • +
  • +

    For each bar, the method creates a rectangle element using the rect SVG element and sets the x, y, width, height, fill, and other properties. It also adds an onMouseOver, onMouseMove, onMouseLeave, onFocus, onBlur, and onClick event listener for the bar if the legend is selected.

    +
  • +
  • +

    If the bar has a corner radius and is the last bar in the stack, it creates a path element using the path SVG element and sets the d, fill, and other properties. It also adds an onMouseOver, onMouseMove, onMouseLeave, onFocus, onBlur, and onClick event listener for the path if the legend is selected.

    +
  • +
  • +

    The method then creates a group element using the g SVG element and adds the rectangle and path elements to the group. It also adds an onMouseOver, onMouseMove, onMouseLeave, onFocus, onBlur, and onClick event listener for the group if the legend is selected.

    +
  • +
  • +

    Finally, the method returns the bars as a React fragment.

    +
  • +
  • +

    Numeric bars (_createNumericBars()): This method is responsible for creating and rendering the numeric bars of the chart.

    +

    Function arguments:

    +
      +
    • containerHeight (number): The height of the container in which the chart is rendered.
    • +
    • containerWidth (number): The width of the container in which the chart is rendered.
    • +
    • xElement (SVGElement): The SVG element that represents the x-axis of the chart.
    • +
    +
  • +
+

Working algorithm:

+
    +
  • The method takes several arguments, including the container height and width, and an SVG element for the x-axis. It first gets the x and y bar scales using the _getScales method with the numeric parameter set to true.
  • +
  • The method then calls the _createBar method with the x and y bar scales, container height, and x-axis element as arguments. The _createBar method is responsible for creating and rendering the bars of the chart.
  • +
  • The _createBar method creates a rectangle element for each bar using the rect SVG element and sets the x, y, width, height, fill, and other properties. It also adds event listeners for the bar if the legend is selected.
  • +
  • The _createBar method then creates a group element using the g SVG element and adds the rectangle elements to the group. It also adds event listeners for the group if the legend is selected.
  • +
  • Finally, the _createBar method returns the bars as a React fragment.
  • +
+

Overall, the _createNumericBars method is responsible for creating and rendering the numeric bars of the chart by calling the _createBar method with the appropriate scales and arguments. The _createBar method is responsible for creating and rendering the bars of the chart using the rect and g SVG elements and adding event listeners for interactivity.

+
    +
  • +

    String bars (_createStringBars()): This method is responsible for creating and rendering the string bars of the chart.

    +

    Function arguments:

    +
      +
    • containerHeight (number): The height of the container in which the chart is rendered.
    • +
    • containerWidth (number): The width of the container in which the chart is rendered.
    • +
    • xElement (SVGElement): The SVG element that represents the x-axis of the chart.
    • +
    +
  • +
+

Working algorithm:

+
    +
  • The method takes several arguments, including the container height and width, and an SVG element for the x-axis. It first gets the x and y bar scales using the _getScales method with the numeric parameter set to false.
  • +
  • The method then calls the _createBar method with the x and y bar scales, container height, and x-axis element as arguments. The _createBar method is responsible for creating and rendering the bars of the chart.
  • +
  • The _createBar method creates a rectangle element for each bar using the rect SVG element and sets the x, y, width, height, fill, and other properties. It also adds event listeners for the bar if the legend is selected.
  • +
  • The _createBar method then creates a group element using the g SVG element and adds the rectangle elements to the group. It also adds event listeners for the group if the legend is selected.
  • +
  • Finally, the _createBar method returns the bars as a React fragment.
  • +
+

Overall, the _createStringBars method is responsible for creating and rendering the string bars of the chart by calling the _createBar method with the appropriate scales and arguments. The _createBar method is responsible for creating and rendering the bars of the chart using the rect and g SVG elements and adding event listeners for interactivity.

+
    +
  • Lines: +
      +
    • +

      _createLines(): This method is responsible for creating and rendering the lines and dots of the chart.

      +

      Function arguments:

      +
        +
      • xScale: A NumericScale object that represents the scale for the x-axis of the chart.
      • +
      • yScale: A NumericScale object that represents the scale for the y-axis of the chart.
      • +
      • containerHeight: A number that represents the height of the container that holds the chart.
      • +
      • containerWidth: A number that represents the width of the container that holds the chart.
      • +
      • secondaryYScale: An optional NumericScale object that represents the scale for the secondary y-axis of the chart. This argument is only used if the chart has a secondary y-axis.
      • +
      +
    • +
    +
  • +
+

Working algorithm:

+
    +
  • The method takes several arguments, including the x and y scales, the container height and width, and an optional secondary y scale. It first checks whether the x-axis is numeric or not and gets the scales using the _getScales method.
  • +
  • The method then gets the formatted line data using the _getFormattedLineData method and iterates over each item in the line object. For each item, it checks whether the legend is highlighted or not and iterates over each point in the line. It calculates the x and y coordinates for each point using the scales and whether to use the secondary y scale or not.
  • +
  • If the line border width is greater than zero, it creates a line element for the border of the line using the line SVG element. It then creates a line element for the line itself using the same line SVG element and adds an onMouseOver and onMouseLeave event listener if the legend is selected.
  • +
  • Finally, it creates a circle element for each point in the line using the circle SVG element and adds an onMouseOver and onMouseLeave event listener if the legend is selected. It sets the radius and visibility of the circle based on the legend and x-axis point.
  • +
  • The method returns the border lines, lines, and dots as a React fragment.
  • +
  • Legends: +
      +
    • +

      _getLegendData(): This method is responsible for creating and rendering the legend of the chart.

      +

      Function arguments:

      +
        +
      • data: an array of IVerticalStackedChartProps objects, which contain the chart data to be displayed.
      • +
      • palette: an object of type IPalette that contains a set of colors to be used for the chart.
      • +
      • lineLegends: an array of LineLegends objects, which contain the legend data for any lines that are displayed on the chart.
      • +
      +
    • +
    +
  • +
+

Working algorithm:

+
    +
  • The method takes several arguments, including the chart data, the color palette, and an array of line legends. It first checks whether the legend should be hidden or not based on the hideLegend prop.
  • +
  • The method then iterates over each item in the chart data and creates a legend for each unique legend title and color combination. It generates a random color from the default palette if the point does not have a color. It also checks whether there are any similar legends already created and skips the creation if there are.
  • +
  • For each legend, the method creates an object with the legend title, color, and event listeners for click, hover, and mouse out actions. It adds the legend object to an array of actions.
  • +
  • If there are any line legends, the method iterates over each item in the line legends and creates a legend object with the title, color, and event listeners. It adds the legend object to an array of line legends.
  • +
  • The method then concatenates the arrays of actions and line legends and creates a Legends component with the resulting array of legends. It also passes any additional props for the Legends component.
  • +
+

Overall, the _getLegendData method is responsible for creating and rendering the legend of the chart by iterating over the chart data and line legends and creating legend objects with event listeners. It then passes the resulting array of legends to a Legends component for rendering.

+
    +
  • Callouts: +
      +
    • _renderCallout(): This method is responsible for rendering the callout for a data point when it is hovered over.
    • +
    +
  • +
+

Working algorithm:

+
    +
  • The method takes an optional IVSChartDataPoint object as an argument, which contains the data for the hovered data point. If the argument is not provided, the method returns null.
  • +
  • If the argument is provided, the method creates a ChartHoverCard component with the XValue, Legend, YValue, color, and culture props set to the corresponding values from the IVSChartDataPoint object. The ChartHoverCard component is responsible for rendering the callout with the data for the hovered data point.
  • +
  • Finally, the method returns the ChartHoverCard component.
  • +
+

Overall, the _renderCallout method is responsible for rendering the callout for a data point when it is hovered over by creating a ChartHoverCard component with the data for the hovered data point.

+
    +
  • +

    _getCustomizedCallout(): This method is responsible for rendering the callout for a data point or stack when it is hovered over.

    +

    Working algorithm:

    +
      +
    • The method first checks whether the chart has any line data by iterating over the chart data and checking whether each item has a lineData property with a length greater than zero. If the chart has any line data, it sets a boolean variable _isHavingLines to true.
    • +
    • The method then checks whether the onRenderCalloutPerStack prop is defined. If it is defined, the method calls the onRenderCalloutPerStack function with the stackCalloutProps object as an argument. The stackCalloutProps object contains the data for the hovered stack.
    • +
    • If the onRenderCalloutPerStack prop is not defined, the method checks whether the onRenderCalloutPerDataPoint prop is defined and whether the chart has any line data. If the onRenderCalloutPerDataPoint prop is defined and the chart does not have any line data, the method calls the onRenderCalloutPerDataPoint function with the dataPointCalloutProps object and the _renderCallout method as arguments. The dataPointCalloutProps object contains the data for the hovered data point.
    • +
    • If neither the onRenderCalloutPerStack nor the onRenderCalloutPerDataPoint prop is defined, the method returns null.
    • +
    +
  • +
+

Overall, the _getCustomizedCallout method is responsible for rendering the callout for a data point or stack when it is hovered over by calling the appropriate onRenderCallout function with the corresponding data. If neither onRenderCallout function is defined, the method returns null.

+
    +
  • Rendering details +The Vertical stacked bar chart uses d3 SVG based rendering, which follows the following render cycles: +
    - Invocation cycle: Vertical stacked bar Chart -> Cartesian base chart -> X-axis -> X-axis labels -> Y-axis -> Y-axis labels -> bars, legends, callouts
    - Rendering cycle: Vertical stacked bar chart <- Bars (rect), lines (line), Legends, Callouts <- Axes (d3.axis, d3.scale)
    +
  • +
+

Following are the rendering details:

+
    +
  1. The Vertical stacked bar chart component defines a class component that renders a vertical stacked bar chart. The chart can be either numeric or categorical, depending on the type of data passed in. The chart is rendered using SVG elements.
  2. +
  3. The component has several private methods that are used to create the chart. The _getScales method is used to create the x and y scales for the chart. The _createNumericBars and _createStringBars methods are used to create the bars for the chart. The _getGraphData method is used to get the data for the chart. The _getAxisData method is used to get the data for the y-axis.
  4. +
  5. The component also has several private variables that are used to calculate the margins and bar width for the chart. The _domainMargin variable is used to calculate the margin for the x-axis. The _barWidth variable is used to calculate the width of the bars in the chart.
  6. +
  7. The component also has several private methods that are used to handle user interactions with the chart. The _legendHighlighted method is used to check if a legend is highlighted. The _noLegendHighlighted method is used to check if no legend is highlighted. The _getAriaLabel method is used to get the aria label for the chart.
  8. +
  9. Finally, the component has a render method that renders the chart using SVG elements. The chart is rendered as a series of stacked bars, with each bar representing a category or value. The chart also includes a legend and a callout that displays additional information about the data point when the user hovers over it.
  10. +
+
    +
  • +

    Variants +Following are the variants of vertical bar chart: Ref8 

    +
      +
    • Basic Vertical stacked bar Chart: Only basic props are provided.
    • +
    • Custom Callout: Can show customized callout data.
    • +
    • Custom Accessibility: Providing custom aria labels.
    • +
    • Styled: Can show bars with a single callout or a stacked callout.
    • +
    • Tooltip: Can show tooltip over x-axis ticks.
    • +
    +
  • +
  • +

    Testing +The manual tests for Vertical stacked bar chart has been completed and the component tests are in PR. Following is the improvement in code coverage: +VerticalStackedBarChart3.png

    +
      +
    • Component Tests: + +
    • +
    • Unit Tests: + +
    • +
    • Manual Tests: + +
    • +
    • Accessibility Tests: + +
    • +
    +
  • +
  • +

    Accessibility +FAST pass checks resulted in no error for Vertical stacked bar chart. Link to the FAST pass tool +Our charts have elaborate accessibility support. The charts are WCAG 2.1 MAS C compliant for accessibility. +Consumers can define their own aria labels for each point by setting the callOutAccessibilityData properties.

    +
  • +
  • +

    Theming +The palette for donut chart is set from the "theme" prop as passed to the component during rendering. Both light and dark themes are supported and users can create there own theme too. Ref3  and Ref4  explains theming in detail.

    +
  • +
  • +

    Debugging +The detailed steps on debugging has been given in Debugging.

    +
  • +
  • +

    Error scenarios +The Vertical stacked bar chart handles the following error scenario:

    +
      +
    • Empty data: If the data passed to the chart component is empty, the chart will not render and a message will be narrated to the user. _isChartEmpty functions handles that scenario.
    • +
    +
  • +
  • +

    Localization aspects +The component has a culture prop, which is used to set the culture for the chart. This prop is used to format the x-axis labels and the callout values based on the specified culture. Currently, vertical bar chart provides localization only for the x-axis ticks if they are numbers.

    +
  • +
  • +

    Some notable PRs and their brief description

    + +
  • +
  • +

    Future improvements +Following are the future improvements that can be incorporated in vertical stacked bar charts:

    +
      +
    • Add support for animations: Animations can make the chart more engaging and help to highlight changes in the data over time. Adding support for animations would require using a library such as d3-transition.
    • +
    • Add support for multiple data sets: Currently, the chart only supports a single data set. Adding support for multiple data sets would allow the user to compare different sets of data on the same chart. For example: grouped vertical stacked bar chart.
    • +
    • Improve accessibility: The chart could be made more accessible by adding support for keyboard navigation. This would require adding additional attributes to the chart elements and updating the event handlers accordingly.
    • +
    • Following error handling scenarios can be improved: +
        +
      • Invalid or missing chart dimensions: If the dimensions of the chart are invalid or missing, the chart will not render and a message will be displayed to the user.
      • +
      • Invalid or missing axis parameters: If the parameters for the x-axis or y-axis are invalid or missing, the chart will not render and a message will be displayed to the user.
      • +
      • Invalid or missing legends: If the legends for the chart are invalid or missing, the chart will not render and a message will be displayed to the user.
      • +
      • Invalid bar width: If the bar width for the chart is invalid, the chart will not render and a message will be displayed to the user.
      • +
      • Invalid or missing data for callout: If the data for the callout is invalid or missing, the callout will not render and a message will be displayed to the user.
      • +
      • Invalid or missing accessibility data: If the accessibility data for the chart is invalid or missing, the chart will not render and a message will be displayed to the user.
      • +
      +
    • +
    • Localization support can be improved for all strings and numbers.
    • +
    +
  • +
  • +

    Interactions +Following are the interactions that are allowed for vertical stacked bar chart:

    +
      +
    • Mouse Events: +a. Hover mouse over a stacked bar, should call the corresponding handler and show the callout containing information about all the bars stacked over that bar. +b. On mouse move on stacked Bar 1 (step 1) -> mouse leave (step 2) -> mouse move on stacked Bar 2 (step 3), should render the callout of the stacked Bar 2. +c. On mouse over, callout should be defined, on mouse leave, callout should disappear. +d. On mouse over on legends, should highlight the corresponding bar/line. +f. On click on stacked Bar, should highlight the corresponding entire stacked bar. +g. On mouse over a bar legend, should highlight all the bars of that type on all the stacked bars. +g. On mouse out after mouse over on first legend, should have opacity 0.1 for second bar initially (during mouseOver on first legend) and opacity set to 1 for both the bars on mouse out.
    • +
    • Keyboard Events: +a. On focus on a bar, should render the corresponding callout. +b. On focus on a line, should highlight the corresponding line and its legend.
    • +
    +
  • +
  • +

    Learnings

    +
      +
    • While implementing the tests using react testing library, it was found that certain browser functions like getComputedTextLength() cannot be unit tested and needs to be tested End-to-End only.
    • +
    • Order of imports are important. +For example: for Vertical bar charts tests, improper sequencing of the imports (data first and then render) results in incorrect and incopmlete rendering of charts:
    • +
    +
    import { chartPoints } from '../VerticalBarChart/VerticalBarChart.test';
    import { render, screen, queryAllByAttribute, fireEvent, act } from '@testing-library/react';
    +

    However, the following results in correct rendering:

    +
    import { render, screen, queryAllByAttribute } from '@testing-library/react';

    import { chartPoints } from './VerticalBarChart.test';
    +
  • +
  • +

    Certain props need async await structure (waitFor in react testing library) for different props or nested SVGs to render.

    +
  • +
  • +

    Design figma +Vertical Stacked Bar Chart Figma - Link 

    +
  • +
  • +

    Known issues

    +
      +
    • Setting the margins externally via the props may cut the x and y ticks if the margins provided are very less. Setting a minimum margin would prevent any such distortions.
    • +
    +
  • +
  • +

    Performance +The performance aspect of a vertical stacked bar chart refers to how efficiently and effectively it conveys information to the viewer. Here are some key considerations regarding the performance of a line chart:

    +
      +
    • Data Visualization Efficiency
    • +
    • Clarity and Simplicity
    • +
    • Responsiveness
    • +
    • Handling Large Datasets
    • +
    • Interactive Features
    • +
    +
  • +
  • +

    References

    +
  • +
+
    +
  1. D3-scale
  2. +
  3. D3-selection
  4. +
  5. D3-array
  6. +
  7. D3-axis
  8. +
  9. How to apply theme
  10. +
  11. Theming
  12. +
  13. Vertical Stacked Bar Chart
  14. +
+
    +
  • Appendix +The mathematical formulae used in the Vertical Stacked bar chart component are as follows:
  • +
+
    +
  1. Formula for calculating the yBarScale using d3ScaleLinear:
  2. +
+
yBarScale = d3ScaleLinear()

.domain([0, yMax])

.range([0, containerHeight - margins.bottom! - margins.top!])
+
    +
  1. Formula for calculating the xBarScale for numeric data using d3ScaleLinear:
  2. +
+
xMax = d3Max(this.\_dataset, (point: IDataPoint) => point.x as number)!

xMin = d3Min(this.\_dataset, (point: IDataPoint) => point.x as number)!

xBarScale = d3ScaleLinear()

.domain(this.\_isRtl ? [xMax, xMin] : [xMin, xMax])

.nice()

.range([

` `margins.left! + \_domainMargin,

` `containerWidth - margins.right! - \_barWidth - \_domainMargin,

` `])
+
    +
  1. Formula for calculating the xBarScale for categorical data using d3ScaleBand:
  2. +
+
xBarScale = d3ScaleBand()

.domain(\_xAxisLabels)

.range([margins.left! + \_domainMargin, containerWidth - margins.right! - \_domainMargin])

.paddingInner(2 / 3)
+
    +
  1. Formula for calculating the height of each bar in the chart:
  2. +
+
barHeight = heightValueScale \* point.data;

When displaying gaps between the bars, the height of each bar is adjusted so that the total of all bars is not changed by the gaps

totalData = bars.reduce((iter, value) => iter + value.data, 0)

totalHeight = defaultTotalHeight ?? yBarScale(totalData)

gaps = barGapMax && bars.length - 1

gapHeight = gaps && Math.max(barGapMin, Math.min(barGapMax, (totalHeight \* barGapMultiplier) / gaps))

heightValueScale = (totalHeight - gapHeight \* gaps) / totalData

if (barHeight < barMinimumHeight) {

` `barHeight = barMinimumHeight

}

Default values:

barGapMax = props.barGapMax (default value = 0)

When displaying gaps between bars, the max height of the gap is given in the props. The actual gap is calculated with this multiplier, with a minimum gap of 1 pixel.

barGapMin = 1

barGapMultiplier = 0.2
+
    +
  1. Formula for calculating the x position of each bar in the chart:
  2. +
+
x = xBarScale(bar.category) + (this.\_barWidth / 2)
+
+ + \ No newline at end of file diff --git a/docs/Contributor Guide.html b/docs/Contributor Guide.html index b77866a8f6..236c81fb09 100644 --- a/docs/Contributor Guide.html +++ b/docs/Contributor Guide.html @@ -5,8 +5,8 @@ Contributor Guide | FluentUI Charting Contrib Docsite - - + +

Contributor Guide

Fluent charting library is a collection of individual charts like LineChart, AreaChart, Horizontal bar chart, vertical bar chart. diff --git a/docs/Debugging.html b/docs/Debugging.html index 5cc0c1f061..692df31073 100644 --- a/docs/Debugging.html +++ b/docs/Debugging.html @@ -5,8 +5,8 @@ Debugging | FluentUI Charting Contrib Docsite - - + +

Debugging

The chart components can be debugged using few techniques.

@@ -35,6 +35,6 @@ Note that this option renders the components under a headless browser. So some actual rendering dependent functions like getBoundingClientRect will not work and will need to be mocked. -
+
\ No newline at end of file diff --git a/docs/Detailed Implementation Steps.html b/docs/Detailed Implementation Steps.html index 380cf10d6b..945ba8db7d 100644 --- a/docs/Detailed Implementation Steps.html +++ b/docs/Detailed Implementation Steps.html @@ -5,8 +5,8 @@ Detailed Implementation Steps | FluentUI Charting Contrib Docsite - - + +

Detailed Implementation Steps

If you are planning to contribute a major chart, follow the below steps to align the component with fluent charting design, principles, style and standards.

diff --git a/docs/Implementation Best Practices.html b/docs/Implementation Best Practices.html index e585707ae8..4869df9a13 100644 --- a/docs/Implementation Best Practices.html +++ b/docs/Implementation Best Practices.html @@ -5,8 +5,8 @@ Implementation Best Practices | FluentUI Charting Contrib Docsite - - + +

Implementation Best Practices

Component Props

diff --git a/docs/Overview.html b/docs/Overview.html index ecbe03b436..c519e7c875 100644 --- a/docs/Overview.html +++ b/docs/Overview.html @@ -5,8 +5,8 @@ Overview | FluentUI Charting Contrib Docsite - - + +

Overview

Fluent UI React (formerly Office UI Fabric React) charts is a set of modern, accessible, interactive, lightweight and highly customizable visualization library representing the Microsoft design system. The charts are used across 100+ projects inside Microsoft including Microsoft 365 and Azure.

diff --git a/docs/Start Developing.html b/docs/Start Developing.html index 0b9ba5a4cb..52f2fd7099 100644 --- a/docs/Start Developing.html +++ b/docs/Start Developing.html @@ -5,8 +5,8 @@ Start Developing | FluentUI Charting Contrib Docsite - - + +

Start Developing

This page will help you get familiar with the react charting controls, how the code and documents are organized.

diff --git a/docs/Technical Details.html b/docs/Technical Details.html index 2a620813a4..493fc37a99 100644 --- a/docs/Technical Details.html +++ b/docs/Technical Details.html @@ -5,8 +5,8 @@ Technical details | FluentUI Charting Contrib Docsite - - + +

Technical details

diff --git a/docs/Test Plans/AreaChart/ComponentTests.html b/docs/Test Plans/AreaChart/ComponentTests.html index 8bb376addd..58588eb66d 100644 --- a/docs/Test Plans/AreaChart/ComponentTests.html +++ b/docs/Test Plans/AreaChart/ComponentTests.html @@ -5,8 +5,8 @@ ComponentTests | FluentUI Charting Contrib Docsite - - + +

ComponentTests

Area Chart – Component test plan

diff --git a/docs/Test Plans/DonutChart/ComponentTests.html b/docs/Test Plans/DonutChart/ComponentTests.html index 617e2d8809..91ee9f478a 100644 --- a/docs/Test Plans/DonutChart/ComponentTests.html +++ b/docs/Test Plans/DonutChart/ComponentTests.html @@ -5,8 +5,8 @@ ComponentTests | FluentUI Charting Contrib Docsite - - + +

Component testing - Donut chart test plan

Alt text

Subcomponents: Pie and Legend

Library used: jest and (enzyme or react testing library)

diff --git a/docs/Test Plans/GaugeChart/ComponentTests.html b/docs/Test Plans/GaugeChart/ComponentTests.html index ea4aa87641..e45f106197 100644 --- a/docs/Test Plans/GaugeChart/ComponentTests.html +++ b/docs/Test Plans/GaugeChart/ComponentTests.html @@ -5,8 +5,8 @@ Component testing - Gauge chart test plan | FluentUI Charting Contrib Docsite - - + +

Component testing - Gauge chart test plan

diff --git a/docs/Test Plans/GroupedVerticalBarChart/ComponentTests.html b/docs/Test Plans/GroupedVerticalBarChart/ComponentTests.html index a8c322dc39..ff3bfc3952 100644 --- a/docs/Test Plans/GroupedVerticalBarChart/ComponentTests.html +++ b/docs/Test Plans/GroupedVerticalBarChart/ComponentTests.html @@ -5,8 +5,8 @@ ComponentTests | FluentUI Charting Contrib Docsite - - + +

ComponentTests

Grouped Vertical Bar Chart – Component test plan

diff --git a/docs/Test Plans/HeatMapChart/ComponentTests.html b/docs/Test Plans/HeatMapChart/ComponentTests.html index 07e36b7e15..509d8981ff 100644 --- a/docs/Test Plans/HeatMapChart/ComponentTests.html +++ b/docs/Test Plans/HeatMapChart/ComponentTests.html @@ -5,8 +5,8 @@ Heatmap Chart - Component test plan | FluentUI Charting Contrib Docsite - - + +

Heatmap Chart - Component test plan

diff --git a/docs/Test Plans/HorizontalBarChart/ComponentTests.html b/docs/Test Plans/HorizontalBarChart/ComponentTests.html index 3043f596cc..efe7a72d23 100644 --- a/docs/Test Plans/HorizontalBarChart/ComponentTests.html +++ b/docs/Test Plans/HorizontalBarChart/ComponentTests.html @@ -5,8 +5,8 @@ ComponentTests | FluentUI Charting Contrib Docsite - - + +

ComponentTests

Horizontal Bar Chart – Component test plan

diff --git a/docs/Test Plans/HorizontalBarChart/UnitTests.html b/docs/Test Plans/HorizontalBarChart/UnitTests.html index 934c18a823..a0a3f238f4 100644 --- a/docs/Test Plans/HorizontalBarChart/UnitTests.html +++ b/docs/Test Plans/HorizontalBarChart/UnitTests.html @@ -5,8 +5,8 @@ UnitTests | FluentUI Charting Contrib Docsite - - + +

UnitTests

Unit Test Plan - Horizontal Bar Chart

diff --git a/docs/Test Plans/HorizontalBarChartWithAxis/ComponentTests.html b/docs/Test Plans/HorizontalBarChartWithAxis/ComponentTests.html index 3ad836d14b..2485043035 100644 --- a/docs/Test Plans/HorizontalBarChartWithAxis/ComponentTests.html +++ b/docs/Test Plans/HorizontalBarChartWithAxis/ComponentTests.html @@ -5,8 +5,8 @@ ComponentTests | FluentUI Charting Contrib Docsite - - + +

ComponentTests

Horizontal Bar Chart With Axis – Component test plan

diff --git a/docs/Test Plans/HorizontalBarChartWithAxis/UnitTests.html b/docs/Test Plans/HorizontalBarChartWithAxis/UnitTests.html index d7a945115b..4460f9d01a 100644 --- a/docs/Test Plans/HorizontalBarChartWithAxis/UnitTests.html +++ b/docs/Test Plans/HorizontalBarChartWithAxis/UnitTests.html @@ -5,8 +5,8 @@ UnitTests | FluentUI Charting Contrib Docsite - - + +

UnitTests

Unit Test Plan – Horizontal Bar Chart with axiss

diff --git a/docs/Test Plans/LineChart/ComponentTests.html b/docs/Test Plans/LineChart/ComponentTests.html index b757e66611..dd6cf9397a 100644 --- a/docs/Test Plans/LineChart/ComponentTests.html +++ b/docs/Test Plans/LineChart/ComponentTests.html @@ -5,8 +5,8 @@ ComponentTests | FluentUI Charting Contrib Docsite - - + +

ComponentTests

Line Chart – Component test plan

diff --git a/docs/Test Plans/MultiStackedBarChart/componentTests.html b/docs/Test Plans/MultiStackedBarChart/componentTests.html index 604de307f9..85fd680e26 100644 --- a/docs/Test Plans/MultiStackedBarChart/componentTests.html +++ b/docs/Test Plans/MultiStackedBarChart/componentTests.html @@ -5,8 +5,8 @@ componentTests | FluentUI Charting Contrib Docsite - - + +

componentTests

Multi stacked bar Chart – Component test plan

diff --git a/docs/Test Plans/SankeyChart/ComponentTests.html b/docs/Test Plans/SankeyChart/ComponentTests.html index 7575c39554..22234991ae 100644 --- a/docs/Test Plans/SankeyChart/ComponentTests.html +++ b/docs/Test Plans/SankeyChart/ComponentTests.html @@ -5,8 +5,8 @@ ComponentTests | FluentUI Charting Contrib Docsite - - + +

ComponentTests

Sankey Chart – Component test plan

diff --git a/docs/Test Plans/StackedBarChart/ComponentTests.html b/docs/Test Plans/StackedBarChart/ComponentTests.html index 157b80002e..9460a99149 100644 --- a/docs/Test Plans/StackedBarChart/ComponentTests.html +++ b/docs/Test Plans/StackedBarChart/ComponentTests.html @@ -5,8 +5,8 @@ ComponentTests | FluentUI Charting Contrib Docsite - - + +

ComponentTests

Stacked Bar Chart – Component test plan

diff --git a/docs/Test Plans/TestingGuide.html b/docs/Test Plans/TestingGuide.html index 3bb3d01b33..4c41873eed 100644 --- a/docs/Test Plans/TestingGuide.html +++ b/docs/Test Plans/TestingGuide.html @@ -5,8 +5,8 @@ TestingGuide | FluentUI Charting Contrib Docsite - - + +

TestingGuide

This document highlights few common testing practices for any new tests that are being added to the charting library.

diff --git a/docs/Test Plans/Utilities/UnitTests.html b/docs/Test Plans/Utilities/UnitTests.html index 51f9d88717..0e466510ba 100644 --- a/docs/Test Plans/Utilities/UnitTests.html +++ b/docs/Test Plans/Utilities/UnitTests.html @@ -5,8 +5,8 @@ Unit test plan for Donut Chart | FluentUI Charting Contrib Docsite - - + +

Unit test plan for Donut Chart

diff --git a/docs/Test Plans/VerticalBarChart/ComponentTests.html b/docs/Test Plans/VerticalBarChart/ComponentTests.html index 1235e80d79..5b715b9f2d 100644 --- a/docs/Test Plans/VerticalBarChart/ComponentTests.html +++ b/docs/Test Plans/VerticalBarChart/ComponentTests.html @@ -5,8 +5,8 @@ ComponentTests | FluentUI Charting Contrib Docsite - - + +

ComponentTests

Vertical Bar Chart – Component test plan

diff --git a/docs/Test Plans/VerticalStackedBarChart/ComponentTests.html b/docs/Test Plans/VerticalStackedBarChart/ComponentTests.html index 5b2cde1cf2..49733ee97e 100644 --- a/docs/Test Plans/VerticalStackedBarChart/ComponentTests.html +++ b/docs/Test Plans/VerticalStackedBarChart/ComponentTests.html @@ -5,8 +5,8 @@ ComponentTests | FluentUI Charting Contrib Docsite - - + +

ComponentTests

Vertical Stacked Bar Chart – Component test plan

diff --git a/docs/Testing Strategy.html b/docs/Testing Strategy.html index e983f3759c..bb852ffe8d 100644 --- a/docs/Testing Strategy.html +++ b/docs/Testing Strategy.html @@ -5,8 +5,8 @@ Testing Strategy | FluentUI Charting Contrib Docsite - - + +

Testing Strategy

Details

diff --git a/docs/Testing Unpublished Library Version.html b/docs/Testing Unpublished Library Version.html index 38bc74a320..bb215b2309 100644 --- a/docs/Testing Unpublished Library Version.html +++ b/docs/Testing Unpublished Library Version.html @@ -5,8 +5,8 @@ Testing Unpublished Library Version | FluentUI Charting Contrib Docsite - - + +

Testing Unpublished Library Version

You may want to test changes made to the library in an app locally. This becomes useful to validate a fix or root cause an issue occuring only in a specific app or context. diff --git a/docs/colors.html b/docs/colors.html index 8acbab2f26..6e2184ff85 100644 --- a/docs/colors.html +++ b/docs/colors.html @@ -5,8 +5,8 @@ Colors | FluentUI Charting Contrib Docsite - - + +

Colors

diff --git a/docs/creating-date-objects-for-chart-data.html b/docs/creating-date-objects-for-chart-data.html index 15f26c7f4d..e1e283232e 100644 --- a/docs/creating-date-objects-for-chart-data.html +++ b/docs/creating-date-objects-for-chart-data.html @@ -5,8 +5,8 @@ Creating Date Objects For Chart Data | FluentUI Charting Contrib Docsite - - + +

Creating Date Objects For Chart Data

diff --git a/docs/implementing-2-to-1-spacing.html b/docs/implementing-2-to-1-spacing.html index 543d40f4bb..603f0e3f2d 100644 --- a/docs/implementing-2-to-1-spacing.html +++ b/docs/implementing-2-to-1-spacing.html @@ -5,8 +5,8 @@ Implementing 2:1 spacing | FluentUI Charting Contrib Docsite - - + +

Implementing 2:1 spacing

diff --git a/images/DonutChart1.png b/images/DonutChart1.png new file mode 100644 index 0000000000..97ec2f4571 Binary files /dev/null and b/images/DonutChart1.png differ diff --git a/images/DonutChart2.png b/images/DonutChart2.png new file mode 100644 index 0000000000..4aeddc0735 Binary files /dev/null and b/images/DonutChart2.png differ diff --git a/images/DonutChart3.png b/images/DonutChart3.png new file mode 100644 index 0000000000..329e1c9163 Binary files /dev/null and b/images/DonutChart3.png differ diff --git a/images/GVBC1.png b/images/GVBC1.png new file mode 100644 index 0000000000..d13d165632 Binary files /dev/null and b/images/GVBC1.png differ diff --git a/images/GVBC2.png b/images/GVBC2.png new file mode 100644 index 0000000000..0e0c073c7b Binary files /dev/null and b/images/GVBC2.png differ diff --git a/images/GVBC3.png b/images/GVBC3.png new file mode 100644 index 0000000000..774ef70258 Binary files /dev/null and b/images/GVBC3.png differ diff --git a/images/Sparkline1.png b/images/Sparkline1.png new file mode 100644 index 0000000000..9a33d706c7 Binary files /dev/null and b/images/Sparkline1.png differ diff --git a/images/Sparkline2.png b/images/Sparkline2.png new file mode 100644 index 0000000000..f3433b3927 Binary files /dev/null and b/images/Sparkline2.png differ diff --git a/images/VBC1.png b/images/VBC1.png new file mode 100644 index 0000000000..6d726a0110 Binary files /dev/null and b/images/VBC1.png differ diff --git a/images/VBC2.png b/images/VBC2.png new file mode 100644 index 0000000000..ac9705b894 Binary files /dev/null and b/images/VBC2.png differ diff --git a/images/VBC3.png b/images/VBC3.png new file mode 100644 index 0000000000..03555a6e67 Binary files /dev/null and b/images/VBC3.png differ diff --git a/images/VBC_f1.png b/images/VBC_f1.png new file mode 100644 index 0000000000..58071a565b Binary files /dev/null and b/images/VBC_f1.png differ diff --git a/images/VBC_f2.png b/images/VBC_f2.png new file mode 100644 index 0000000000..f8de798cba Binary files /dev/null and b/images/VBC_f2.png differ diff --git a/images/VBC_f3.png b/images/VBC_f3.png new file mode 100644 index 0000000000..219a7b8e31 Binary files /dev/null and b/images/VBC_f3.png differ diff --git a/images/VBC_f4.png b/images/VBC_f4.png new file mode 100644 index 0000000000..3e6e230bdc Binary files /dev/null and b/images/VBC_f4.png differ diff --git a/images/VBC_f5.png b/images/VBC_f5.png new file mode 100644 index 0000000000..8a7c801f91 Binary files /dev/null and b/images/VBC_f5.png differ diff --git a/images/VBC_f6.png b/images/VBC_f6.png new file mode 100644 index 0000000000..a5f26112a1 Binary files /dev/null and b/images/VBC_f6.png differ diff --git a/images/VBC_f7.png b/images/VBC_f7.png new file mode 100644 index 0000000000..dae42e9425 Binary files /dev/null and b/images/VBC_f7.png differ diff --git a/images/VBC_f8.png b/images/VBC_f8.png new file mode 100644 index 0000000000..138f0a2165 Binary files /dev/null and b/images/VBC_f8.png differ diff --git a/images/VSBC1.png b/images/VSBC1.png new file mode 100644 index 0000000000..e58ebc4e10 Binary files /dev/null and b/images/VSBC1.png differ diff --git a/images/VSBC2.png b/images/VSBC2.png new file mode 100644 index 0000000000..6f637b3eee Binary files /dev/null and b/images/VSBC2.png differ diff --git a/images/VSBC3.png b/images/VSBC3.png new file mode 100644 index 0000000000..2cc624c2ee Binary files /dev/null and b/images/VSBC3.png differ diff --git a/index.html b/index.html index b74a4ae393..24dd05847e 100644 --- a/index.html +++ b/index.html @@ -5,8 +5,8 @@ FluentUI Charting Contrib Docsite | FluentUI Charting Contrib Docsite - - + +

FluentUI Charting Contrib Docsite

MD docs related to FluentUI Charting library

Easy to Use

Easy to Use

Docusaurus was designed from the ground up to be easily installed and used to get your website up and running quickly.

Focus on What Matters

Focus on What Matters

Docusaurus lets you focus on your docs, and we'll do the chores. Go ahead and move your docs into the docs directory.

Powered by React

Powered by React

Extend or customize your website layout by reusing React. Docusaurus can be extended while reusing the same header and footer.

diff --git a/search.html b/search.html index 149730090d..9d409d78de 100644 --- a/search.html +++ b/search.html @@ -5,8 +5,8 @@ Search the documentation | FluentUI Charting Contrib Docsite - - + +

Search the documentation

diff --git a/sitemap.xml b/sitemap.xml index ba442d6660..fdf6174fed 100644 --- a/sitemap.xml +++ b/sitemap.xml @@ -1 +1 @@ -https://microsoft.github.io/fluentui-charting-contrib/searchweekly0.5https://microsoft.github.io/fluentui-charting-contrib/docs/Accessibilityweekly0.5https://microsoft.github.io/fluentui-charting-contrib/docs/CHANGELOGweekly0.5https://microsoft.github.io/fluentui-charting-contrib/docs/Charting-Concepts/AreaChartweekly0.5https://microsoft.github.io/fluentui-charting-contrib/docs/Charting-Concepts/GaugeChartweekly0.5https://microsoft.github.io/fluentui-charting-contrib/docs/Charting-Concepts/HeatMapChartweekly0.5https://microsoft.github.io/fluentui-charting-contrib/docs/Charting-Concepts/HorizontalBarChartweekly0.5https://microsoft.github.io/fluentui-charting-contrib/docs/Charting-Concepts/LineChartweekly0.5https://microsoft.github.io/fluentui-charting-contrib/docs/Charting-Concepts/SankeyChartweekly0.5https://microsoft.github.io/fluentui-charting-contrib/docs/Charting-Concepts/StackedBarChartweekly0.5https://microsoft.github.io/fluentui-charting-contrib/docs/colorsweekly0.5https://microsoft.github.io/fluentui-charting-contrib/docs/Contributor%20Guideweekly0.5https://microsoft.github.io/fluentui-charting-contrib/docs/creating-date-objects-for-chart-dataweekly0.5https://microsoft.github.io/fluentui-charting-contrib/docs/Debuggingweekly0.5https://microsoft.github.io/fluentui-charting-contrib/docs/Detailed%20Implementation%20Stepsweekly0.5https://microsoft.github.io/fluentui-charting-contrib/docs/Implementation%20Best%20Practicesweekly0.5https://microsoft.github.io/fluentui-charting-contrib/docs/implementing-2-to-1-spacingweekly0.5https://microsoft.github.io/fluentui-charting-contrib/docs/Overviewweekly0.5https://microsoft.github.io/fluentui-charting-contrib/docs/Start%20Developingweekly0.5https://microsoft.github.io/fluentui-charting-contrib/docs/Technical%20Detailsweekly0.5https://microsoft.github.io/fluentui-charting-contrib/docs/Test%20Plans/AreaChart/ComponentTestsweekly0.5https://microsoft.github.io/fluentui-charting-contrib/docs/Test%20Plans/DonutChart/ComponentTestsweekly0.5https://microsoft.github.io/fluentui-charting-contrib/docs/Test%20Plans/GaugeChart/ComponentTestsweekly0.5https://microsoft.github.io/fluentui-charting-contrib/docs/Test%20Plans/GroupedVerticalBarChart/ComponentTestsweekly0.5https://microsoft.github.io/fluentui-charting-contrib/docs/Test%20Plans/HeatMapChart/ComponentTestsweekly0.5https://microsoft.github.io/fluentui-charting-contrib/docs/Test%20Plans/HorizontalBarChart/ComponentTestsweekly0.5https://microsoft.github.io/fluentui-charting-contrib/docs/Test%20Plans/HorizontalBarChart/UnitTestsweekly0.5https://microsoft.github.io/fluentui-charting-contrib/docs/Test%20Plans/HorizontalBarChartWithAxis/ComponentTestsweekly0.5https://microsoft.github.io/fluentui-charting-contrib/docs/Test%20Plans/HorizontalBarChartWithAxis/UnitTestsweekly0.5https://microsoft.github.io/fluentui-charting-contrib/docs/Test%20Plans/LineChart/ComponentTestsweekly0.5https://microsoft.github.io/fluentui-charting-contrib/docs/Test%20Plans/MultiStackedBarChart/componentTestsweekly0.5https://microsoft.github.io/fluentui-charting-contrib/docs/Test%20Plans/SankeyChart/ComponentTestsweekly0.5https://microsoft.github.io/fluentui-charting-contrib/docs/Test%20Plans/StackedBarChart/ComponentTestsweekly0.5https://microsoft.github.io/fluentui-charting-contrib/docs/Test%20Plans/TestingGuideweekly0.5https://microsoft.github.io/fluentui-charting-contrib/docs/Test%20Plans/Utilities/UnitTestsweekly0.5https://microsoft.github.io/fluentui-charting-contrib/docs/Test%20Plans/VerticalBarChart/ComponentTestsweekly0.5https://microsoft.github.io/fluentui-charting-contrib/docs/Test%20Plans/VerticalStackedBarChart/ComponentTestsweekly0.5https://microsoft.github.io/fluentui-charting-contrib/docs/Testing%20Strategyweekly0.5https://microsoft.github.io/fluentui-charting-contrib/docs/Testing%20Unpublished%20Library%20Versionweekly0.5https://microsoft.github.io/fluentui-charting-contrib/weekly0.5 \ No newline at end of file +https://microsoft.github.io/fluentui-charting-contrib/searchweekly0.5https://microsoft.github.io/fluentui-charting-contrib/docs/Accessibilityweekly0.5https://microsoft.github.io/fluentui-charting-contrib/docs/CHANGELOGweekly0.5https://microsoft.github.io/fluentui-charting-contrib/docs/Charting-Concepts/AreaChartweekly0.5https://microsoft.github.io/fluentui-charting-contrib/docs/Charting-Concepts/DonutChartweekly0.5https://microsoft.github.io/fluentui-charting-contrib/docs/Charting-Concepts/GaugeChartweekly0.5https://microsoft.github.io/fluentui-charting-contrib/docs/Charting-Concepts/GroupedVerticalBarChartweekly0.5https://microsoft.github.io/fluentui-charting-contrib/docs/Charting-Concepts/HeatMapChartweekly0.5https://microsoft.github.io/fluentui-charting-contrib/docs/Charting-Concepts/HorizontalBarChartweekly0.5https://microsoft.github.io/fluentui-charting-contrib/docs/Charting-Concepts/LineChartweekly0.5https://microsoft.github.io/fluentui-charting-contrib/docs/Charting-Concepts/SankeyChartweekly0.5https://microsoft.github.io/fluentui-charting-contrib/docs/Charting-Concepts/SparklineChartweekly0.5https://microsoft.github.io/fluentui-charting-contrib/docs/Charting-Concepts/StackedBarChartweekly0.5https://microsoft.github.io/fluentui-charting-contrib/docs/Charting-Concepts/VerticalBarChartweekly0.5https://microsoft.github.io/fluentui-charting-contrib/docs/Charting-Concepts/VerticalStackedBarChartweekly0.5https://microsoft.github.io/fluentui-charting-contrib/docs/colorsweekly0.5https://microsoft.github.io/fluentui-charting-contrib/docs/Contributor%20Guideweekly0.5https://microsoft.github.io/fluentui-charting-contrib/docs/creating-date-objects-for-chart-dataweekly0.5https://microsoft.github.io/fluentui-charting-contrib/docs/Debuggingweekly0.5https://microsoft.github.io/fluentui-charting-contrib/docs/Detailed%20Implementation%20Stepsweekly0.5https://microsoft.github.io/fluentui-charting-contrib/docs/Implementation%20Best%20Practicesweekly0.5https://microsoft.github.io/fluentui-charting-contrib/docs/implementing-2-to-1-spacingweekly0.5https://microsoft.github.io/fluentui-charting-contrib/docs/Overviewweekly0.5https://microsoft.github.io/fluentui-charting-contrib/docs/Start%20Developingweekly0.5https://microsoft.github.io/fluentui-charting-contrib/docs/Technical%20Detailsweekly0.5https://microsoft.github.io/fluentui-charting-contrib/docs/Test%20Plans/AreaChart/ComponentTestsweekly0.5https://microsoft.github.io/fluentui-charting-contrib/docs/Test%20Plans/DonutChart/ComponentTestsweekly0.5https://microsoft.github.io/fluentui-charting-contrib/docs/Test%20Plans/GaugeChart/ComponentTestsweekly0.5https://microsoft.github.io/fluentui-charting-contrib/docs/Test%20Plans/GroupedVerticalBarChart/ComponentTestsweekly0.5https://microsoft.github.io/fluentui-charting-contrib/docs/Test%20Plans/HeatMapChart/ComponentTestsweekly0.5https://microsoft.github.io/fluentui-charting-contrib/docs/Test%20Plans/HorizontalBarChart/ComponentTestsweekly0.5https://microsoft.github.io/fluentui-charting-contrib/docs/Test%20Plans/HorizontalBarChart/UnitTestsweekly0.5https://microsoft.github.io/fluentui-charting-contrib/docs/Test%20Plans/HorizontalBarChartWithAxis/ComponentTestsweekly0.5https://microsoft.github.io/fluentui-charting-contrib/docs/Test%20Plans/HorizontalBarChartWithAxis/UnitTestsweekly0.5https://microsoft.github.io/fluentui-charting-contrib/docs/Test%20Plans/LineChart/ComponentTestsweekly0.5https://microsoft.github.io/fluentui-charting-contrib/docs/Test%20Plans/MultiStackedBarChart/componentTestsweekly0.5https://microsoft.github.io/fluentui-charting-contrib/docs/Test%20Plans/SankeyChart/ComponentTestsweekly0.5https://microsoft.github.io/fluentui-charting-contrib/docs/Test%20Plans/StackedBarChart/ComponentTestsweekly0.5https://microsoft.github.io/fluentui-charting-contrib/docs/Test%20Plans/TestingGuideweekly0.5https://microsoft.github.io/fluentui-charting-contrib/docs/Test%20Plans/Utilities/UnitTestsweekly0.5https://microsoft.github.io/fluentui-charting-contrib/docs/Test%20Plans/VerticalBarChart/ComponentTestsweekly0.5https://microsoft.github.io/fluentui-charting-contrib/docs/Test%20Plans/VerticalStackedBarChart/ComponentTestsweekly0.5https://microsoft.github.io/fluentui-charting-contrib/docs/Testing%20Strategyweekly0.5https://microsoft.github.io/fluentui-charting-contrib/docs/Testing%20Unpublished%20Library%20Versionweekly0.5https://microsoft.github.io/fluentui-charting-contrib/weekly0.5 \ No newline at end of file