index.js 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. import { __extends } from "tslib";
  2. import { Event, VIEW_LIFE_CIRCLE } from '@antv/g2';
  3. import { Plot } from '../../core/plot';
  4. import { adaptor, statistic } from './adaptor';
  5. import { DEFAULT_OPTIONS } from './constants';
  6. // register liquid shape
  7. import './shapes/liquid';
  8. import { getLiquidData } from './utils';
  9. export { addWaterWave } from './shapes/liquid';
  10. /**
  11. * 传说中的水波图
  12. */
  13. var Liquid = /** @class */ (function (_super) {
  14. __extends(Liquid, _super);
  15. function Liquid() {
  16. var _this = _super !== null && _super.apply(this, arguments) || this;
  17. /** 图表类型 */
  18. _this.type = 'liquid';
  19. return _this;
  20. }
  21. /**
  22. * 获取 饼图 默认配置项
  23. * 供外部使用
  24. */
  25. Liquid.getDefaultOptions = function () {
  26. return DEFAULT_OPTIONS;
  27. };
  28. /**
  29. * 获取 水波图 默认配置项, 供 base 获取
  30. */
  31. Liquid.prototype.getDefaultOptions = function () {
  32. return Liquid.getDefaultOptions();
  33. };
  34. /**
  35. * 更新数据
  36. * @param percent
  37. */
  38. Liquid.prototype.changeData = function (percent) {
  39. this.chart.emit(VIEW_LIFE_CIRCLE.BEFORE_CHANGE_DATA, Event.fromData(this.chart, VIEW_LIFE_CIRCLE.BEFORE_CHANGE_DATA, null));
  40. this.updateOption({ percent: percent });
  41. this.chart.data(getLiquidData(percent));
  42. statistic({ chart: this.chart, options: this.options }, true);
  43. this.chart.emit(VIEW_LIFE_CIRCLE.AFTER_CHANGE_DATA, Event.fromData(this.chart, VIEW_LIFE_CIRCLE.AFTER_CHANGE_DATA, null));
  44. };
  45. /**
  46. * 获取适配器
  47. */
  48. Liquid.prototype.getSchemaAdaptor = function () {
  49. return adaptor;
  50. };
  51. return Liquid;
  52. }(Plot));
  53. export { Liquid };
  54. //# sourceMappingURL=index.js.map