提交 e12e9912 编写于 作者: S sushuang

Fix radar line disappear on hover when there is empty value in data.

上级 e2936025
......@@ -103,6 +103,7 @@ export default echarts.extendChartView({
points: points
}
};
polygon.shape.points = getInitialPoints(points);
polyline.shape.points = getInitialPoints(points);
graphic.initProps(polygon, target, seriesModel, idx);
......@@ -130,6 +131,7 @@ export default echarts.extendChartView({
points: data.getItemLayout(newIdx)
}
};
if (!target.shape.points) {
return;
}
......@@ -193,6 +195,8 @@ export default echarts.extendChartView({
symbolGroup.eachChild(function (symbolPath) {
symbolPath.setStyle(itemStyle);
symbolPath.hoverStyle = zrUtil.clone(itemHoverStyle);
var defaultText = data.get(data.dimensions[symbolPath.__dimIdx], idx);
(defaultText == null || isNaN(defaultText)) && (defaultText = '');
graphic.setLabelStyle(
symbolPath.style, symbolPath.hoverStyle, labelModel, labelHoverModel,
......@@ -200,7 +204,7 @@ export default echarts.extendChartView({
labelFetcher: data.hostModel,
labelDataIndex: idx,
labelDimIndex: symbolPath.__dimIdx,
defaultText: data.get(data.dimensions[symbolPath.__dimIdx], idx),
defaultText: defaultText,
autoColor: color,
isRectText: true
}
......
......@@ -33,7 +33,9 @@ export default function (ecModel) {
zrUtil.each(axes, function (axis, axisIndex) {
data.each(data.mapDimension(axes[axisIndex].dim), function (val, dataIndex) {
points[dataIndex] = points[dataIndex] || [];
points[dataIndex][axisIndex] = coordSys.dataToPoint(val, axisIndex);
var point = coordSys.dataToPoint(val, axisIndex);
points[dataIndex][axisIndex] = isValidPoint(point)
? point : getValueMissingPoint(coordSys);
});
});
......@@ -43,12 +45,22 @@ export default function (ecModel) {
// Is it appropriate to connect to the next data when some data is missing?
// Or, should trade it like `connectNull` in line chart?
var firstPoint = zrUtil.find(points[idx], function (point) {
return !isNaN(point[0]) && !isNaN(point[1]);
}) || [NaN, NaN];
return isValidPoint(point);
}) || getValueMissingPoint(coordSys);
// Copy the first actual point to the end of the array
points[idx].push(firstPoint.slice());
data.setItemLayout(idx, points[idx]);
});
});
}
function isValidPoint(point) {
return !isNaN(point[0]) && !isNaN(point[1]);
}
function getValueMissingPoint(coordSys) {
// It is error-prone to input [NaN, NaN] into polygon, polygon.
// (probably cause problem when refreshing or animating)
return [coordSys.cx, coordSys.cy];
}
\ No newline at end of file
......@@ -49,7 +49,7 @@ under the License.
},
tooltip: {},
legend: {
data: ['预算分配(Allocated Budget)', '实际开销(Actual Spending)', '第一个元素是 null']
data: ['预算分配(Allocated Budget)', '实际开销(Actual Spending)含有 "-" 数据', '第一个元素是 null']
},
radar: {
radius: [50, '70%'],
......@@ -84,7 +84,7 @@ under the License.
},
{
value : [50, 14000, 28000, 31000, '-', 21000],
name : '实际开销(Actual Spending)'
name : '实际开销(Actual Spending)含有 "-" 数据'
},
{
value: ['-', 8000, 20000, 20000, 40000, 10000],
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册