提交 fa5ad1b6 编写于 作者: K kener

支持normal.color为function

上级 b7dafa91
......@@ -563,7 +563,9 @@ define(function(require) {
itemShape = getLineMarkShape(
mlOption, // markLine
seriesIndex,
data[i], // 数据
i,
parsePercent(data[i][0].x, zrWidth), // 坐标
parsePercent(data[i][0].y, zrHeight), // 坐标
parsePercent(data[i][1].x, zrWidth), // 坐标
......@@ -651,16 +653,21 @@ define(function(require) {
brushType : 'both',
color : symbol.match('empty')
? emptyColor
: (normal.color || color),
strokeColor : normal.borderColor || normal.color || color,
: (self.getItemStyleColor(normal.color, seriesIndex, dataIndex, data)
|| color),
strokeColor : normal.borderColor
|| self.getItemStyleColor(normal.color, seriesIndex, dataIndex, data)
|| color,
lineWidth: nBorderWidth
},
highlightStyle : {
color : symbol.match('empty')
? emptyColor
: (emphasis.color|| normal.color || color),
strokeColor : emphasis.borderColor || normal.borderColor
|| emphasis.color || normal.color || color,
: self.getItemStyleColor(emphasis.color, seriesIndex, dataIndex, data),
strokeColor : emphasis.borderColor
|| normal.borderColor
|| self.getItemStyleColor(normal.color, seriesIndex, dataIndex, data)
|| color,
lineWidth: eBorderWidth
},
clickable : true
......@@ -731,7 +738,9 @@ define(function(require) {
function getLineMarkShape(
mlOption, // 系列
seriesIndex, // 系列索引
data, // 数据
dataIndex, // 数据索引
xStart, yStart, // 坐标
xEnd, yEnd, // 坐标
color // 默认color,来自legend或dataRange全局分配
......@@ -771,10 +780,12 @@ define(function(require) {
queryTarget,
'itemStyle.normal'
);
normal.color = self.getItemStyleColor(normal.color, seriesIndex, dataIndex, data);
var emphasis = self.deepMerge(
queryTarget,
'itemStyle.emphasis'
);
emphasis.color = self.getItemStyleColor(emphasis.color, seriesIndex, dataIndex, data);
var nlineStyle = normal.lineStyle;
var elineStyle = emphasis.lineStyle;
......@@ -814,12 +825,12 @@ define(function(require) {
color : normal.color || color,
strokeColor : nlineStyle.color
|| normal.borderColor
|| color
|| normal.color,
|| normal.color
|| color,
lineWidth: nBorderWidth,
symbolBorderColor: normal.borderColor
|| color
|| normal.color,
|| normal.color
|| color,
symbolBorder: normal.borderWidth
},
highlightStyle : {
......@@ -832,15 +843,15 @@ define(function(require) {
|| nlineStyle.color
|| emphasis.borderColor
|| normal.borderColor
|| color
|| emphasis.color
|| normal.color,
|| normal.color
|| color,
lineWidth: eBorderWidth,
symbolBorderColor: emphasis.borderColor
|| normal.borderColor
|| color
|| emphasis.color
|| normal.color,
|| normal.color
|| color,
symbolBorder: typeof emphasis.borderWidth == 'undefined'
? (normal.borderWidth + 2)
: (emphasis.borderWidth)
......@@ -912,6 +923,13 @@ define(function(require) {
+ (x.length > 1 ? ('.' + x[1]) : '');
}
function getItemStyleColor(itemColor, seriesIndex, dataIndex, data) {
return typeof itemColor == 'function'
? itemColor(seriesIndex, dataIndex, data) : itemColor;
}
function _trim(str) {
return str.replace(/^\s\s*/, '').replace(/\s\s*$/, '');
}
......@@ -1262,6 +1280,7 @@ define(function(require) {
self.parseCenter = parseCenter;
self.parseRadius = parseRadius;
self.numAddCommas = numAddCommas;
self.getItemStyleColor = getItemStyleColor;
self.subPixelOptimize = subPixelOptimize;
self.animation = animation;
self.animationMark = animationMark;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册