Skip to content

Commit

Permalink
fix(sankey): also allow the levels option to be undefined
Browse files Browse the repository at this point in the history
  • Loading branch information
plainheart committed Sep 29, 2024
1 parent 9593e0f commit 3f03c76
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/chart/sankey/SankeySeries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ class SankeySeriesModel extends SeriesModel<SankeySeriesOption> {
getInitialData(option: SankeySeriesOption, ecModel: GlobalModel) {
const links = option.edges || option.links || [];
const nodes = option.data || option.nodes || [];
const levels = option.levels;
const levels = option.levels || [];
this.levelModels = [];
const levelModels = this.levelModels;

Expand All @@ -172,10 +172,10 @@ class SankeySeriesModel extends SeriesModel<SankeySeriesOption> {
}
}
}
if (nodes && links) {
const graph = createGraphFromNodeEdge(nodes, links, this, true, beforeLink);
return graph.data;
}

const graph = createGraphFromNodeEdge(nodes, links, this, true, beforeLink);
return graph.data;

function beforeLink(nodeData: SeriesData, edgeData: SeriesData) {
nodeData.wrapMethod('getItemModel', function (model: Model, idx: number) {
const seriesModel = model.parentModel as SankeySeriesModel;
Expand Down

0 comments on commit 3f03c76

Please sign in to comment.