import { LineChart } from 'echarts/charts';
import { GridComponent } from 'echarts/components';
import * as echarts from 'echarts/core';
import { commonEchartsComponents, defineComponent } from '../utils/comp-factory.js';

echarts.use([...commonEchartsComponents, GridComponent, LineChart]);
const lineOption = (props) => {
    const { data, xAxisData, stack, areaStyle, smooth } = props;
    let _series;
    if (data && Array.isArray(data[0])) {
        _series = Array.from({ length: data.length }, (_, idx) => ({
            type: 'line',
            data: data[idx],
            stack,
            areaStyle,
            smooth,
        }));
    }
    else {
        _series = data ? [{ type: 'line', data, stack, areaStyle, smooth }] : undefined;
    }
    return {
        // 声明一个 X 轴，类目轴（category）。默认情况下，类目轴对应到 dataset 第一列。
        xAxis: { type: 'category', data: xAxisData },
        // 声明一个 Y 轴，数值轴。
        yAxis: {},
        series: _series,
    };
};
var line = defineComponent(echarts, 'line', lineOption);

export { line as default };
//# sourceMappingURL=line.js.map
