import React, { useState, useEffect } from 'react'; import { FlatList, View, Text, StyleSheet, Dimensions } from 'react-native'; import { Button } from 'react-native-elements'; import Ionicons from 'react-native-vector-icons/Ionicons'; import { PieChart } from "react-native-chart-kit"; const screenWidth = Dimensions.get("window").width; const screenHeight = Dimensions.get("window").height; const ChartItem = ({ item }) => { return ( <> {item.name} {item.total} {item.percentage}% ); }; const ChartM = ({ resDataM, year, setYear, month, setMonth }) => { const chartConfig = { backgroundGradientFrom: "#abbcd6", //좌측 색 backgroundGradientFromOpacity: 0.5, backgroundGradientTo: "#E6DDC5", // 우측 색 backgroundGradientToOpacity: 0.2, backgroundColor: "#ffffff", // 어디에 적용된건지 잘 모르겠음 color: (opacity = 1) => `rgba(0, 93, 232, ${opacity})`, // data의 색상 계산할 때 사용하는 함수 //color: (opacity = 1) => `rgba(255, 255, 255, ${opacity})`, strokeWidth: 2, // optional, default 3 barPercentage: 0.5, // 그래프 width useShadowColorFromDataset: false,// optional, default is false //fillShadowGradient: 'blue', fillShadowGradientOpacity: 1, // 좀 더 진하게만 할 뿐 단색 설정은 못하는 것 같음 }; const renderChart = ({ item }) => { return ( ) } const prevBtn = () => { if (month < 1) { setYear(year - 1) setMonth(11) } else { setMonth(month - 1) } }; const nextBtn = () => { if (month > 10) { setYear(year + 1) setMonth(0) } else { setMonth(month + 1) } } console.log('sdfaslfsakflf', resDataM) return ( <>