diff --git a/src/chart/line/LineView.js b/src/chart/line/LineView.js index 70c27a0277a25038fc88131020f884cbbbe85a82..49362e0d437bd1b8e37d41199fb0d3c962f469c8 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 0000000000000000000000000000000000000000..db4978ac794c4575cae5a90691edd234e38b0f20 --- /dev/null +++ b/test/line-itemstyle-color-function.html @@ -0,0 +1,91 @@ + + + + + + + + + + + + + + + +
+
+ + + +