text: import { __assign } from "tslib";
  import { adaptor as columnAdaptor } from '../column/adaptor';
  import { transformBarData } from './utils';
  export { meta } from '../column/adaptor';
  /**
   * 柱形图适配器
   * @param params
   */
  export function adaptor(params) {
      var chart = params.chart, options = params.options;
      var xField = options.xField, yField = options.yField, xAxis = options.xAxis, yAxis = options.yAxis, barStyle = options.barStyle, barWidthRatio = options.barWidthRatio, label = options.label, data = options.data, seriesField = options.seriesField, isStack = options.isStack, minBarWidth = options.minBarWidth, maxBarWidth = options.maxBarWidth;
      // label of bar charts default position is left, if plot has label
      if (label && !label.position) {
          label.position = 'left';
          // 配置默认的 label layout： 如果用户没有指定 layout 和 position， 则自动配置 layout
          if (!label.layout) {
              label.layout = [
                  { type: 'interval-adjust-position' },
                  { type: 'interval-hide-overlap' },
                  { type: 'adjust-color' },
                  { type: 'limit-in-plot', cfg: { action: 'hide' } },
              ];
          }
      }
      // 默认 legend 位置
      var legend = options.legend;
      if (seriesField) {
          if (legend !== false) {
              legend = __assign({ position: isStack ? 'top-left' : 'right-top', reversed: isStack ? false : true }, (legend || {}));
          }
      }
      else {
          legend = false;
      }
      // @ts-ignore 直接改值
      params.options.legend = legend;
      // 默认 tooltip 配置
      var tooltip = options.tooltip;
      if (seriesField) {
          if (tooltip !== false) {
              tooltip = __assign({ reversed: isStack ? false : true }, (tooltip || {}));
          }
      }
      // @ts-ignore 直接改值
      params.options.tooltip = tooltip;
      // transpose column to bar
      chart.coordinate().transpose();
      return columnAdaptor({
          chart: chart,
          options: __assign(__assign({}, options), { label: label, 
              // switch xField and yField
              xField: yField, yField: xField, xAxis: yAxis, yAxis: xAxis, 
              // rename attrs as column
              columnStyle: barStyle, columnWidthRatio: barWidthRatio, minColumnWidth: minBarWidth, maxColumnWidth: maxBarWidth, columnBackground: options.barBackground, 
              // bar 调整数据顺序
              data: transformBarData(data) }),
      }, true);
  }
  //# sourceMappingURL=adaptor.js.map