| 12345678910111213141516171819202122232425262728293031323334353637383940 |
- import { mix } from '../../util/common';
- import GuideBase from './base';
- class Line extends GuideBase {
- _initDefaultCfg() {
- this.type = 'line';
- this.start = [];
- this.end = [];
- this.style = {
- stroke: '#000',
- lineWidth: 1
- };
- }
- render(coord, container) {
- var points = [];
- points[0] = this.parsePoint(coord, this.start);
- points[1] = this.parsePoint(coord, this.end);
- if (!points[0] || !points[1]) {
- return;
- }
- var shape = container.addShape('Line', {
- className: 'guide-line',
- attrs: mix({
- x1: points[0].x,
- y1: points[0].y,
- x2: points[1].x,
- y2: points[1].y
- }, this.style)
- });
- this.element = shape;
- return shape;
- }
- }
- GuideBase.Line = Line;
- export default Line;
|