Selamlar,
Aşağıdaki kod yapısında ,
grafiğe manuel olarak atanmış değerlerin , bağlandığım rest apiden gelmesini istiyorum .
Sizce nasıl bir yol izlemem gerekiyor.
import React, {Component} from 'react';
import {Platform, StyleSheet, Text, View, Dimensions } from 'react-native';
import axios from 'axios';
import {
LineChart,
BarChart,
PieChart,
ProgressChart,
ContributionGraph,
StackedBarChart
} from 'react-native-chart-kit';
Selamlar, Aşağıdaki kod yapısında , grafiğe manuel olarak atanmış değerlerin , bağlandığım rest apiden gelmesini istiyorum . Sizce nasıl bir yol izlemem gerekiyor.
import React, {Component} from 'react'; import {Platform, StyleSheet, Text, View, Dimensions } from 'react-native'; import axios from 'axios'; import { LineChart, BarChart, PieChart, ProgressChart, ContributionGraph, StackedBarChart } from 'react-native-chart-kit';
const screenWidth = Dimensions.get('window').width; const chartConfig = { backgroundGradientFrom: 'white', backgroundGradientTo: 'white', color: (opacity = 1) =>
rgba(26, 255, 146, ${opacity})
, strokeWidth: 2 // optional, default 3 };let data = { labels: ['01', '02', '03', '04', '05', '06', '07','08','09','10','11','12'], datasets: [{ data: [ 44, 45, 28, 80, 99, 43,20, 45, 28, 80, 99, 43 ], color: (opacity = 1) => 'red', // optional strokeWidth: 2 // optional }] }; //global.Myvar export default class Dashboard extends Component {
render() { return ( <View style={{flex: 1}}>
data={data} width={screenWidth} height={220} chartConfig={chartConfig} /> ); } }
const styles = StyleSheet.create({ container: { flex: 1, justifyContent: 'center', alignItems: 'center', backgroundColor: '#F5FCFF', } });