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

不支持axisLabel.fomatter 中,返回react native组件 #231

Open
llr101 opened this issue Jan 24, 2025 · 0 comments
Open

不支持axisLabel.fomatter 中,返回react native组件 #231

llr101 opened this issue Jan 24, 2025 · 0 comments

Comments

@llr101
Copy link

llr101 commented Jan 24, 2025

Describe the bug
不支持axisLabel.fomatter 中,返回react native组件,希望加入一些react native的点击时间

To Reproduce

// Original example: https://echarts.apache.org/examples/en/editor.html?c=line-simple
// The following code is modified from
// https://github.com/apache/echarts-examples/blob/gh-pages/public/examples/ts/line-simple.ts
// under Apache License 2.0.
import { useRef, useEffect } from 'react';
import { StyleSheet, View, Dimensions, Text } from 'react-native';
import { SkiaRenderer, SkiaChart, echarts } from '@wuba/react-native-echarts';

echarts.use([SkiaRenderer]);

const E_HEIGHT = 400;
const E_WIDTH = Dimensions.get('window').width;

export default function App() {
  const skiaRef = useRef<any>(null);
  useEffect(() => {
    const option = {
      xAxis: {
        type: 'category',
        data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'],
        axisLabel: {
          formatter: value => <Text>{value}</Text>
        }
      },
      yAxis: {
        type: 'value',
      },
      series: [
        {
          data: [150, 230, 224, 218, 135, 147, 260],
          type: 'line',
        },
      ],
    };
    let chart: any;
    if (skiaRef.current) {
      chart = echarts.init(skiaRef.current, 'light', {
        renderer: 'skia',
        width: E_WIDTH,
        height: E_HEIGHT,
      });
      chart.setOption(option);
    }
    return () => chart?.dispose();
  }, []);

  return (
    <View style={styles.container}>
      <SkiaChart ref={skiaRef} />
    </View>
  );
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    alignItems: 'center',
    justifyContent: 'center',
  },
});

Expected behavior
显示[object object]

Screenshots

Image

Desktop (please complete the following information):

  • OS: [e.g. iOS]
  • Browser [e.g. chrome, safari]
  • Version [e.g. 22]

Smartphone (please complete the following information):

  • Device: [e.g. iPhone6]
  • OS: [e.g. iOS8.1]
  • Browser [e.g. stock browser, safari]
  • Version [e.g. 22]

Additional context
Add any other context about the problem here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant