How to use the @antv/g2.getElementLabels function in @antv/g2

To help you get started, we’ve selected a few @antv/g2 examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github antvis / G2Plot / __tests__ / unit / pie-label-spec.ts View on Github external
it('get outer-label', () => {
    expect(getElementLabels('outer')).toBeDefined();
  });
github antvis / G2Plot / src / plots / pie / component / label / upgrade-label / index.ts View on Github external
import { getElementLabels, registerElementLabels } from '@antv/g2';
import { Shape, BBox, Marker } from '@antv/g';
import Polar from '@antv/coord/lib/coord/polar';
import _ from 'lodash';
import { getEndPoint, getQuadrantByAngle, getOverlapArea, inPanel, getCenter } from '../utils';
import { LabelItem as BaseLabelItem } from '@antv/component/lib/interface';

const PieElementLabels = getElementLabels('pie');

/** upgrade-pie label config */
interface LabelItem extends BaseLabelItem {
  offset?: number;
  labelLine?: {
    smooth?: boolean;
  };
}
/** 默认label和element的偏移 16px */
const DEFAULT_OFFSET = 16;
const DEFAULT_TEXT_LINE_OFFSET = 4;
const MaxOverlapArea = 28;

type C = {
  rx: number;
  ry: number;