import { DUAL_AXIS_CHART_COLUMN_Z_INDEX, DUAL_AXIS_CHART_NON_COLUMN_Z_INDEX } from "../../../../utils/constant.js";
function applyChartType(result, type, datasetReshapeInfo) {
    switch(type){
        case 'line':
            result.type = 'line';
            break;
        case 'column':
            result.type = 'bar';
            result.stack = true;
            result.zIndex = DUAL_AXIS_CHART_COLUMN_Z_INDEX;
            break;
        case 'columnParallel':
            {
                const columnSpec = result;
                if (Array.isArray(columnSpec.xField)) columnSpec.xField.push(datasetReshapeInfo[0].unfoldInfo.encodingDetail);
                else if (columnSpec.xField) columnSpec.xField = [
                    columnSpec.xField,
                    datasetReshapeInfo[0].unfoldInfo.encodingDetail
                ];
                columnSpec.type = 'bar';
                result.zIndex = DUAL_AXIS_CHART_COLUMN_Z_INDEX;
                break;
            }
        case 'columnPercent':
            result.type = 'bar';
            result.percent = true;
            result.zIndex = DUAL_AXIS_CHART_COLUMN_Z_INDEX;
            break;
        case 'area':
            result.type = 'area';
            break;
        case 'areaPercent':
            result.type = 'area';
            result.percent = true;
            break;
        case 'scatter':
            result.type = 'scatter';
            break;
        default:
            result.type = type;
    }
}
const dualChartType = (options)=>(spec, context)=>{
        const result = {
            ...spec,
            zIndex: DUAL_AXIS_CHART_NON_COLUMN_Z_INDEX
        };
        const { advancedVSeed } = context;
        const { datasetReshapeInfo } = advancedVSeed;
        applyChartType(result, options.chartType, datasetReshapeInfo);
        return result;
    };
export { dualChartType };

//# sourceMappingURL=dualChartType.js.map