{"size": 563, "ext": "js", "max_stars_repo_path": "panel/src/utils/chartFormatUtils/bar/bar-basic.js", "max_stars_repo_name": "greentown-ideallife/Charts-Tool", "max_stars_repo_stars_event_min_datetime": "2019-05-09T11:46:21.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-21T04:37:23.000Z", "max_issues_repo_path": "panel/src/utils/chartFormatUtils/bar/bar-basic.js", "max_issues_repo_name": "daughterRui/Charts-Tool", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "panel/src/utils/chartFormatUtils/bar/bar-basic.js", "max_forks_repo_name": "daughterRui/Charts-Tool", "max_forks_repo_forks_event_min_datetime": "2019-08-17T03:12:40.000Z", "max_forks_repo_forks_event_max_datetime": "2021-06-29T09:12:51.000Z"}
{"max_stars_count": 36, "max_issues_count": null, "max_forks_count": 3, "avg_line_length": 24.4782608696, "max_line_length": 66, "alphanum_fraction": 0.6358792185}
import DataSet from '@antv/data-set';
import commonHandler from '../commonHandler';

export default function formatChartConfig(config) {
  const props = { xAxisName: 'country', yAxisName: 'population' };
  const dataHandler = data => {
    const ds = new DataSet();
    const dv = ds.createView().source(data);
    dv.source(data).transform({
      type: 'sort',

      callback(a, b) {
        // 排序依据，和原生js的排序callback一致
        return a.population - b.population > 0;
      },
    });

    return dv;
  };

  return commonHandler(config, props, dataHandler);
}
