@visactor/vmind
Version:
<div align="center"> <a href="https://github.com/VisActor#gh-light-mode-only" target="_blank"> <img alt="VisActor Logo" width="200" src="https://github.com/VisActor/.github/blob/main/profile/logo_500_200_light.svg"/> </a> <a href="https://githu
62 lines (52 loc) • 1.84 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: !0
}), exports.pipelineSankey = exports.sankeyLabel = exports.sankeyLink = exports.sankeyField = exports.sankeyData = void 0;
const dataTable_1 = require("../../../../utils/dataTable"), common_1 = require("./common"), sankeyData = context => {
const {dataTable: dataTable, cell: cell, spec: spec} = context, {source: source, target: target} = cell, linkData = (0,
dataTable_1.isValidDataTable)(dataTable) ? dataTable : [], nodeData = [ ...new Set([ ...linkData.map((item => item[source])), ...linkData.map((item => item[target])) ]) ].map((node => ({
name: node
})));
return spec.data = {
id: "data",
values: [ {
nodes: nodeData,
links: linkData
} ]
}, {
spec: spec
};
};
exports.sankeyData = sankeyData;
const sankeyField = context => {
const {cell: cell, spec: spec} = context;
return spec.sourceField = cell.source, spec.targetField = cell.target, spec.valueField = cell.value,
spec.categoryField = "name", spec.nodeKey = datum => datum.name, {
spec: spec
};
};
exports.sankeyField = sankeyField;
const sankeyLink = context => {
const {spec: spec} = context;
return spec.link = {
style: {},
state: {
hover: {},
blur: {}
}
}, {
spec: spec
};
};
exports.sankeyLink = sankeyLink;
const sankeyLabel = context => {
const {spec: spec} = context;
return spec.label = {
visible: !0,
style: {}
}, {
spec: spec
};
};
exports.sankeyLabel = sankeyLabel, exports.pipelineSankey = [ exports.sankeyData, common_1.color, exports.sankeyField, exports.sankeyLink, exports.sankeyLabel, common_1.discreteLegend ];
//# sourceMappingURL=sankey.js.map