wuba / wuba/react-native-echarts

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

Open
#268 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
967
Forks
35
PR merge metrics
No merged PRs in 30d

Description

现象:在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>
    )

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the SvgChart integration and the useEffect event registrations shown in the report, then reproduce the supplied option on both iOS and Android with version 3.0.1. Check why showTip is observable while click and sliding events are not; done means those interactions are observable through the chart event listeners.

Written by the indexing model from the issue text.

Assessment

Tech stack
react-native, typescript
Domain
mobile
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.