"use strict"; var Shape = require('./shape'); var Util = require('../../util/common'); var Polygon = Shape.registerFactory('polygon', { defaultShapeType: 'polygon', getDefaultPoints: function getDefaultPoints(pointInfo) { var points = []; var x = pointInfo.x, y = pointInfo.y; for (var i = 0, len = x.length; i < len; i++) { points.push({ x: x[i], y: y[i] }); } return points; } }); Shape.registerShape('polygon', 'polygon', { draw: function draw(cfg, container) { var points = this.parsePoints(cfg.points); var style = Util.mix({ fill: cfg.color, points: points }, cfg.style); return container.addShape('Polygon', { className: 'polygon', attrs: style }); } }); module.exports = Polygon;