const dimensionLinkage = (spec, context)=>{
    const { advancedVSeed, vseed } = context;
    const { chartType } = vseed;
    const config = advancedVSeed.config?.[chartType]?.dimensionLinkage ?? {};
    if (false === config.enable) return spec;
    const indicators = spec.indicators;
    const labelHoverOnAxis = {};
    const chartSpec = indicators?.[0]?.chartSpec;
    const crosshair = chartSpec?.crosshair;
    if (crosshair?.xField) {
        const labelFormat = crosshair.xField.label?.formatMethod;
        labelHoverOnAxis.bottom = {
            visible: config.showLabel ?? crosshair.xField.label?.visible ?? true,
            background: crosshair.xField.label?.labelBackground,
            textStyle: crosshair.xField.label?.style,
            formatMethod: labelFormat ? (text)=>text || 0 === text ? labelFormat(text) : null : void 0
        };
    }
    if (crosshair?.yField) {
        const labelFormat = crosshair.yField.label?.formatMethod;
        labelHoverOnAxis.left = {
            visible: config.showLabel ?? crosshair.yField.label?.visible ?? true,
            background: crosshair.yField.label?.labelBackground,
            textStyle: crosshair.yField.label?.style,
            formatMethod: labelFormat ? (text)=>text || 0 === text ? labelFormat(text) : null : void 0
        };
    }
    if (indicators && indicators.length) indicators.forEach((ind)=>{
        const crosshair = ind?.chartSpec?.crosshair;
        if (crosshair?.xField) crosshair.xField.label = {
            visible: false
        };
        if (crosshair?.yField) crosshair.yField.label = {
            visible: false
        };
    });
    spec.chartDimensionLinkage = {
        showTooltip: config.showTooltip ?? chartSpec?.tooltip?.dimension?.visible ?? true,
        heightLimitToShowTooltipForEdgeRow: spec.defaultRowHeight / 2,
        widthLimitToShowTooltipForEdgeColumn: spec.defaultColWidth / 2,
        labelHoverOnAxis
    };
    return spec;
};
export { dimensionLinkage };

//# sourceMappingURL=dimensionLinkage.js.map