Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(graph): fix error when symbol is none. #16394

Merged
merged 1 commit into from
Jan 20, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion src/chart/graph/GraphView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,11 @@ class GraphView extends ChartView {
const idx = node.dataIndex;
const el = node.getGraphicEl() as Symbol;
const itemModel = node.getModel<GraphNodeItemOption>();

if (!el) {
return;
}

// Update draggable
el.off('drag').off('dragend');
const draggable = itemModel.get('draggable');
Expand Down Expand Up @@ -158,6 +163,10 @@ class GraphView extends ChartView {
const el = edge.getGraphicEl() as Line;
const focus = edge.getModel<GraphEdgeItemOption>().get(['emphasis', 'focus']);

if (!el) {
return;
}

if (focus === 'adjacency') {
getECData(el).focus = {
edge: [edge.dataIndex],
Expand Down Expand Up @@ -288,7 +297,7 @@ class GraphView extends ChartView {
const nodeScale = getNodeGlobalScale(seriesModel);

data.eachItemGraphicEl(function (el: Symbol, idx) {
el.setSymbolScale(nodeScale);
el && el.setSymbolScale(nodeScale);
});
}

Expand Down
101 changes: 101 additions & 0 deletions test/graph-case.html

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