!!!###!!!title=Component——VisActor/VGrammar 接口文档!!!###!!!!!!###!!!description=图形语法元素 - 组件。继承`Mark`,所有`Mark`支持的 API,都能在`Component`实例上调用!!!###!!!

Component

图形语法元素 - 组件。

继承Mark,所有Mark支持的 API,都能在Component实例上调用

实例属性

componentType

类型:string

组件的类型

实例方法

configureComponent

配置组件

(config: any) => this;

scale

设置组件的比例尺,目前有三种类型的组件是可以设置scale的:

  • Axis
  • Crosshair
  • Legend
(scale?: IScale | string) => this;

axisType(string)

设置Axis组件的坐标轴类型

(axisType: AxisType | Nil) => this;

tickCount

设置Axis组件的刻度数量

(tickCount: MarkFunctionType<number> | Nil) => this;

legendType(string)

设置Legend组件的图例类型

(legendType: LegendType | Nil) => this;

target

设置组件的目标数据

(data: IData | string | Nil, filter: string | ((datum: any, legendValues: any) => boolean) | Nil) => this;

setSelected

设置Legend组件的选中值

(selectedValues: any[]) => this;

crosshairType(string)

设置Crosshair组件的类型

(crosshairType: CrosshairType | Nil) => this;

crosshairShape(string)

设置Crosshair组件的形状

(crosshairShape: CrosshairShape | Nil) => this;

min

设置Slider组件的最小值

(min: MarkFunctionType<number> | Nil) => this;

max

设置Slider组件的最大值

(max: MarkFunctionType<number> | Nil) => this;

setStartEndValue

设置Slider组件的起始值和结束值

(start?: number, end?: number) => this;

preview

设置Datazoom组件的预览值

(
  data: IData | string | Nil,
  x: ScaleEncodeType | Nil,
  y: ScaleEncodeType | Nil,
  x1?: ChannelEncodeType | Nil,
  y1?: ChannelEncodeType | Nil
) => this;

labelStyle

设置Label组件的标签样式

(attributes: MarkFunctionType<RecursivePartial<BaseLabelAttrs>>) => this;

size

设置Label组件的大小

(attributes: MarkFunctionType<DataLabelAttrs['size']>) => this;

playerType(string)

设置Player组件的播放器类型

(playerType: PlayerType) => this;

play

播放Player组件

pause

暂停Player组件

backward

组件Player回退

forward

组件Player前进

title

设置Tooltip组件的标题

(title: ITooltipRow | Nil) => this;

content

设置Tooltip组件的内容

(content: ITooltipRow | ITooltipRow[] | Nil) => this;