index.js 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. import { __extends } from "tslib";
  2. import { Plot } from '../core/plot';
  3. import { deepAssign } from '../utils';
  4. /**
  5. * 给 G2Plot 提供非常简单的开放开发的机制。目的是能够让社区和业务上自己基于 G2Plot 开发自己的定制图表库。主要分成几类图表:
  6. * 1. 领域专业的图表,内部同学因为没有场景,不一定能做的完善。
  7. * 2. 定制业务的图表,不具备通用性
  8. * 3. 趣味性的可视化组件
  9. * 然后官方可以根据社区的情况,可以进行一些官方推荐和采纳。
  10. *
  11. * 如果使用?
  12. *
  13. * ```ts
  14. * import { P } from '@antv/g2plot';
  15. * import { GeoWorldMap, GeoWorldMapOptions } from 'g2plot-geo-world-map';
  16. *
  17. * const plot = new P('container', {
  18. * geoJson: '',
  19. * longitude: '',
  20. * latitude: '',
  21. * }, GeoWorldMap, defaultOptions);
  22. *
  23. * plot.render();
  24. * ```
  25. */
  26. var P = /** @class */ (function (_super) {
  27. __extends(P, _super);
  28. /**
  29. * 相比普通图表增加 adaptor 参数。
  30. * @param container
  31. * @param options
  32. * @param adaptor
  33. * @param defaultOptions
  34. */
  35. function P(container, options, adaptor, defaultOptions) {
  36. var _this = _super.call(this, container, deepAssign({}, defaultOptions, options)) || this;
  37. /** 统一为 any plot */
  38. _this.type = 'g2-plot';
  39. _this.defaultOptions = defaultOptions;
  40. _this.adaptor = adaptor;
  41. return _this;
  42. }
  43. /**
  44. * 实现父类方法,直接使用传入的
  45. */
  46. P.prototype.getDefaultOptions = function () {
  47. return this.defaultOptions;
  48. };
  49. /**
  50. * 实现父类方法,直接使用传入的
  51. */
  52. P.prototype.getSchemaAdaptor = function () {
  53. return this.adaptor;
  54. };
  55. return P;
  56. }(Plot));
  57. export { P };
  58. //# sourceMappingURL=index.js.map