@antv/f2
Version:
Charts for mobile visualization.
31 lines • 958 B
JavaScript
import { __spreadArray } from "tslib";
import { jsx } from '@antv/f-engine';
export default (function (props) {
var elements = props.elements;
return jsx("group", null, elements.map(function (d) {
var highlightsData = d.highlightsData,
color = d.color;
var topPoints = [];
var bottomPoints = [];
highlightsData.forEach(function (item) {
var xMin = item.xMin,
xMax = item.xMax,
yMin = item.yMin,
yMax = item.yMax;
topPoints.push([xMin, yMin]);
topPoints.push([xMax, yMin]);
bottomPoints.push([xMin, yMax]);
bottomPoints.push([xMax, yMax]);
});
// 将上边的点和下边的点连接起来,形成一个多边形
var points = __spreadArray(__spreadArray([], topPoints, true), bottomPoints.reverse(), true);
return jsx("polygon", {
style: {
points: points,
fill: color,
stroke: 'none',
opacity: 0.4
}
});
}));
});