[Bug] taro 图表显示不出来 事件正常触发
Version
1.13.5
Link to Minimal Reproduction
bug
Steps to Reproduce
暂时不提供
Current Behavior
代码如下:
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 确认一下版本是否是1.13.5,1.13.5修复过一个图形相关的注册问题
@chenyun7924 确认一下版本是否是1.13.5,1.13.5修复过一个图形相关的注册问题
图表现在能正常显示了 但是我发现包体积有个问题 使用LineEchart与使用Vchart相比 ,Vchart开发环境中 只有4k多,LineEchart竟然有5K多,但是打包之后 LineEchart只有1.3左右 Vchart有2.9左右。因为体积太大了使用LineEchart以为者开发环境下无法预览
[@chenyun7924] 按需引入使用LineEchart,开发情况下的体积和打包后的体积 是正常吗 ,打包后1.3M也是占用的内存也是挺大的了
@chenyun7924 开发环境没有tree-shaking ,所以可能不生效 打包后,会做tree-shaking ,看起来是正常的
@xile611 @neuqzxy 打包后光使用LIneEchart的文件都1.4MB了,外加vendors.js文件也大。这样的情况下 主包不用写其他代码 都应超过2MB了,完全不适合开发啊
@xile611
未打包是这样:
打包后是这样: