问题描述
我的 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 (将#修改为@)