@antv/g2plot
Version:
G2 Plot, a market of plots built with the Grammar of Graphics'
43 lines (42 loc) • 968 B
TypeScript
import { BBox, Canvas, Group, Text } from '@antv/g';
import ViewLayer from '../base/view-layer';
interface TextConfig {
leftMargin: number;
topMargin: number;
text: string;
style: any;
wrapperWidth: number;
container: Canvas | Group;
theme: any;
index: number;
plot: ViewLayer;
name: string;
}
/**
* 图表的文字描述,一般用于生成图表的标题和副标题
*/
export default class TextDescription {
shape: Text;
position: string;
name: string;
destroyed: boolean;
private container;
private topMargin;
private leftMargin;
private wrapperWidth;
private text;
private style;
private index;
private plot;
constructor(cfg: TextConfig);
getBBox(): BBox | null;
clear(): void;
destroy(): void;
private _init;
/**
* 当text过长时,默认换行
* 1. 注意初始text带换行符的场景
*/
private _textWrapper;
}
export {};