labelTransform.d.ts 917 B

123456789101112131415161718192021222324252627282930
  1. import { DisplayObject } from '@antv/g';
  2. export type LabelTransform = OverlapHideLabelTransform | OverlapDodgeYLabelTransform | ContrastReverseLabelTransform | OverflowHideLabelTransform;
  3. export type OverlapHideLabelTransform = {
  4. type?: 'overlapHide';
  5. /**
  6. * The hide priority, is the comparator for label.sort().
  7. */
  8. priority?: (a: DisplayObject, b: DisplayObject) => number;
  9. };
  10. export type OverlapDodgeYLabelTransform = {
  11. type?: 'overlapDodgeY';
  12. maxIterations?: number;
  13. maxError?: number;
  14. padding?: number;
  15. };
  16. export type ContrastReverseLabelTransform = {
  17. type: 'contrastReverse';
  18. /**
  19. * Transform when the contrast ratio < threshold.
  20. * Default is `4.5`.
  21. */
  22. threshold?: number;
  23. /**
  24. * The optional color palette, default is [#000, #fff].
  25. */
  26. palette?: string[];
  27. };
  28. export type OverflowHideLabelTransform = {
  29. type: 'overflowHide';
  30. };