Skip to content

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

@phalera

Description

@phalera

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.

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