react-native-chart-kit 图表到图像

问题描述

我的 react-native 应用程序中有一个图表,我想将其转换为 base64 字符串。因此,为此,我想将我的 LineChart 转换为图像。那么我怎样才能做到这一点?

import React from 'react';
import {Text,View,Dimensions} from 'react-native';

import {LineChart} from 'react-native-chart-kit';

const App = () => {
  return (
    <View>
      <Text>Bezier Line Chart</Text>
      <LineChart
        data={{
          labels: ['January','February','march','April','May','June'],datasets: [
            {
              data: [
                Math.random() * 100,Math.random() * 100,],},}}
        width={Dimensions.get('window').width} // from react-native
        height={220}
        yAxisLabel="$"
        yAxisSuffix="k"
        yAxisInterval={1} // optional,defaults to 1
        chartConfig={{
          backgroundColor: '#e26a00',backgroundGradientFrom: '#fb8c00',backgroundGradientTo: '#ffa726',decimalPlaces: 2,// optional,defaults to 2dp
          color: (opacity = 1) => `rgba(255,255,${opacity})`,labelColor: (opacity = 1) => `rgba(255,style: {
            borderRadius: 16,propsForDots: {
            r: '6',strokeWidth: '2',stroke: '#ffa726',}}
        bezier
        style={{
          marginVertical: 8,borderRadius: 16,}}
      />
    </View>
  );
};
export default App;

这是基本的 LineChart 程序。
附注
如果无法使用此包,是否还有其他方法可以将任何数据点转换为图形,从而将其转换为图像?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...