在React Native图上显示Firebase数据

时间:2019-11-08 11:05:45

标签: firebase react-native graph

我正在构建一个带有Expo的React Native App,无法将数据从Firebase提取到图形中。我正在使用react-native-svg-charts并通过示例获得

import React, {Component} from 'react';
import {
    Text,
    StyleSheet,
    ScrollView,
    View,
    TouchableOpacity, Button, Alert, Image,
} from 'react-native';
import {Grid, LineChart, AreaChart, YAxis, PieChart, StackedAreaChart, BarChart} from 'react-native-svg-charts';
import * as shape from 'd3-shape';


class GraphExample extends React.PureComponent {

    render() {

        const data = [ 50, 40, 45, 65, 85, 22, 30, -10, 35, 53, 53, 24, 50, 20, 80 ]


        return (
            <View>
                <AreaChart
                    style={{ height: 200 }}
                    data={ data }
                    contentInset={{ top: 30, bottom: 30 }}
                    curve={ shape.curveNatural }
                    svg={{ fill: 'green' }}
                >
                    <Grid/>
                </AreaChart>
            </View>
        )
    }
}

如何将我的Firebase数据提取到表示const数据的位置?

谢谢您的帮助。

0 个答案:

没有答案