diff --git a/src/visual/dataColor.js b/src/visual/dataColor.js index a408c584cf..63c2b84e9a 100644 --- a/src/visual/dataColor.js +++ b/src/visual/dataColor.js @@ -56,9 +56,13 @@ export default function (seriesType) { var singleDataBorderColor = filteredIdx != null && data.getItemVisual(filteredIdx, 'borderColor', true); - if (!singleDataColor) { + var itemModel; + if (!singleDataColor || !singleDataBorderColor) { // FIXME Performance - var itemModel = dataAll.getItemModel(rawIdx); + itemModel = dataAll.getItemModel(rawIdx); + } + + if (!singleDataColor) { var color = itemModel.get('itemStyle.color') || seriesModel.getColorFromPalette( dataAll.getName(rawIdx) || (rawIdx + ''), seriesModel.__paletteScope, @@ -78,8 +82,6 @@ export default function (seriesType) { } if (!singleDataBorderColor) { - // FIXME Performance - var itemModel = dataAll.getItemModel(rawIdx); var borderColor = itemModel.get('itemStyle.borderColor'); // Legend may use the visual info in data before processed dataAll.setItemVisual(rawIdx, 'borderColor', borderColor); diff --git a/test/legend-borderColor.html b/test/legend-borderColor.html index 056f61839e..7caa9fbd2d 100644 --- a/test/legend-borderColor.html +++ b/test/legend-borderColor.html @@ -299,7 +299,7 @@ // chart1.setOption(option1); testHelper.create(echarts, 'plain1', { title: [ - '(Legend symbol of line)', + '(Legend symbol of bar)', 'the borderColor of first legend symbol should be black', 'the borderColor of second legend symbol should be blue', 'the bar borderColor of second series should be red, because the legend borderColor is incompatible with barBorderColor', @@ -423,7 +423,7 @@ // chart2.setOption(option2); testHelper.create(echarts, 'plain2', { title: [ - '(Legend symbol of line)', + '(Legend symbol of pie)', 'the first legend symbol should be unselected', 'the borderColor of legend symbol should be red', 'the borderWidth of all legend symbols should be 3'