parent
ac35dade0f
commit
4ef61c878e
2 changed files with 57 additions and 54 deletions
@ -1,60 +1,61 @@ |
|||||||
import React, { PureComponent } from 'react'; |
import React, { PureComponent } from 'react'; |
||||||
import { Radar, RadarChart, PolarGrid, Legend, PolarAngleAxis, PolarRadiusAxis, ResponsiveContainer } from 'recharts'; |
import { Radar, RadarChart, PolarGrid, Legend, PolarAngleAxis, PolarRadiusAxis, ResponsiveContainer } from 'recharts'; |
||||||
|
|
||||||
const data = [ |
|
||||||
|
function SpecifiedDomainRadarChart ({ data }) { |
||||||
|
return ( |
||||||
|
<section className="bg-white w-11/12 mx-auto my-20 p-7 rounded-lg shadow-lg"> |
||||||
|
<ResponsiveContainer width="100%" aspect={2}> |
||||||
|
<RadarChart cx="50%" cy="50%" outerRadius="80%" data={data}> |
||||||
|
<PolarGrid stroke="#A1CBFF" /> |
||||||
|
<PolarAngleAxis dataKey="subject" tick={{stroke: "#A1CBFF"}}/> |
||||||
|
{/* <PolarRadiusAxis angle={30} domain={[0, 150]} /> */} |
||||||
|
<Radar name="Mike" dataKey="A" stroke="blue" fill="blue" fillOpacity={0.9} /> |
||||||
|
<Radar name="Lily" dataKey="B" stroke="#36C7EC" fill="#36C7EC" fillOpacity={0.1} strokeDasharray="7 7"/> |
||||||
|
</RadarChart> |
||||||
|
</ResponsiveContainer> </section> |
||||||
|
); |
||||||
|
}; |
||||||
|
|
||||||
|
export default SpecifiedDomainRadarChart; |
||||||
|
|
||||||
|
SpecifiedDomainRadarChart.defaultProps = { |
||||||
|
data: [ |
||||||
{ |
{ |
||||||
subject: 'Math', |
subject: 'پشتیبانی', |
||||||
A: 120, |
A: 107, |
||||||
B: 110, |
B: 113, |
||||||
fullMark: 150, |
fullMark: 150, |
||||||
}, |
}, |
||||||
{ |
{ |
||||||
subject: 'Chinese', |
subject: 'لجستیک', |
||||||
A: 98, |
A: 75, |
||||||
B: 130, |
B: 150, |
||||||
fullMark: 150, |
fullMark: 150, |
||||||
}, |
}, |
||||||
{ |
{ |
||||||
subject: 'English', |
subject: 'زنجیره تامین', |
||||||
A: 86, |
A: 100, |
||||||
B: 130, |
B: 130, |
||||||
fullMark: 150, |
fullMark: 150, |
||||||
}, |
}, |
||||||
{ |
{ |
||||||
subject: 'Geography', |
subject: 'اداری', |
||||||
A: 99, |
A: 120, |
||||||
B: 100, |
B: 120, |
||||||
fullMark: 150, |
fullMark: 150, |
||||||
}, |
}, |
||||||
{ |
{ |
||||||
subject: 'Physics', |
subject: 'حسابداری', |
||||||
A: 85, |
A: 85, |
||||||
B: 90, |
B: 120, |
||||||
fullMark: 150, |
fullMark: 150, |
||||||
}, |
}, |
||||||
{ |
{ |
||||||
subject: 'History', |
subject: 'بازاریابی', |
||||||
A: 65, |
A: 96, |
||||||
B: 85, |
B: 96, |
||||||
fullMark: 150, |
fullMark: 150, |
||||||
}, |
}, |
||||||
]; |
] |
||||||
|
}; |
||||||
export default class Example extends PureComponent { |
|
||||||
static demoUrl = 'https://codesandbox.io/s/radar-chart-specified-domain-mfl04'; |
|
||||||
|
|
||||||
render() { |
|
||||||
return ( |
|
||||||
<ResponsiveContainer width="100%" height="100%"> |
|
||||||
<RadarChart cx="50%" cy="50%" outerRadius="80%" data={data}> |
|
||||||
<PolarGrid /> |
|
||||||
<PolarAngleAxis dataKey="subject" /> |
|
||||||
<PolarRadiusAxis angle={30} domain={[0, 150]} /> |
|
||||||
<Radar name="Mike" dataKey="A" stroke="#8884d8" fill="#8884d8" fillOpacity={0.6} /> |
|
||||||
<Radar name="Lily" dataKey="B" stroke="#82ca9d" fill="#82ca9d" fillOpacity={0.6} /> |
|
||||||
<Legend /> |
|
||||||
</RadarChart> |
|
||||||
</ResponsiveContainer> |
|
||||||
); |
|
||||||
} |
|
||||||
} |
|
||||||
|
Loading…
Reference in new issue