Skip to content

Commit

Permalink
Merge pull request #18624 from apache/fix/graph/edgeLabel-NPE
Browse files Browse the repository at this point in the history
fix(graph): fix graph chart can't be hidden by legend due to edgeLabel NPE
  • Loading branch information
plainheart authored May 15, 2023
2 parents 9e5745a + dfd95aa commit daa7479
Show file tree
Hide file tree
Showing 5 changed files with 69 additions and 7 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
"mktest": "node test/build/mktest.js",
"mktest:help": "node test/build/mktest.js -h",
"checktype": "tsc --noEmit",
"lint": "npx eslint src/**/*.ts extension-src/**/*.ts",
"lint": "npx eslint --cache --cache-location node_modules/.cache/eslint src/**/*.ts extension-src/**/*.ts",
"lint:fix": "npx eslint --fix src/**/*.ts extension-src/**/*.ts",
"lint:dist": "echo 'It might take a while. Please wait ...' && npx jshint --config .jshintrc-dist dist/echarts.js"
},
Expand Down
12 changes: 7 additions & 5 deletions src/label/LabelManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -487,10 +487,11 @@ class LabelManager {

const defaultStyle: PathStyleProps = {};
const visualStyle = data.getItemVisual(dataIndex, 'style');
const visualType = data.getVisual('drawType');
// Default to be same with main color
defaultStyle.stroke = visualStyle[visualType];

if (visualStyle) {
const visualType = data.getVisual('drawType');
// Default to be same with main color
defaultStyle.stroke = visualStyle[visualType];
}
const labelLineModel = itemModel.getModel('labelLine');

setLabelLineStyle(el, getLabelLineStatesModels(itemModel), defaultStyle);
Expand Down Expand Up @@ -591,4 +592,5 @@ class LabelManager {
}


export default LabelManager;
export default LabelManager;

60 changes: 59 additions & 1 deletion test/graph-case.html

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

1 change: 1 addition & 0 deletions test/runTest/actions/__meta__.json

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

1 change: 1 addition & 0 deletions test/runTest/actions/graph-case.json

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

0 comments on commit daa7479

Please sign in to comment.