VSeed, an elegant data composer, transforming complexity into simplicity.
!!!###!!!title=getFieldInfo——VisActor/VMind api documents!!!###!!!
getFieldInfo
Interface Description
The getFieldInfo interface is used to parse JSON-structured data to obtain field information (fieldInfo). FieldInfo includes field name, type, value range, and other information, and its structure is as follows:
exportinterface FieldInfo = {
/** name of field */fieldName: string;
/** field type, eg: time / category / numerical */type: DataType;
/** field role */ role: ROLE;
/** alias of field */ alias?: string;
/** description of field */ description?: string;
};
exportenum DataType {
DATE = 'date',
TIME = 'time',
STRING = 'string',
REGION = 'region',
NUMERICAL = 'numerical',
RATIO = 'ratio',
COUNT = 'count',
FLOAT = 'float',
INT = 'int'}
exportenum ROLE {
DIMENSION = 'dimension',
MEASURE = 'measure'}
Interface Parameters
getFieldInfo(dataset: Record<string, number | string>[]): FieldInfo[]
dataset: JSON-formatted data set, an array, each element of which is an object, with the key being the field name and the value being the corresponding data.
Return Value Type
Returns an array of fieldInfo, representing the parsed field information. Each element is an object that contains the following attributes:
- fieldName: string type, representing the field name.
- description: string type, representing the field description, optional.
- type: DataType type, representing the field type, can be "string", "int", "float", "date".
- role: ROLE type, representing the field role, can be "dimension", "measure".