Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
chenyun7924 opened this issue Feb 20, 2025 · 8 comments
Open

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

chenyun7924 opened this issue Feb 20, 2025 · 8 comments
Assignees
Labels
bug Something isn't working

Comments

@chenyun7924
Copy link

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 chenyun7924 added the bug Something isn't working label Feb 20, 2025
@neuqzxy
Copy link
Contributor

neuqzxy commented Feb 20, 2025

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

@xile611
Copy link
Contributor

xile611 commented Feb 20, 2025

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

@chenyun7924
Copy link
Author

chenyun7924 commented Feb 21, 2025

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

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

@chenyun7924
Copy link
Author

chenyun7924 commented Feb 21, 2025

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

@xile611
Copy link
Contributor

xile611 commented Feb 21, 2025

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

@chenyun7924
Copy link
Author

chenyun7924 commented Feb 21, 2025

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

@chenyun7924
Copy link
Author

@xile611

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

Image

@xile611
Copy link
Contributor

xile611 commented Mar 3, 2025

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

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

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants