Radar Chart with React Native Skia
Friday, June 9, 2023
Try the live demo
Scan to try on your device
Need the app?
demos
radar-chart
An ongoing collection of React Native animations crafted with Reanimated, Gesture Handler, and Skia.
TypeScript
3.2k
296
A customizable radar chart component with multiple data layers and grid visualization.
What's This About?
This component creates an interactive radar chart that can display multiple datasets with different colors and transparencies. It's particularly designed to visualize comparative data across multiple dimensions, such as chess strategy metrics in this example. The chart features a customizable grid, adjustable stroke widths, and supports custom fonts for labels. Users can dynamically update the data to see new chart configurations.
Technical Implementation
The component uses:
Skia rendering
Custom fonts
Dynamic data generation
Grid visualization
Multiple data layers
Usage
// Data structure
type RadarKeys = 'Checkmate' | 'Deflection' | 'Endgame' | 'Fork' | 'Sacrifice';
type RadarDataType = Array<{
color: string;
values: Record<RadarKeys, number>;
}>;
// Generate random data
const data = [
{
color: 'rgba(255,255,0,0.2)',
values: {
Checkmate: 1,
Deflection: 0.6,
Endgame: 0.1,
Fork: 0.1,
Sacrifice: 0.5,
},
},
{
color: 'rgba(0,255,255,0.3)',
values: {
Checkmate: 0.2,
Deflection: 0.1,
Endgame: 0.5,
Fork: 0.9,
Sacrifice: 0.8,
},
},
];
// Basic usage
<RadarChart
data={data}
showGrid={true}
font={font}
internalLayers={5}
strokeWidth={2}
strokeColor="rgba(255,255,255,0.5)"
style={{ width: width, aspectRatio: 1 }}
/>;
Unlock the beauty of React Native animations
Learn Reanimated, Gesture Handler & Skia with Reanimate.dev
Feedback on Radar Chart
Ideas, bugs, or anything that felt off: I read every message. For anything else, write to hello@reactiive.io.
Send feedback