From c30905599e34f041d2d732db56d3fb9745538175 Mon Sep 17 00:00:00 2001 From: Vvvickie <714846527@qq.com> Date: Mon, 8 Oct 2018 09:24:47 +0300 Subject: [PATCH 01/13] fix categoryVisual symbol symbolSize opacity --- src/chart/graph/categoryVisual.js | 39 +++++++++++++++++++++++++++++-- 1 file changed, 37 insertions(+), 2 deletions(-) diff --git a/src/chart/graph/categoryVisual.js b/src/chart/graph/categoryVisual.js index e7e318f530..94d012aaaa 100644 --- a/src/chart/graph/categoryVisual.js +++ b/src/chart/graph/categoryVisual.js @@ -31,11 +31,25 @@ export default function (ecModel) { var name = categoriesData.getName(idx); // Add prefix to avoid conflict with Object.prototype. categoryNameIdxMap['ec-' + name] = idx; - var itemModel = categoriesData.getItemModel(idx); + var color = itemModel.get('itemStyle.color') || seriesModel.getColorFromPalette(name, paletteScope); categoriesData.setItemVisual(idx, 'color', color); + var opacity = itemModel.get('itemStyle.opacity') + || 1; + categoriesData.setItemVisual(idx, 'opacity', opacity); + var itemSymbolType = itemModel.getShallow('symbol', true); + var itemSymbolSize = itemModel.getShallow('symbolSize', + true); + if (itemSymbolType != null) { + categoriesData.setItemVisual(idx, 'symbol', itemSymbolType); + } + if (itemSymbolSize != null) { + // PENDING Transform symbolSize ? + categoriesData.setItemVisual(idx, 'symbolSize', itemSymbolSize); + } + }); // Assign category color to visual @@ -53,8 +67,29 @@ export default function (ecModel) { categoriesData.getItemVisual(category, 'color') ); } + if (!data.getItemVisual(idx, 'opacity', true)) { + data.setItemVisual( + idx, 'opacity', + categoriesData.getItemVisual(category, 'opacity') + ); + } + + if (!data.getItemVisual(idx, 'symbol', true)) { + data.setItemVisual( + idx, 'symbol', + categoriesData.getItemVisual(category, 'symbol') + ); + } + + if (!data.getItemVisual(idx, 'symbolSize', true)) { + data.setItemVisual( + idx, 'symbolSize', + categoriesData.getItemVisual(category, 'symbolSize') + ); + } + } }); } }); -} \ No newline at end of file +} From 4a8e61c0c1d6b76334e95d7d11f40f17423cec1c Mon Sep 17 00:00:00 2001 From: Vvvickie <714846527@qq.com> Date: Wed, 10 Oct 2018 11:25:23 +0300 Subject: [PATCH 02/13] fix symbolKeepAspect symbolRotate symbolOffset --- src/chart/graph/categoryVisual.js | 43 +++++++++++++++++++++++++++---- 1 file changed, 38 insertions(+), 5 deletions(-) diff --git a/src/chart/graph/categoryVisual.js b/src/chart/graph/categoryVisual.js index 94d012aaaa..d31e4355f8 100644 --- a/src/chart/graph/categoryVisual.js +++ b/src/chart/graph/categoryVisual.js @@ -36,20 +36,32 @@ export default function (ecModel) { var color = itemModel.get('itemStyle.color') || seriesModel.getColorFromPalette(name, paletteScope); categoriesData.setItemVisual(idx, 'color', color); - var opacity = itemModel.get('itemStyle.opacity') - || 1; + var opacity = itemModel.get('itemStyle.opacity') || 1; categoriesData.setItemVisual(idx, 'opacity', opacity); var itemSymbolType = itemModel.getShallow('symbol', true); - var itemSymbolSize = itemModel.getShallow('symbolSize', - true); if (itemSymbolType != null) { categoriesData.setItemVisual(idx, 'symbol', itemSymbolType); } + + var itemSymbolSize = itemModel.getShallow('symbolSize', true); if (itemSymbolSize != null) { - // PENDING Transform symbolSize ? categoriesData.setItemVisual(idx, 'symbolSize', itemSymbolSize); } + var itemSymbolKeepAspect = itemModel.getShallow('symbolKeepAspect',true); + if (itemSymbolKeepAspect != null) { + categoriesData.setItemVisual(idx, 'symbolKeepAspect', itemSymbolKeepAspect); + } + + var itemSymbolOffset = itemModel.getShallow('symbolOffset',true); + if (itemSymbolOffset != null) { + categoriesData.setItemVisual(idx, 'symbolOffset', itemSymbolOffset); + } + + var itemSymbolRotate = itemModel.getShallow('symbolRotate',true) || 0; + if (itemSymbolRotate != null) { + categoriesData.setItemVisual(idx, 'symbolRotate', itemSymbolRotate); + } }); // Assign category color to visual @@ -88,6 +100,27 @@ export default function (ecModel) { ); } + if (!data.getItemVisual(idx, 'symbolKeepAspect', true)) { + data.setItemVisual( + idx, 'symbolKeepAspect', + categoriesData.getItemVisual(category, 'symbolKeepAspect') + ); + } + + if (!data.getItemVisual(idx, 'symbolOffset', true)) { + data.setItemVisual( + idx, 'symbolOffset', + categoriesData.getItemVisual(category, 'symbolOffset') + ); + } + + if (!data.getItemVisual(idx, 'symbolRotate', true)) { + console.log(111); + data.setItemVisual( + idx, 'symbolRotate', + categoriesData.getItemVisual(category, 'symbolRotate') + ); + } } }); } From fa319d230f3850bd81e46e85bfd1bae2f050d6a0 Mon Sep 17 00:00:00 2001 From: Vvvickie <714846527@qq.com> Date: Wed, 10 Oct 2018 11:52:03 +0300 Subject: [PATCH 03/13] delete console --- src/chart/graph/categoryVisual.js | 1 - 1 file changed, 1 deletion(-) diff --git a/src/chart/graph/categoryVisual.js b/src/chart/graph/categoryVisual.js index d31e4355f8..c41c5c33d0 100644 --- a/src/chart/graph/categoryVisual.js +++ b/src/chart/graph/categoryVisual.js @@ -115,7 +115,6 @@ export default function (ecModel) { } if (!data.getItemVisual(idx, 'symbolRotate', true)) { - console.log(111); data.setItemVisual( idx, 'symbolRotate', categoriesData.getItemVisual(category, 'symbolRotate') From 81e8caf4549ea3023326b7bde70d0c0494e6ba5e Mon Sep 17 00:00:00 2001 From: Vvvickie <714846527@qq.com> Date: Thu, 11 Oct 2018 09:45:26 +0300 Subject: [PATCH 04/13] do symbolStyle Configs in a loop --- src/chart/graph/categoryVisual.js | 84 +++++++++---------------------- 1 file changed, 23 insertions(+), 61 deletions(-) diff --git a/src/chart/graph/categoryVisual.js b/src/chart/graph/categoryVisual.js index c41c5c33d0..d00516db65 100644 --- a/src/chart/graph/categoryVisual.js +++ b/src/chart/graph/categoryVisual.js @@ -36,32 +36,19 @@ export default function (ecModel) { var color = itemModel.get('itemStyle.color') || seriesModel.getColorFromPalette(name, paletteScope); categoriesData.setItemVisual(idx, 'color', color); + var opacity = itemModel.get('itemStyle.opacity') || 1; categoriesData.setItemVisual(idx, 'opacity', opacity); - var itemSymbolType = itemModel.getShallow('symbol', true); - if (itemSymbolType != null) { - categoriesData.setItemVisual(idx, 'symbol', itemSymbolType); - } - var itemSymbolSize = itemModel.getShallow('symbolSize', true); - if (itemSymbolSize != null) { - categoriesData.setItemVisual(idx, 'symbolSize', itemSymbolSize); - } + var symbolStyleList = ['symbol','symbolSize','symbolKeepAspect','symbolOffset','symbolRotate'] - var itemSymbolKeepAspect = itemModel.getShallow('symbolKeepAspect',true); - if (itemSymbolKeepAspect != null) { - categoriesData.setItemVisual(idx, 'symbolKeepAspect', itemSymbolKeepAspect); - } - - var itemSymbolOffset = itemModel.getShallow('symbolOffset',true); - if (itemSymbolOffset != null) { - categoriesData.setItemVisual(idx, 'symbolOffset', itemSymbolOffset); + for(var i = 0;i < symbolStyleList.length;i++){ + var symbolStyleItem = itemModel.getShallow(symbolStyleList[i], true); + if (symbolStyleItem != null) { + categoriesData.setItemVisual(idx, symbolStyleList[i], symbolStyleItem); + } } - var itemSymbolRotate = itemModel.getShallow('symbolRotate',true) || 0; - if (itemSymbolRotate != null) { - categoriesData.setItemVisual(idx, 'symbolRotate', itemSymbolRotate); - } }); // Assign category color to visual @@ -73,52 +60,27 @@ export default function (ecModel) { if (typeof category === 'string') { category = categoryNameIdxMap['ec-' + category]; } - if (!data.getItemVisual(idx, 'color', true)) { - data.setItemVisual( - idx, 'color', - categoriesData.getItemVisual(category, 'color') - ); - } - if (!data.getItemVisual(idx, 'opacity', true)) { - data.setItemVisual( - idx, 'opacity', - categoriesData.getItemVisual(category, 'opacity') - ); - } - - if (!data.getItemVisual(idx, 'symbol', true)) { - data.setItemVisual( - idx, 'symbol', - categoriesData.getItemVisual(category, 'symbol') - ); - } - if (!data.getItemVisual(idx, 'symbolSize', true)) { - data.setItemVisual( - idx, 'symbolSize', - categoriesData.getItemVisual(category, 'symbolSize') - ); - } + var itemStyleList = ['color','opacity']; - if (!data.getItemVisual(idx, 'symbolKeepAspect', true)) { - data.setItemVisual( - idx, 'symbolKeepAspect', - categoriesData.getItemVisual(category, 'symbolKeepAspect') - ); + for(var i =0; i Date: Thu, 11 Oct 2018 12:29:10 +0300 Subject: [PATCH 05/13] format codeStyle --- src/chart/graph/categoryVisual.js | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/chart/graph/categoryVisual.js b/src/chart/graph/categoryVisual.js index d00516db65..a06d67eafc 100644 --- a/src/chart/graph/categoryVisual.js +++ b/src/chart/graph/categoryVisual.js @@ -40,10 +40,11 @@ export default function (ecModel) { var opacity = itemModel.get('itemStyle.opacity') || 1; categoriesData.setItemVisual(idx, 'opacity', opacity); - var symbolStyleList = ['symbol','symbolSize','symbolKeepAspect','symbolOffset','symbolRotate'] + var symbolStyleList = ['symbol', 'symbolSize', 'symbolKeepAspect', 'symbolOffset', 'symbolRotate']; - for(var i = 0;i < symbolStyleList.length;i++){ + for (var i = 0; i < symbolStyleList.length; i++) { var symbolStyleItem = itemModel.getShallow(symbolStyleList[i], true); + console.log(symbolStyleItem); if (symbolStyleItem != null) { categoriesData.setItemVisual(idx, symbolStyleList[i], symbolStyleItem); } @@ -61,24 +62,24 @@ export default function (ecModel) { category = categoryNameIdxMap['ec-' + category]; } - var itemStyleList = ['color','opacity']; + var itemStyleList = ['color', 'opacity']; - for(var i =0; i Date: Thu, 11 Oct 2018 12:37:32 +0300 Subject: [PATCH 06/13] format codeStyle --- src/chart/graph/categoryVisual.js | 1 - 1 file changed, 1 deletion(-) diff --git a/src/chart/graph/categoryVisual.js b/src/chart/graph/categoryVisual.js index a06d67eafc..35b250f5e6 100644 --- a/src/chart/graph/categoryVisual.js +++ b/src/chart/graph/categoryVisual.js @@ -44,7 +44,6 @@ export default function (ecModel) { for (var i = 0; i < symbolStyleList.length; i++) { var symbolStyleItem = itemModel.getShallow(symbolStyleList[i], true); - console.log(symbolStyleItem); if (symbolStyleItem != null) { categoriesData.setItemVisual(idx, symbolStyleList[i], symbolStyleItem); } From 360e0d58b2896f4cd99a4c1871b1c164e2219993 Mon Sep 17 00:00:00 2001 From: Vvvickie <714846527@qq.com> Date: Thu, 11 Oct 2018 13:32:49 +0300 Subject: [PATCH 07/13] reduct the latter symbolStyleList --- src/chart/graph/categoryVisual.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/chart/graph/categoryVisual.js b/src/chart/graph/categoryVisual.js index 35b250f5e6..cfef4539f5 100644 --- a/src/chart/graph/categoryVisual.js +++ b/src/chart/graph/categoryVisual.js @@ -72,7 +72,7 @@ export default function (ecModel) { } } - var symbolStyleList = ['symbol', 'symbolSize', 'symbolKeepAspect', 'symbolOffset', 'symbolRotate']; + var symbolStyleList = ['symbol', 'symbolSize', 'symbolKeepAspect']; for (var i = 0; i < symbolStyleList.length; i++) { if (!data.getItemVisual(idx, symbolStyleList[i], true)) { From 87679818d8334ff126fb92e6e257371239c99912 Mon Sep 17 00:00:00 2001 From: Vvvickie <714846527@qq.com> Date: Tue, 30 Oct 2018 21:51:12 +0200 Subject: [PATCH 08/13] use itemMode to get symbol --- src/chart/graph/categoryVisual.js | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/src/chart/graph/categoryVisual.js b/src/chart/graph/categoryVisual.js index cfef4539f5..efff10d9cb 100644 --- a/src/chart/graph/categoryVisual.js +++ b/src/chart/graph/categoryVisual.js @@ -40,8 +40,7 @@ export default function (ecModel) { var opacity = itemModel.get('itemStyle.opacity') || 1; categoriesData.setItemVisual(idx, 'opacity', opacity); - var symbolStyleList = ['symbol', 'symbolSize', 'symbolKeepAspect', 'symbolOffset', 'symbolRotate']; - + var symbolStyleList = ['symbolSize', 'symbolKeepAspect']; for (var i = 0; i < symbolStyleList.length; i++) { var symbolStyleItem = itemModel.getShallow(symbolStyleList[i], true); if (symbolStyleItem != null) { @@ -54,6 +53,12 @@ export default function (ecModel) { // Assign category color to visual if (categoriesData.count()) { data.each(function (idx) { + var itemModel = categoriesData.getItemModel(idx); + var symbol = itemModel.getShallow('symbol', true); + if (symbol) { + data.setItemVisual(idx, 'symbol', symbol); + } + var model = data.getItemModel(idx); var category = model.getShallow('category'); if (category != null) { @@ -61,7 +66,7 @@ export default function (ecModel) { category = categoryNameIdxMap['ec-' + category]; } - var itemStyleList = ['color', 'opacity']; + var itemStyleList = ['color', 'opacity', 'symbolSize', 'symbolKeepAspect']; for (var i = 0; i < itemStyleList.length; i++) { if (!data.getItemVisual(idx, itemStyleList[i], true)) { @@ -71,17 +76,6 @@ export default function (ecModel) { ); } } - - var symbolStyleList = ['symbol', 'symbolSize', 'symbolKeepAspect']; - - for (var i = 0; i < symbolStyleList.length; i++) { - if (!data.getItemVisual(idx, symbolStyleList[i], true)) { - data.setItemVisual( - idx, symbolStyleList[i], - categoriesData.getItemVisual(category, symbolStyleList[i]) - ); - } - } } }); } From 0e390afb5aed2dab6fd950bb0c30c5b3baaee32b Mon Sep 17 00:00:00 2001 From: Vvvickie <714846527@qq.com> Date: Wed, 31 Oct 2018 22:54:37 +0200 Subject: [PATCH 09/13] review --- src/chart/graph/categoryVisual.js | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/src/chart/graph/categoryVisual.js b/src/chart/graph/categoryVisual.js index efff10d9cb..5d36edf8d1 100644 --- a/src/chart/graph/categoryVisual.js +++ b/src/chart/graph/categoryVisual.js @@ -37,28 +37,21 @@ export default function (ecModel) { || seriesModel.getColorFromPalette(name, paletteScope); categoriesData.setItemVisual(idx, 'color', color); - var opacity = itemModel.get('itemStyle.opacity') || 1; - categoriesData.setItemVisual(idx, 'opacity', opacity); + var opacity = itemModel.get('opacity'); + if (opacity != undefined) { + categoriesData.setItemVisual(idx, 'opacity', opacity); + } var symbolStyleList = ['symbolSize', 'symbolKeepAspect']; for (var i = 0; i < symbolStyleList.length; i++) { var symbolStyleItem = itemModel.getShallow(symbolStyleList[i], true); - if (symbolStyleItem != null) { - categoriesData.setItemVisual(idx, symbolStyleList[i], symbolStyleItem); - } + categoriesData.setItemVisual(idx, symbolStyleList[i], symbolStyleItem); } - }); // Assign category color to visual if (categoriesData.count()) { data.each(function (idx) { - var itemModel = categoriesData.getItemModel(idx); - var symbol = itemModel.getShallow('symbol', true); - if (symbol) { - data.setItemVisual(idx, 'symbol', symbol); - } - var model = data.getItemModel(idx); var category = model.getShallow('category'); if (category != null) { @@ -69,7 +62,7 @@ export default function (ecModel) { var itemStyleList = ['color', 'opacity', 'symbolSize', 'symbolKeepAspect']; for (var i = 0; i < itemStyleList.length; i++) { - if (!data.getItemVisual(idx, itemStyleList[i], true)) { + if (data.getItemVisual(idx, itemStyleList[i], true) == null) { data.setItemVisual( idx, itemStyleList[i], categoriesData.getItemVisual(category, itemStyleList[i]) From d801e18890efabded5e36a2704db037e72d98126 Mon Sep 17 00:00:00 2001 From: Vvvickie <714846527@qq.com> Date: Sun, 4 Nov 2018 15:23:06 +0200 Subject: [PATCH 10/13] add symbol --- src/chart/graph/categoryVisual.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/chart/graph/categoryVisual.js b/src/chart/graph/categoryVisual.js index 5d36edf8d1..e584d17ef9 100644 --- a/src/chart/graph/categoryVisual.js +++ b/src/chart/graph/categoryVisual.js @@ -52,6 +52,12 @@ export default function (ecModel) { // Assign category color to visual if (categoriesData.count()) { data.each(function (idx) { + var itemModel = categoriesData.getItemModel(idx); + var symbol = itemModel.getShallow('symbol', true); + if (symbol) { + data.setItemVisual(idx, 'symbol', symbol); + } + var model = data.getItemModel(idx); var category = model.getShallow('category'); if (category != null) { From 9dccfd07bb1b3c780ab9af98dcba9c1753ac7363 Mon Sep 17 00:00:00 2001 From: Vvvickie <714846527@qq.com> Date: Sun, 4 Nov 2018 15:25:14 +0200 Subject: [PATCH 11/13] add symbol --- src/chart/graph/categoryVisual.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/chart/graph/categoryVisual.js b/src/chart/graph/categoryVisual.js index e584d17ef9..7473239436 100644 --- a/src/chart/graph/categoryVisual.js +++ b/src/chart/graph/categoryVisual.js @@ -38,7 +38,7 @@ export default function (ecModel) { categoriesData.setItemVisual(idx, 'color', color); var opacity = itemModel.get('opacity'); - if (opacity != undefined) { + if (opacity != null) { categoriesData.setItemVisual(idx, 'opacity', opacity); } From 886d4c50710cf37f3c19e18559227dddc3f06e00 Mon Sep 17 00:00:00 2001 From: Vvvickie <714846527@qq.com> Date: Sun, 4 Nov 2018 15:31:15 +0200 Subject: [PATCH 12/13] about symbol --- src/chart/graph/categoryVisual.js | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/src/chart/graph/categoryVisual.js b/src/chart/graph/categoryVisual.js index 7473239436..a841693dc2 100644 --- a/src/chart/graph/categoryVisual.js +++ b/src/chart/graph/categoryVisual.js @@ -42,7 +42,7 @@ export default function (ecModel) { categoriesData.setItemVisual(idx, 'opacity', opacity); } - var symbolStyleList = ['symbolSize', 'symbolKeepAspect']; + var symbolStyleList = ['symbol','symbolSize', 'symbolKeepAspect']; for (var i = 0; i < symbolStyleList.length; i++) { var symbolStyleItem = itemModel.getShallow(symbolStyleList[i], true); categoriesData.setItemVisual(idx, symbolStyleList[i], symbolStyleItem); @@ -52,12 +52,6 @@ export default function (ecModel) { // Assign category color to visual if (categoriesData.count()) { data.each(function (idx) { - var itemModel = categoriesData.getItemModel(idx); - var symbol = itemModel.getShallow('symbol', true); - if (symbol) { - data.setItemVisual(idx, 'symbol', symbol); - } - var model = data.getItemModel(idx); var category = model.getShallow('category'); if (category != null) { @@ -65,7 +59,7 @@ export default function (ecModel) { category = categoryNameIdxMap['ec-' + category]; } - var itemStyleList = ['color', 'opacity', 'symbolSize', 'symbolKeepAspect']; + var itemStyleList = ['color', 'opacity','symbol', 'symbolSize', 'symbolKeepAspect']; for (var i = 0; i < itemStyleList.length; i++) { if (data.getItemVisual(idx, itemStyleList[i], true) == null) { From 2c2d8ef90bcb3657eddf7a86b87b760b0b4791c6 Mon Sep 17 00:00:00 2001 From: Vvvickie <714846527@qq.com> Date: Sun, 4 Nov 2018 15:52:54 +0200 Subject: [PATCH 13/13] add symbol --- src/chart/graph/categoryVisual.js | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/src/chart/graph/categoryVisual.js b/src/chart/graph/categoryVisual.js index a841693dc2..00c54f968c 100644 --- a/src/chart/graph/categoryVisual.js +++ b/src/chart/graph/categoryVisual.js @@ -37,15 +37,12 @@ export default function (ecModel) { || seriesModel.getColorFromPalette(name, paletteScope); categoriesData.setItemVisual(idx, 'color', color); - var opacity = itemModel.get('opacity'); - if (opacity != null) { - categoriesData.setItemVisual(idx, 'opacity', opacity); - } - - var symbolStyleList = ['symbol','symbolSize', 'symbolKeepAspect']; - for (var i = 0; i < symbolStyleList.length; i++) { - var symbolStyleItem = itemModel.getShallow(symbolStyleList[i], true); - categoriesData.setItemVisual(idx, symbolStyleList[i], symbolStyleItem); + var itemStyleList = ['opacity', 'symbol', 'symbolSize', 'symbolKeepAspect']; + for (var i = 0; i < itemStyleList.length; i++) { + var itemStyle = itemModel.getShallow(itemStyleList[i], true); + if (itemStyle != null) { + categoriesData.setItemVisual(idx, itemStyleList[i], itemStyle); + } } }); @@ -59,7 +56,7 @@ export default function (ecModel) { category = categoryNameIdxMap['ec-' + category]; } - var itemStyleList = ['color', 'opacity','symbol', 'symbolSize', 'symbolKeepAspect']; + var itemStyleList = ['color', 'opacity', 'symbol', 'symbolSize', 'symbolKeepAspect']; for (var i = 0; i < itemStyleList.length; i++) { if (data.getItemVisual(idx, itemStyleList[i], true) == null) {