import { __extends } from "tslib";
import { isNil } from '@antv/util';
import { Plot } from '../../core/plot';
import { getDataWhetherPecentage } from '../../utils/transform/percent';
import { findViewById } from '../../utils';
import { adaptor, meta } from './adaptor';
import { DEFAULT_OPTIONS, POINT_VIEW_ID } from './constants';
var Area = /** @class */ (function (_super) {
    __extends(Area, _super);
    function Area() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        /** 图表类型 */
        _this.type = 'area';
        return _this;
    }
    /**
     * 获取 面积图 默认配置项
     * 供外部使用
     */
    Area.getDefaultOptions = function () {
        return DEFAULT_OPTIONS;
    };
    /**
     * 获取 面积图 默认配置
     */
    Area.prototype.getDefaultOptions = function () {
        return Area.getDefaultOptions();
    };
    /**
     * @override
     * @param data
     */
    Area.prototype.changeData = function (data) {
        this.updateOption({ data: data });
        var _a = this, chart = _a.chart, options = _a.options;
        var isPercent = options.isPercent, xField = options.xField, yField = options.yField;
        meta({ chart: chart, options: options });
        var chartdata = getDataWhetherPecentage(data, yField, xField, yField, isPercent);
        this.chart.changeData(chartdata);
        var pointView = findViewById(this.chart, POINT_VIEW_ID);
        if (pointView) {
            pointView.changeData(data.filter(function (d) { return !isNil(d[yField]); }));
        }
    };
    /**
     * 获取 面积图 的适配器
     */
    Area.prototype.getSchemaAdaptor = function () {
        return adaptor;
    };
    return Area;
}(Plot));
export { Area };
//# sourceMappingURL=index.js.map