wujingjing
2025-03-03 1075860848d14e3d6d1506b91d9c9039433bf4cc
src/components/chat/chatComponents/hooks/useDrawChatChart.ts
@@ -16,28 +16,38 @@
      resizeChart?.(width, height);
   };
   onMounted(() => {
   const initChart = () => {
      setTimeout(() => {
         const parent = chartRef.value.parentElement;
         const instance = echarts.getInstanceByDom(chartRef.value);
         if (!instance) {
            const parent = chartRef.value.parentElement;
            const parentBound = parent.getBoundingClientRect();
         const parentBound = parent.getBoundingClientRect();
         chartInstance.value = echarts.init(chartRef.value, undefined, {
            width: parentBound.width,
            height: parentBound.height,
         });
         resizeChart = debounce((width, height) => {
            chartInstance.value.resize({
               width: width,
               height: height,
            chartInstance.value = echarts.init(chartRef.value, undefined, {
               width: parentBound.width,
               height: parentBound.height,
               locale: 'ZH',
            });
         });
            resizeChart = debounce((width, height) => {
               chartInstance.value.resize({
                  width: width,
                  height: height,
               });
            });
         }
         drawChart();
      }, 300);
      }, 100);
   };
   onMounted(() => {
      initChart();
   });
   return {
      chartContainerResize,
      chartInstance,
   };
};