utils.d.ts 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. import { Band } from '@antv/scale';
  2. import { Primitive } from 'd3-array';
  3. import { Vector2 } from '@antv/coord';
  4. import { Scale } from '../runtime/types/component';
  5. import { Channel } from '../runtime';
  6. export type ChannelOptions = {
  7. shapes?: string[];
  8. };
  9. export declare function baseChannels(options?: ChannelOptions): Channel[];
  10. export declare function baseGeometryChannels(options?: ChannelOptions): Channel[];
  11. export declare function tooltip2d(): ({
  12. type: string;
  13. channel: string;
  14. } | {
  15. type: string;
  16. channel: string[];
  17. })[];
  18. export declare function tooltip1d(): ({
  19. type: string;
  20. channel: string;
  21. } | {
  22. type: string;
  23. channel: string[];
  24. })[];
  25. export declare function tooltipXd(): ({
  26. type: string;
  27. channel: string;
  28. } | {
  29. type: string;
  30. channel: string[];
  31. })[];
  32. export declare function baseAnnotationChannels(options?: ChannelOptions): Channel[];
  33. export declare function basePreInference(): {
  34. type: string;
  35. }[];
  36. export declare function basePostInference(): any[];
  37. export declare function bandWidth(scale: Band, x: any): number;
  38. export declare function createBandOffset(scale: Record<string, Scale>, value: Record<string, Primitive[]>, options?: Record<string, any>): (d: [number, number], i?: number) => [number, number];
  39. export declare function p(d: any): number;
  40. export declare function visualMark(index: number[], scale: any, value: any, coordinate: any): (number[] | Vector2[][])[];
  41. type Encode = 'string' | ((d: any) => any);
  42. export declare function field(encode: Encode): (d: any) => any;
  43. export declare function valueof(data: Record<string, any>[], encode: Encode): any[];
  44. export declare function initializeData(data: {
  45. nodes?: any[];
  46. links: any[];
  47. }, encode: Record<string, Encode>): {
  48. links: {
  49. target: string;
  50. source: string;
  51. value: any;
  52. }[];
  53. nodes: {
  54. key: string;
  55. }[];
  56. };
  57. /**
  58. * @description Path need when the data is a flat json structure,
  59. * and the tree object structure do not need.
  60. */
  61. export declare function generateHierarchyRoot(data: any[] | Record<string, any>, path: (d: any) => any): any;
  62. export {};