Skip to content

3.0.1图表监听不到点击和滑动事件 #268

Description

@bignightfish

现象:在ios和安卓平台图表监听不到点击和滑动事件,只能监听到showTip事件
版本:3.0.1
代码

    useEffect(() => {
        ChartRef.current = echarts.init(skiaRef.current, 'light', {
            renderer: 'svg',
            width: 300,
            height: 145,
        })
        const option = {
            grid: {
                left: '5%',
                right: '5%',
                top: '10%',
                bottom: '20%',
            },
            tooltip: {
                trigger: 'axis',
                triggerOn: 'mousemove',
            },
            xAxis: {
                type: 'category',
                data:['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'],
            },
            yAxis: {
                type: 'value',
            },
            series: [
                {
                    data:[820, 932, 901, 934, 1290, 1330, 1320],
                    type: 'line',
                    smooth: true,
                    showSymbol: false,
                    symbol: 'circle',
                    symbolSize: 8,
                    emphasis: {
                        scale: true,
                        scaleSize: 12,
                    },
                },
            ],
        }
        ChartRef.current.setOption(option)
        // 点击图表:如果正在播放则暂停,并触发回调
        ChartRef.current.on('showTip', (params: any) => {
 console.log('apc_153', params)
        })
ChartRef.current.on('click', (params: any) => {
                console.log('apc_153', params)
            })

        return () => ChartRef.current?.dispose()
    }, [])
    return (
        <GestureHandlerRootView style={[wrapStyle, styles.container]}>
            <View style={styles.chartBox}>
                <SvgChart ref={skiaRef} />
            </View>
        </GestureHandlerRootView>
    )

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions