I am using react native chart kit yarn add react-native-chart-kit
to visualize data and this is my code:
import React from "react";
import { View, Text, Dimensions } from "react-native";
import RandomColor from "randomcolor";
import {
LineChart,
BarChart,
PieChart,
ProgressChart,
ContributionGraph,
StackedBarChart,
} from "react-native-chart-kit";
const Chart = ({ classList }) => {
return (
<View>
<Text>Bezier Line Chart</Text>
<BarChart
data={{
labels: classList.map((classItem) => {
return classItem.classname;
}),
datasets: [
{
data: classList.map((classItem) => {
return classItem.studentList.length;
}),
},
],
}}
width={Dimensions.get("window").width}
height={220}
yAxisInterval={1}
chartConfig={{
backgroundColor: "#ffffff",
backgroundGradientFrom: "#ffffff",
backgroundGradientTo: "#ffffff",
decimalPlaces: 2,
color: () => "blue",
labelColor: () => "black",
style: {
borderRadius: 16,
},
propsForDots: {
r: "6",
strokeWidth: "1",
stroke: "#ffa726",
},
}}
bezier
style={{
marginVertical: 8,
borderRadius: 16,
}}
/>
</View>
);
};
export default Chart;
and this is how it returned:
As you can see, it worked, but not perfectly. The color at the end of each bar gradually fades out from top to bottom and it is not good with the white backgroundColor. So, I want to make the color of each bar solid. Is there any way to fix it?