point.js 927 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. import { each, isArray, isNil } from '../util/common';
  2. import Geom from './base';
  3. import './shape/point';
  4. class Point extends Geom {
  5. getDefaultCfg() {
  6. var cfg = super.getDefaultCfg();
  7. cfg.type = 'point';
  8. cfg.shapeType = 'point';
  9. cfg.generatePoints = false;
  10. return cfg;
  11. }
  12. draw(data, shapeFactory) {
  13. var self = this;
  14. var container = self.get('container');
  15. each(data, function (obj) {
  16. var shape = obj.shape;
  17. var cfg = self.getDrawCfg(obj);
  18. if (isArray(obj.y)) {
  19. var hasStack = self.hasAdjust('stack');
  20. each(obj.y, function (y, idx) {
  21. cfg.y = y;
  22. if (!hasStack || idx !== 0) {
  23. self.drawShape(shape, obj, cfg, container, shapeFactory);
  24. }
  25. });
  26. } else if (!isNil(obj.y)) {
  27. self.drawShape(shape, obj, cfg, container, shapeFactory);
  28. }
  29. });
  30. }
  31. }
  32. Geom.Point = Point;
  33. export default Point;