index.js 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. import { __extends } from "tslib";
  2. import { Plot } from '../../core/plot';
  3. import { binHistogram } from '../../utils/transform/histogram';
  4. import { adaptor } from './adaptor';
  5. import { DEFAULT_OPTIONS } from './constant';
  6. var Histogram = /** @class */ (function (_super) {
  7. __extends(Histogram, _super);
  8. function Histogram() {
  9. var _this = _super !== null && _super.apply(this, arguments) || this;
  10. /** 图表类型 */
  11. _this.type = 'histogram';
  12. return _this;
  13. }
  14. /**
  15. * 获取 默认配置项
  16. * 供外部使用
  17. */
  18. Histogram.getDefaultOptions = function () {
  19. return DEFAULT_OPTIONS;
  20. };
  21. Histogram.prototype.changeData = function (data) {
  22. this.updateOption({ data: data });
  23. var _a = this.options, binField = _a.binField, binNumber = _a.binNumber, binWidth = _a.binWidth, stackField = _a.stackField;
  24. this.chart.changeData(binHistogram(data, binField, binWidth, binNumber, stackField));
  25. };
  26. /**
  27. * 获取直方图的适配器
  28. */
  29. Histogram.prototype.getDefaultOptions = function () {
  30. return Histogram.getDefaultOptions();
  31. };
  32. /**
  33. * 获取直方图的适配器
  34. */
  35. Histogram.prototype.getSchemaAdaptor = function () {
  36. return adaptor;
  37. };
  38. return Histogram;
  39. }(Plot));
  40. export { Histogram };
  41. //# sourceMappingURL=index.js.map