VChart icon indicating copy to clipboard operation
VChart copied to clipboard

[Bug] taro 图表显示不出来 事件正常触发

Open chenyun7924 opened this issue 10 months ago • 8 comments

Version

1.13.5

Link to Minimal Reproduction

bug

Steps to Reproduce

暂时不提供

Current Behavior

Image 代码如下: import { View } from '@tarojs/components'; import Taro from '@tarojs/taro'; import { VChart, } from '@visactor/vchart/esm/core' import { LineChart } from '@visactor/taro-vchart';

import { registerLabel,registerWXEnv } from '@visactor/vchart';

const spec = { type: 'line', data: { values: [ { time: '2:00', value: 8 }, { time: '4:00', value: 9 }, { time: '6:00', value: 11 }, { time: '8:00', value: 14 }, { time: '10:00', value: 16 }, { time: '12:00', value: 17 }, { time: '14:00', value: 17 }, { time: '16:00', value: 16 }, { time: '18:00', value: 15 } ] }, xField: 'time', yField: 'value' } const Pie = () => { VChart.useRegisters([registerLabel,registerWXEnv])

return (
    <View
      style={{
            border: '1px solid #eeeeee',
            width: '90vw'
        }}
    >

        <LineChart
          type={Taro.getEnv() as any}
          spec={spec}
          canvasId='line-echart'
          style={{ height: '35vh', width: '100%' }}
          chartConstructor={VChart}
          onChartInit={() => {
                console.log('init pie');
            }}
          onChartReady={() => {
                console.log('ready pie');
            }}
          onChartUpdate={() => {
                console.log('update pie');
            }}
        />
    </View>
);

} export default Pie

Expected Behavior

图表能正常展示

Environment

"browserslist": [
		"last 3 versions",
		"Android >= 4.1",
		"ios >= 8"
	],

Any additional comments?

按需加载文档能不能写的详细点啊

chenyun7924 avatar Feb 20 '25 03:02 chenyun7924

Image 我们测试可以正常显示,无法复现您的问题,请提供一下可复现的环境 @chenyun7924

neuqzxy avatar Feb 20 '25 11:02 neuqzxy

@chenyun7924 确认一下版本是否是1.13.5,1.13.5修复过一个图形相关的注册问题

xile611 avatar Feb 20 '25 11:02 xile611

@chenyun7924 确认一下版本是否是1.13.5,1.13.5修复过一个图形相关的注册问题

图表现在能正常显示了 但是我发现包体积有个问题 使用LineEchart与使用Vchart相比 ,Vchart开发环境中 只有4k多,LineEchart竟然有5K多,但是打包之后 LineEchart只有1.3左右 Vchart有2.9左右。因为体积太大了使用LineEchart以为者开发环境下无法预览

chenyun7924 avatar Feb 21 '25 01:02 chenyun7924

[@chenyun7924] 按需引入使用LineEchart,开发情况下的体积和打包后的体积 是正常吗 ,打包后1.3M也是占用的内存也是挺大的了

chenyun7924 avatar Feb 21 '25 01:02 chenyun7924

@chenyun7924 开发环境没有tree-shaking ,所以可能不生效 打包后,会做tree-shaking ,看起来是正常的

xile611 avatar Feb 21 '25 01:02 xile611

@xile611 @neuqzxy 打包后光使用LIneEchart的文件都1.4MB了,外加vendors.js文件也大。这样的情况下 主包不用写其他代码 都应超过2MB了,完全不适合开发啊

chenyun7924 avatar Feb 21 '25 02:02 chenyun7924

@xile611

未打包是这样:Image 打包后是这样:

Image

chenyun7924 avatar Feb 21 '25 02:02 chenyun7924

@xile611 @neuqzxy 打包后光使用LIneEchart的文件都1.4MB了,外加vendors.js文件也大。这样的情况下 主包不用写其他代码 都应超过2MB了,完全不适合开发啊

如果只使用LineChart 的话,vchart所有依赖包括 vrender应该是 1.3M上下,不会超过2M VChart 所有图表和所有插件,打包后才会超过2M

你的截图好像没有体现包体积

xile611 avatar Mar 03 '25 02:03 xile611