From fbbbbd3ab43c8f7a131f47e5799e91fb203eac55 Mon Sep 17 00:00:00 2001 From: susiwen8 Date: Wed, 6 Nov 2019 11:12:21 +0800 Subject: [PATCH] fix(line): fix black line when itemStyle.color is set to a callback function * Fix #10910 * Add test case * Refine line color function --- src/chart/line/LineView.js | 3 + test/line-itemstyle-color-function.html | 91 +++++++++++++++++++++++++ 2 files changed, 94 insertions(+) create mode 100644 test/line-itemstyle-color-function.html diff --git a/src/chart/line/LineView.js b/src/chart/line/LineView.js index 70c27a027..49362e0d4 100644 --- a/src/chart/line/LineView.js +++ b/src/chart/line/LineView.js @@ -453,6 +453,9 @@ export default ChartView.extend({ } var visualColor = getVisualGradient(data, coordSys) || data.getVisual('color'); + if (typeof visualColor === 'function') { + visualColor = visualColor(seriesModel.getDataParams(0)) || '#000000'; + } polyline.useStyle(zrUtil.defaults( // Use color in lineStyle first diff --git a/test/line-itemstyle-color-function.html b/test/line-itemstyle-color-function.html new file mode 100644 index 000000000..db4978ac7 --- /dev/null +++ b/test/line-itemstyle-color-function.html @@ -0,0 +1,91 @@ + + + + + + + + + + + + + + + +
+
+ + + + -- GitLab