Top 5, top 10
A ranking with pictures, figures and changes of rank. Good for best players, products, advisers.
The smallest code that works. change the code, then press Run
In your framework
import { Chart } from 'nervure/react';
const spec = {
type: 'ranking',
top: 5,
unit: ' pts',
data: [
{ name: 'Amira Ben Ali', value: 565, previousRank: 3 },
{ name: 'Youssef Trabelsi', value: 262, previousRank: 3 },
{ name: 'Lina Gharbi', value: 223, previousRank: 2 },
{ name: 'Omar Jaziri', value: 645, previousRank: 4 },
{ name: 'Sara Mejri', value: 300, previousRank: 2 },
{ name: 'Nour Ayari', value: 295, previousRank: 2 },
],
};
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 ranking takes:
/** A top 3, 5, 10… with pictures and changes of rank. */
interface RankingSpec extends Base {
type: 'ranking';
data: { name: string; value: number; previousRank?: number; image?: string; detail?: string; color?: string }[];
top?: number;
unit?: 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