import {
IChartProps,
ISankeyChartProps,
SankeyChart,
DataVizPalette,
getColorFromToken,
} from '@fluentui/react-charting';
import * as React from 'react';
import type { JSXElement } from '@fluentui/utilities';
//import { IPalette } from '@fluentui/react/lib/Styling';
interface ISankeyChartBasicState {
width: number;
height: number;
}
export class SankeyChartInboxExample extends React.Component<{}, ISankeyChartBasicState> {
constructor(props: ISankeyChartProps) {
super(props);
this.state = {
width: 820,
height: 400,
};
}
public render(): JSXElement {
return
{this._inboxExample()}
;
}
private _onWidthChange = (e: React.ChangeEvent) => {
this.setState({ width: parseInt(e.target.value, 10) });
};
private _onHeightChange = (e: React.ChangeEvent) => {
this.setState({ height: parseInt(e.target.value, 10) });
};
private _inboxExample(): JSXElement {
const data: IChartProps = {
chartTitle: 'Sankey Chart',
SankeyChartData: {
nodes: [
{
nodeId: 0,
name: '192.168.42.72',
color: getColorFromToken(DataVizPalette.color4),
borderColor: getColorFromToken(DataVizPalette.color24),
},
{
nodeId: 1,
name: '172.152.48.13',
color: getColorFromToken(DataVizPalette.color4),
borderColor: getColorFromToken(DataVizPalette.color24),
},
{
nodeId: 2,
name: '124.360.55.1',
color: getColorFromToken(DataVizPalette.color4),
borderColor: getColorFromToken(DataVizPalette.color24),
},
{
nodeId: 3,
name: '192.564.10.2',
color: getColorFromToken(DataVizPalette.color4),
borderColor: getColorFromToken(DataVizPalette.color24),
},
{
nodeId: 4,
name: '124.124.50.1',
color: getColorFromToken(DataVizPalette.color4),
borderColor: getColorFromToken(DataVizPalette.color24),
},
{
nodeId: 5,
name: '172.630.89.4',
color: getColorFromToken(DataVizPalette.color4),
borderColor: getColorFromToken(DataVizPalette.color24),
},
{
nodeId: 6,
name: 'inbox',
color: getColorFromToken(DataVizPalette.color3),
borderColor: getColorFromToken(DataVizPalette.color23),
},
{
nodeId: 7,
name: 'Junk Folder',
color: getColorFromToken(DataVizPalette.color3),
borderColor: getColorFromToken(DataVizPalette.color23),
},
{
nodeId: 8,
name: 'Deleted Folder',
color: getColorFromToken(DataVizPalette.color3),
borderColor: getColorFromToken(DataVizPalette.color23),
},
{
nodeId: 9,
name: 'Clicked',
color: getColorFromToken(DataVizPalette.color1),
borderColor: getColorFromToken(DataVizPalette.color21),
},
{
nodeId: 10,
name: 'Opened',
color: getColorFromToken(DataVizPalette.color1),
borderColor: getColorFromToken(DataVizPalette.color21),
},
{
nodeId: 11,
name: ' No further action required',
color: getColorFromToken(DataVizPalette.color1),
borderColor: getColorFromToken(DataVizPalette.color21),
},
],
links: [
{
source: 0,
target: 6,
value: 80,
},
{
source: 1,
target: 6,
value: 50,
},
{
source: 1,
target: 7,
value: 28,
},
{
source: 2,
target: 7,
value: 14,
},
{
source: 3,
target: 7,
value: 7,
},
{
source: 3,
target: 8,
value: 20,
},
{
source: 4,
target: 7,
value: 10,
},
{
source: 5,
target: 7,
value: 10,
},
{
source: 6,
target: 9,
value: 30,
},
{
source: 6,
target: 10,
value: 55,
},
{
source: 7,
target: 11,
value: 60,
},
{
source: 8,
target: 11,
value: 2,
},
],
},
};
const rootStyle = { width: `${this.state.width}px`, height: `${this.state.height}px` };
return (
);
}
}