Skip to content

Commit

Permalink
Add sankey chart
Browse files Browse the repository at this point in the history
  • Loading branch information
mustafasaifee42 committed Nov 12, 2024
1 parent b81c690 commit 0d9081c
Show file tree
Hide file tree
Showing 10 changed files with 1,078 additions and 4 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@undp-data/undp-visualization-library",
"version": "0.1.58",
"version": "0.1.59",
"main": "./dist/index.cjs",
"module": "./dist/index.js",
"browser": "./dist/index.umd.js",
Expand Down
47 changes: 47 additions & 0 deletions src/Components/Dashboard/GraphEl.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ import { getValues } from '../../Utils/getValues';
import { DifferenceLineChart } from '../Graphs/LineCharts/DifferenceLineChart';
import { UNDPColorModule } from '../ColorPalette';
import { GeoHubMapWithLayerSelection } from '../Graphs/Maps/GeoHubMapWithLayerSelection';
import { SankeyChart } from '../Graphs/SankeyChart';

interface Props {
graph: GraphType;
Expand Down Expand Up @@ -165,6 +166,7 @@ function GraphEl(props: Props) {
animatedButterflyChart: AnimatedButterflyChart,
differenceLineChart: DifferenceLineChart,
geoHubMapWithLayerSelection: GeoHubMapWithLayerSelection,
sankeyChart: SankeyChart,
};
const getGraphProps = (graphType: GraphType) => {
switch (graphType) {
Expand Down Expand Up @@ -2404,6 +2406,51 @@ function GraphEl(props: Props) {
annotations: settings?.annotations,
ariaLabel: settings?.ariaLabel,
};
case 'sankeyChart':
return {
mode: settings?.mode,
data: graphData,
graphTitle: settings?.graphTitle,
graphDescription: settings?.graphDescription,
footNote: settings?.footNote,
width: settings?.width,
height: settings?.height,
sources: settings?.sources,
showLabels: settings?.showLabels,
leftMargin: settings?.leftMargin,
rightMargin: settings?.rightMargin,
topMargin: settings?.topMargin,
bottomMargin: settings?.bottomMargin,
truncateBy: settings?.truncateBy,
padding: settings?.padding,
backgroundColor: settings?.backgroundColor,
tooltip: settings?.tooltip,
suffix: settings?.suffix,
prefix: settings?.prefix,
relativeHeight: settings?.relativeHeight,
showValues: settings?.showValues,
graphID: settings?.graphID,
graphDownload: settings?.graphDownload,
dataDownload: settings?.dataDownload,
fillContainer: settings?.fillContainer,
rtl: settings?.rtl,
language: settings?.language,
minHeight: settings?.minHeight,
ariaLabel: settings?.ariaLabel,
sourceColors: settings?.sourceColors,
targetColors: settings?.targetColors,
sourceColorDomain: settings?.sourceColorDomain,
targetColorDomain: settings?.targetColorDomain,
nodePadding: settings?.nodePadding,
nodeWidth: settings?.nodeWidth,
highlightedSourceDataPoints: settings?.highlightedSourceDataPoints,
highlightedTargetDataPoints: settings?.highlightedTargetDataPoints,
defaultLinkOpacity: settings?.defaultLinkOpacity,
sourceTitle: settings?.sourceTitle,
targetTitle: settings?.targetTitle,
animateLinks: settings?.animateLinks,
sortNodes: settings?.sortNodes,
};
default:
return {};
}
Expand Down
Loading

0 comments on commit 0d9081c

Please sign in to comment.