Skip to content

Commit

Permalink
fix typo & itemModel should not be created twice
Browse files Browse the repository at this point in the history
  • Loading branch information
yufeng04 committed Sep 23, 2019
1 parent ce034f9 commit e8c8e09
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
10 changes: 6 additions & 4 deletions src/visual/dataColor.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions test/legend-borderColor.html
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -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'
Expand Down

0 comments on commit e8c8e09

Please sign in to comment.