Getting Started
Getting started with Twigs Charts
Twigs Charts is a React component library from SurveySparrow for building charts. It is built on top of Recharts and provides a set of components for building charts.
Installation
npm install @surveysparrow/twigs-chartsyarn add @surveysparrow/twigs-chartspnpm add @surveysparrow/twigs-chartsMake sure these peer dependencies are installed in your project:
npm install @surveysparrow/twigs-react rechartsyarn add @surveysparrow/twigs-react rechartspnpm add @surveysparrow/twigs-react rechartsUsage
The package provides a ThemeProvider component that can be used to provide a theme to the charts, it should be wrapped around a top level component in your application.
import { ThemeProvider } from "@surveysparrow/twigs-charts";
<ThemeProvider
theme={{
fontFamily: "DM Sans",
fontFamilyAlternate: "DM Mono",
colors: {
primary: "#7158F5",
list: [
"#7158F5",
"#EE7D61",
"#98E0D8",
"#EFBE55",
"#84CC16",
],
}
}}
>
<Charts />
</ThemeProvider>