提交 60d2751b 编写于 作者: Y yufeng04

Modified the logic of function setSymbolStyle

上级 203f17a4
......@@ -314,7 +314,7 @@ export default echarts.extendComponentView({
var inactiveColor = legendModel.get('inactiveColor');
var inactiveBorderColor = legendModel.get('inactiveBorderColor');
var symbolKeepAspect = legendModel.get('symbolKeepAspect');
var itemStyle = legendModel.getModel('itemStyle').getItemStyle();
var legendModelItemStyle = legendModel.getModel('itemStyle');
var isSelected = legendModel.isSelected(name);
var itemGroup = new Group();
......@@ -340,7 +340,7 @@ export default echarts.extendComponentView({
);
itemGroup.add(
setSymbolStyle(
legendSymbol, legendSymbolType, itemStyle,
legendSymbol, legendSymbolType, legendModelItemStyle,
borderColor, inactiveBorderColor, isSelected
)
);
......@@ -368,7 +368,7 @@ export default echarts.extendComponentView({
// Put symbol in the center
itemGroup.add(
setSymbolStyle(
legendSymbolCenter, symbolType, itemStyle,
legendSymbolCenter, symbolType, legendModelItemStyle,
borderColor, inactiveBorderColor, isSelected
)
);
......@@ -503,15 +503,19 @@ export default echarts.extendComponentView({
});
function setSymbolStyle(symbol, symbolType, itemStyle, borderColor, inactiveBorderColor, isSelected) {
function setSymbolStyle(symbol, symbolType, legendModelItemStyle, borderColor, inactiveBorderColor, isSelected) {
var itemStyle;
if (symbolType !== 'line' && symbolType.indexOf('empty') < 0) {
itemStyle = legendModelItemStyle.getItemStyle();
symbol.style.stroke = borderColor;
if (!isSelected) {
itemStyle.stroke = inactiveBorderColor;
}
symbol.setStyle(itemStyle);
}
return symbol;
else {
itemStyle = legendModelItemStyle.getItemStyle(['borderWidth', 'borderColor']);
}
return symbol.setStyle(itemStyle);
}
function dispatchSelectAction(name, api) {
......
......@@ -74,7 +74,8 @@ under the License.
data: ['邮件营销', '联盟广告', '视频广告', '直接访问', '搜索引擎'],
itemStyle: {
// borderColor: '#f00',
borderWidth: 3
borderWidth: 3,
borderType: 'dashed'
},
selected: {
'联盟广告': false,
......@@ -179,6 +180,7 @@ under the License.
title: [
'(Legend symbol of line)',
'the emptyCircle symbol doesn\'t have fillColor, so the strokeColor should be the same as color of corresponding series',
'the borderType of legend symbol is dashed, especially the first emptyCircle symbol',
'the color of line in legend symbol should be same as corresponding symbol',
'the borderWidth of legend symbols should only be determined by legend.itemStyle.borderWidth',
'the second and the third legend symbol should be unselected'
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册