提交 5b791d7c 编写于 作者: L lang

MarkPoint symbolSize support function

上级 3f30e90d
...@@ -92,22 +92,37 @@ define(function(require) { ...@@ -92,22 +92,37 @@ define(function(require) {
function createGridClipShape(cartesian, hasAnimation, seriesModel) { function createGridClipShape(cartesian, hasAnimation, seriesModel) {
var xExtent = getAxisExtentWithGap(cartesian.getAxis('x')); var xExtent = getAxisExtentWithGap(cartesian.getAxis('x'));
var yExtent = getAxisExtentWithGap(cartesian.getAxis('y')); var yExtent = getAxisExtentWithGap(cartesian.getAxis('y'));
var isHorizontal = cartesian.getBaseAxis().isHorizontal();
var x = xExtent[0];
var y = yExtent[0];
var width = xExtent[1] - x;
var height = yExtent[1] - y;
// Expand clip shape to avoid line value exceeds axis
if (isHorizontal) {
height *= 10;
y -= height / 2;
}
else {
width *= 10;
x -= width / 2;
}
isHorizontal ? (height *= 10) : (width *= 10);
var clipPath = new graphic.Rect({ var clipPath = new graphic.Rect({
shape: { shape: {
x: xExtent[0], x: x,
y: yExtent[0], y: y,
width: xExtent[1] - xExtent[0], width: width,
height: yExtent[1] - yExtent[0] height: height
} }
}); });
if (hasAnimation) { if (hasAnimation) {
clipPath.shape[cartesian.getBaseAxis().isHorizontal() ? 'width' : 'height'] = 0; clipPath.shape[isHorizontal ? 'width' : 'height'] = 0;
graphic.initProps(clipPath, { graphic.initProps(clipPath, {
shape: { shape: {
width: xExtent[1] - xExtent[0], width: width,
height: yExtent[1] - yExtent[0] height: height
} }
}, seriesModel); }, seriesModel);
} }
......
...@@ -104,8 +104,15 @@ define(function (require) { ...@@ -104,8 +104,15 @@ define(function (require) {
mpData.setItemLayout(idx, point); mpData.setItemLayout(idx, point);
var symbolSize = itemModel.getShallow('symbolSize');
if (typeof symbolSize === 'function') {
// FIXME 这里不兼容 ECharts 2.x,2.x 貌似参数是整个数据?
symbolSize = symbolSize(
mpModel.getRawValue(idx), mpModel.getDataParams(idx)
);
}
mpData.setItemVisual(idx, { mpData.setItemVisual(idx, {
symbolSize: itemModel.getShallow('symbolSize'), symbolSize: symbolSize,
color: itemModel.get('itemStyle.normal.color') color: itemModel.get('itemStyle.normal.color')
|| seriesData.getVisual('color'), || seriesData.getVisual('color'),
symbol: itemModel.getShallow('symbol') symbol: itemModel.getShallow('symbol')
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册