utils.d.ts 1.2 KB

12345678910111213141516171819202122232425262728293031323334
  1. import { Types } from '@antv/g2';
  2. import { Params } from '../../core/adaptor';
  3. import { Datum } from '../../types';
  4. import { Tag, Word, WordCloudOptions, WordStyle } from './types';
  5. /**
  6. * 用 DataSet 转换词云图数据
  7. * @param params
  8. */
  9. export declare function transform(params: Params<WordCloudOptions>): Tag[];
  10. /**
  11. * 获取最终的实际绘图尺寸:[width, height]
  12. * @param chart
  13. */
  14. export declare function getSize(options: {
  15. width: number;
  16. height: number;
  17. padding: Types.ViewPadding;
  18. appendPadding: Types.ViewAppendPadding;
  19. autoFit: boolean;
  20. container: HTMLElement;
  21. }): [number, number];
  22. /**
  23. * 处理 imageMask 可能为 url 字符串的情况
  24. * @param {HTMLImageElement | string} img
  25. * @return {Promise}
  26. */
  27. export declare function processImageMask(img: HTMLImageElement | string): Promise<HTMLImageElement>;
  28. /**
  29. * 把用户提供的 fontSize 值转换成符合 DataSet 要求的值
  30. * @param options
  31. * @param range
  32. */
  33. export declare function getFontSizeMapping(fontSize: WordStyle['fontSize'], range?: [number, number]): (word: Word, index?: number, words?: Word[]) => number;
  34. export declare function getSingleKeyValues(data: Datum[], key: string): any[];