feat(FE-316): Add gradient fill and refine bar chart axes

This commit is contained in:
rstubryan
2025-12-24 11:44:29 +07:00
parent 6ef9c1338f
commit b57a0fcc90
@@ -2,7 +2,7 @@ import React from 'react';
import { import {
Bar, Bar,
BarChart, BarChart,
Legend, CartesianGrid,
Rectangle, Rectangle,
ResponsiveContainer, ResponsiveContainer,
Tooltip, Tooltip,
@@ -66,8 +66,17 @@ const UniformityBarChart: React.FC<UniformityBarChartProps> = ({ data }) => {
className='min-h-[300px] xl:min-h-[350px]' className='min-h-[300px] xl:min-h-[350px]'
> >
<BarChart data={data} margin={margin} barGap={20}> <BarChart data={data} margin={margin} barGap={20}>
<defs>
<linearGradient id='activeBarGradient' x1='0' y1='0' x2='0' y2='1'>
<stop offset='0%' stopColor='#0069E0' stopOpacity={0.01} />
<stop offset='40%' stopColor='#0069E0' stopOpacity={1} />
<stop offset='100%' stopColor='#0069E0' stopOpacity={1} />
</linearGradient>
</defs>
<XAxis <XAxis
dataKey='name' dataKey='name'
axisLine={false}
tickLine={false}
label={{ label={{
value: 'Body Weight Range', value: 'Body Weight Range',
position: 'insideBottom', position: 'insideBottom',
@@ -76,6 +85,8 @@ const UniformityBarChart: React.FC<UniformityBarChartProps> = ({ data }) => {
}} }}
/> />
<YAxis <YAxis
axisLine={false}
tickLine={false}
label={{ label={{
value: 'Number of Birds', value: 'Number of Birds',
angle: -90, angle: -90,
@@ -89,6 +100,7 @@ const UniformityBarChart: React.FC<UniformityBarChartProps> = ({ data }) => {
width: '200px', width: '200px',
}} }}
/> />
<CartesianGrid vertical={false} />
<Bar <Bar
name='Birds' name='Birds'
dataKey='uv' dataKey='uv'
@@ -98,8 +110,9 @@ const UniformityBarChart: React.FC<UniformityBarChartProps> = ({ data }) => {
radius={[25, 25, 0, 0]} radius={[25, 25, 0, 0]}
activeBar={ activeBar={
<Rectangle <Rectangle
fill='#0069E0' fill='url(#activeBarGradient)'
stroke='#0069E0' stroke='#18181B'
strokeWidth={0}
radius={[25, 25, 0, 0]} radius={[25, 25, 0, 0]}
/> />
} }