util.d.ts 1.1 KB

123456789101112131415161718192021222324252627282930313233343536
  1. import { View } from '@antv/g2';
  2. import { ScatterOptions } from './types';
  3. type RenderOptions = {
  4. view: View;
  5. options: ScatterOptions;
  6. };
  7. type D3RegressionResult = {
  8. a?: number;
  9. b?: number;
  10. c?: number;
  11. coefficients?: number[];
  12. rSquared?: number;
  13. };
  14. /**
  15. * 获取四象限默认配置
  16. * @param {number} xBaseline
  17. * @param {number} yBaseline
  18. */
  19. export declare function getQuadrantDefaultConfig(xBaseline: number, yBaseline: number): {
  20. [key: string]: any;
  21. };
  22. export declare const getPath: (config: RenderOptions) => any[];
  23. /**
  24. * 调整散点图 meta: { min, max } ① data.length === 1 ② 所有数据 y 值相等 ③ 所有数据 x 值相等
  25. * @param options
  26. * @returns
  27. */
  28. export declare const getMeta: (options: Pick<ScatterOptions, 'meta' | 'xField' | 'yField' | 'data'>) => ScatterOptions['meta'];
  29. /**
  30. * 获取回归函数表达式
  31. * @param {string} type - 回归函数类型
  32. * @param {D3RegressionResult} res - 回归计算结果集
  33. * @return {string}
  34. */
  35. export declare function getRegressionEquation(type: string, res: D3RegressionResult): string;
  36. export {};