Skip to content

fold

Unfold multiple fields into a specified key-value organization format.

Getting Started

const data = [
  { a: 1, b: 2, c: 3 },
  { a: 4, b: 5, c: 6 },
];

chart.options({
  type: 'view',
  data: {
    type: 'inline',
    value: data,
    transform: [
      {
        type: 'fold',
        fields: ['a', 'b'],
        key: 'key',
        value: 'value',
      },
    ],
  },
});

After the above example is processed, the data becomes:

[
  { a: 1, b: 2, c: 3, key: 'a', value: 1 },
  { a: 1, b: 2, c: 3, key: 'b', value: 2 },
  { a: 4, b: 5, c: 6, key: 'a', value: 4 },
  { a: 4, b: 5, c: 6, key: 'b', value: 5 },
];

Options

Property Description Type Default
fields List of fields to be unfolded string[]
key Field name for the enumeration values after unfolding string key
value Field name for the data values after unfolding string value
© Copyright 2026 Ant Group Co., Ltd..备案号:京ICP备15032932号-38
Site search
Documentation and examplesType to start searching

Search documentation, APIs, and examples

↑↓Select↵OpenEscClose