Likert chart
Answers on both sides of a middle. Good for surveys with a scale of agreement.
The smallest code that works. change the code, then press Run
In your framework
import { Chart } from 'nervure/react';
const spec = {
type: 'likert',
answers: ['Never', 'Rarely', 'Sometimes', 'Often', 'Always'],
data: [
{ name: 'Easy to use', values: [23, 18, 10, 21, 8] },
{ name: 'Fast', values: [8, 26, 23, 12, 12] },
{ name: 'Good price', values: [11, 11, 38, 5, 26] },
{ name: 'Would return', values: [4, 19, 12, 13, 30] },
],
};
export default function Example() {
return <Chart spec={spec} style={{ height: 340 }} />;
}Or import this chart alone: what each import weighs.
Options
Beside the fields shared by every chart (title, format, heading, export…), type likert takes:
/** Answers on both sides of a middle. */
interface LikertSpec extends Base {
type: 'likert';
answers: string[];
data: { name: string; values: number[] }[];
colors?: string[];
}Style it
- Colours:
theme.palette,chart.setColor(name, colour), or--nervure-palettein your CSS. More - Marks:
[data-series="name"], parts:[data-part="axes"],legend,series. What you change is kept in exports. - Movement:
animation: falsedraws at once. More - Files:
chart.download('png'),svg,csv. More