Skip to content

Sun path ​

The arc of the sun over a day, sunrise, sunset and twilights, the moon, and where the sun stands now. Good for daylight of a place and a date: gardens, photography, solar panels, events outdoors.

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

In your framework

import { Chart } from 'nervure/react';
import 'nervure/themes';

const spec = {
  type: 'sunpath',
  sunrise: '06:17',
  sunset: '19:10',
  dawn: '05:45',
  dusk: '19:43',
  noonAltitude: 40,
  now: '12:30',
  moonrise: '15:00',
  moonset: '03:00',
  previous: 771,
};

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 sunpath takes:

/** The path of the sun over a day, with the twilights, the daylight and where the sun stands now. */
interface SunPathSpec extends Base {
  type: 'sunpath';
  /** "06:42". */
  sunrise: string;
  sunset: string;
  /** Start of civil dawn and end of civil dusk: the light before and after. */
  dawn?: string;
  dusk?: string;
  /** Height of the sun at noon, in degrees: written at the top of the arc. */
  noonAltitude?: number;
  /** Time of day to mark on the arc. */
  now?: string;
  moonrise?: string;
  moonset?: string;
  /** Daylight of the day before, in minutes: the change is written. */
  previous?: number;
}

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