point.js 749 B

1234567891011121314151617181920212223242526272829303132333435
  1. import { mix } from '../../util/common';
  2. import GuideBase from './base';
  3. class Point extends GuideBase {
  4. _initDefaultCfg() {
  5. this.type = 'point';
  6. this.position = null;
  7. this.offsetX = 0;
  8. this.offsetY = 0;
  9. this.style = {
  10. fill: '#1890FF',
  11. r: 3,
  12. lineWidth: 1,
  13. stroke: '#fff'
  14. };
  15. }
  16. render(coord, container) {
  17. var position = this.parsePoint(coord, this.position);
  18. if (!position) return null;
  19. var shape = container.addShape('Circle', {
  20. className: 'guide-point',
  21. attrs: mix({
  22. x: position.x + this.offsetX,
  23. y: position.y + this.offsetY
  24. }, this.style)
  25. });
  26. this.element = shape;
  27. return shape;
  28. }
  29. }
  30. GuideBase.Point = Point;
  31. export default Point;