export { default as ChartStatistic } from "../ChartStatistic";
export { default as ChartContainer } from "./ChartContainer/ChartContainer";
export { default as ChartFilter } from "./ChartFilter/ChartFilter";
export { default as ChartToolBar } from "./ChartToolBar/ChartToolBar";
// 通用图表下载工具函数
export var downloadChart = function downloadChart(chartInstance) {
    var filename = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 'chart', format = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : 'png', quality = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : 1;
    if (!chartInstance) {
        console.error('Chart instance is not available');
        return false;
    }
    try {
        // 使用 Chart.js 原生的 toBase64Image 方法
        var mimeType = format === 'png' ? 'image/png' : 'image/jpeg';
        var base64Image = chartInstance.toBase64Image(mimeType, quality);
        // 验证 base64 数据是否有效
        if (!base64Image || base64Image.trim() === '') {
            throw new Error('Invalid base64 image data');
        }
        // 创建下载链接
        var link = document.createElement('a');
        link.download = "".concat(filename, "-").concat(new Date().getTime(), ".").concat(format);
        link.href = base64Image;
        // 触发下载
        document.body.appendChild(link);
        link.click();
        document.body.removeChild(link);
        console.log("Chart downloaded successfully as ".concat(format.toUpperCase()));
        return true;
    } catch (error) {
        console.error('Error downloading chart:', error);
        return false;
    }
};
