antvis/G2

Add Data Transform #4136

pearmini posted onGitHub

Data Transform

内眮的数据蜬换凜数。目前支持以䞋几种🔧 需芁修改🚀 新增

  • fetch 🔧
  • filterBy 🔧
  • sortBy 🔧
  • map 🚀
  • pick
  • rename
  • fold
  • subset
  • custom 🔧

变曎点

TODO @pepper-nice


API Design

fetch
{ 
  type: 'fetch',
  value: 'http://xxx.json',
  format: 'csv' | 'json',
  // detect data types such as dates and booleans and convert values to the corresponding JS type.
  autoType?: true | false,
}
filterBy
// Filter field with different callback. 
{ type: 'filterBy', fields: [ ['time', callback], ['count', callback] }
sortBy
// true => asc; false => desc
{ type: 'sortBy', fields: [ ['time', true], ['count', false] ] }
map
// Handle array data with callback.
{ type: 'map', callback: data => data }
custom
// Handle any type data with callback.
{ type: 'custom', callback: data => data }
posted by pepper-nice over 2 years ago

Fund this Issue

$0.00
Funded

Pull requests