Code Monkey home page Code Monkey logo

Comments (8)

zhiqingchen avatar zhiqingchen commented on May 13, 2024

react native版本呢?

from react-native-echarts.

jieoupen avatar jieoupen commented on May 13, 2024

react native版本呢?
以下是我的版本。

image

from react-native-echarts.

zhiqingchen avatar zhiqingchen commented on May 13, 2024

可以提交下demo代码

from react-native-echarts.

jieoupen avatar jieoupen commented on May 13, 2024
import React,{ useEffect, useRef, useState } from "react"
import { View,Text,Button ,useColorScheme, } from "react-native"

// import { SvgChart, SVGRenderer } from '@wuba/react-native-echarts';
import SvgChart, { SVGRenderer } from '@wuba/react-native-echarts/svgChart'
import * as echarts from 'echarts/core'
import {
  BarChart,
} from 'echarts/charts'
import {
  TitleComponent,
  TooltipComponent,
  GridComponent,
} from 'echarts/components'

echarts.use([
  TitleComponent,
  TooltipComponent,
  GridComponent,
  SVGRenderer,
  // ...
  BarChart,
])

const E_HEIGHT = 250;
const E_WIDTH = 300;

export function ChartComponent({ option }:{option:any}) {
  const chartRef = useRef<any>(null);

  useEffect(() => {
    let chart: any;
    if (chartRef.current) {
      // @ts-ignore
      chart = echarts.init(chartRef.current, 'light', {
        renderer: 'svg',
        width: E_WIDTH,
        height: E_HEIGHT,
      });
      chart.setOption(option);
    }
    return () => chart?.dispose();
  }, [option]);

  // Choose your preferred chart component
  // return <SkiaChart ref={chartRef} />;
  return <SvgChart ref={chartRef} />
}


const Home = ()=>{
    // 图表
    const option = {
      xAxis: {
        type: 'category',
        data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'],
      },
      yAxis: {
        type: 'value',
      },
      series: [
        {
          data: [120, 200, 150, 80, 70, 110, 130],
          type: 'bar',
        },
      ],
    }
    useEffect(()=>{
        console.log('挂载之后')
    },[])

    return (
        <>
            <View>
                <Text>我是首页</Text>
                {/* <ChartComponent option={option} /> */}
                <View style={{width:100,height:100}}>
                <ChartComponent option={option} />
                </View>
            </View>
        </>
    )
}

export default Home

from react-native-echarts.

jieoupen avatar jieoupen commented on May 13, 2024

可以提交下demo代码
您好,以上是demo代码,几乎都是copy的操作,然后关于您说的版本,我看了下依赖内是0.72.1,所以我在package.json中手动修改了这个版本,直接就运行不起来了,--关于react-native的版本升级,我得等到晚上init一个新项目试试,目前环境网络较差,无法新起项目!

from react-native-echarts.

iambool avatar iambool commented on May 13, 2024

请问项目中有使用到 PanResponder 库的地方吗

from react-native-echarts.

iambool avatar iambool commented on May 13, 2024

可复现,复现地址:https://github.com/iambool/AwesomeProject

from react-native-echarts.

zhiqingchen avatar zhiqingchen commented on May 13, 2024

1.2.3-alpha.0

@jieoupen try

from react-native-echarts.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.