@antv/attr

  • Version 0.3.5
  • Published
  • 58.4 kB
  • 4 dependencies
  • MIT license

Install

npm i @antv/attr
yarn add @antv/attr
pnpm add @antv/attr

Overview

The Attribute module for G2, F2.

Index

Functions

function getAttribute

getAttribute: (type: string) => any;
  • 通过类型获得 Attribute 类

    Parameter type

function registerAttribute

registerAttribute: (type: string, ctor: AttributeConstructor) => void;

    Classes

    class Attribute

    class Attribute {}
    • 所有视觉通道属性的基类 Base

    constructor

    constructor(cfg: AttributeCfg);

      property callback

      callback: CallbackType;

        property linear

        linear: boolean;

          property names

          names: string[];

            property scales

            scales: Scale[];

              property type

              type: string;

                property values

                values: any[];

                  method getFields

                  getFields: () => string[];
                  • 获取所有的维度名

                  method getLinearValue

                  getLinearValue: (percent: number) => number | string;
                  • 如果进行线性映射,返回对应的映射值

                    Parameter percent

                  method getNames

                  getNames: () => any[];
                  • 根据度量获取属性名

                  method getScale

                  getScale: (name: string) => Scale;
                  • 根据名称获取度量

                    Parameter name

                  method mapping

                  mapping: (...params: any[]) => any[];
                  • 映射的值组成的数组

                    Parameter params

                    对应 scale 顺序的值传入

                  class Color

                  class Color extends Attribute {}

                    constructor

                    constructor(cfg: AttributeCfg);

                      property gradient

                      gradient: (percent: number) => string;

                        method getLinearValue

                        getLinearValue: (percent: number) => string;
                        • Modifiers

                          • @override

                        class Opacity

                        class Opacity extends Attribute {}

                          constructor

                          constructor(cfg: AttributeCfg);

                            class Position

                            class Position extends Attribute {}

                              constructor

                              constructor(cfg: AttributeCfg);

                                method mapping

                                mapping: (x: MappingValue, y: MappingValue) => (number | number[])[];

                                  class Shape

                                  class Shape extends Attribute {}

                                    constructor

                                    constructor(cfg: AttributeCfg);

                                      method getLinearValue

                                      getLinearValue: (percent: number) => string;
                                      • Modifiers

                                        • @override

                                      class Size

                                      class Size extends Attribute {}

                                        constructor

                                        constructor(cfg: AttributeCfg);

                                          Interfaces

                                          interface AttributeCfg

                                          interface AttributeCfg {}

                                            property callback

                                            readonly callback?: CallbackType;

                                              property names

                                              readonly names?: string[];

                                                property scales

                                                readonly scales: Scale[];

                                                  property type

                                                  readonly type?: string;

                                                    property values

                                                    readonly values?: any;

                                                      Type Aliases

                                                      type CallbackType

                                                      type CallbackType = (...args: any[]) => any[];

                                                        Package Files (9)

                                                        Dependencies (4)

                                                        Dev Dependencies (15)

                                                        Peer Dependencies (0)

                                                        No peer dependencies.

                                                        Badge

                                                        To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

                                                        You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/@antv/attr.

                                                        • Markdown
                                                          [![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/@antv/attr)
                                                        • HTML
                                                          <a href="https://www.jsdocs.io/package/@antv/attr"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>