Skip to content

Neighbourhood flower ​

One petal for each kind of place nearby, as long as its score, with the walk to the nearest. Good for comparing where to live, and real estate listings.

The smallest code that works. change the code, then press Run

In your framework

import { Chart } from 'nervure/react';

const spec = {
  type: 'amenities',
  name: 'Sousse, Khezama',
  data: [
    { name: 'Schools', icon: 'school', score: 6.5, minutes: 8 },
    { name: 'Transport', icon: 'transport', score: 4.1, minutes: 10 },
    { name: 'Shops', icon: 'shop', score: 3.8, minutes: 4 },
    { name: 'Health', icon: 'health', score: 7.2, minutes: 11 },
    { name: 'Parks', icon: 'park', score: 4.4, minutes: 6 },
    { name: 'Restaurants', icon: 'food', score: 4.4, minutes: 5 },
    { name: 'Sport', icon: 'sport', score: 9.5, minutes: 2 },
    { name: 'Culture', icon: 'culture', score: 7.2, minutes: 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 amenities takes:

/** Score of a neighbourhood as a flower: one petal for each kind of place nearby. */
interface AmenitiesSpec extends Base {
  type: 'amenities';
  data: Amenity[];
  /** Name of the place, written in the middle. */
  name?: string;
}

interface Amenity {
  name: string;

Style it

  • Colours: theme.palette, chart.setColor(name, colour), or --nervure-palette in your CSS. More
  • Marks: [data-series="name"], parts: [data-part="axes"], legend, series. What you change is kept in exports.
  • Movement: animation: false draws at once. More
  • Files: chart.download('png'), svg, csv. More

Close to it