import { useDataset } from './dataset'
import { useOptions } from './options'
import { EchartsDataset } from './interface'

export function useLineChart() {
    const { dataset, clearData } = useDataset()
    const { options, initOptions } = useOptions(dataset)

    /**
     * 初始化数据
     */
    const initData = (data: EchartsDataset['line']['source']) => {
        clearData()
        dataset.line.source = data
    }

    return {
        options,
        initData,
        initOptions,
    }
}