@antv/f2
Version:
Charts for mobile visualization.
37 lines (36 loc) • 1.14 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _tslib = require("tslib");
var _fEngine = require("@antv/f-engine");
var _default = exports.default = function _default(props) {
var elements = props.elements;
return (0, _fEngine.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 = (0, _tslib.__spreadArray)((0, _tslib.__spreadArray)([], topPoints, true), bottomPoints.reverse(), true);
return (0, _fEngine.jsx)("polygon", {
style: {
points: points,
fill: color,
stroke: 'none',
opacity: 0.4
}
});
}));
};