Crude oil spread
Two crude oil prices and the gap between them, as a band and as bars. Good for energy markets, trading desks and reports on oil.
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: 'crudespread',
data: [
{ label: '1 Oct', first: 77.8, second: 73.6 },
{ label: '2 Oct', first: 76.8, second: 73.2 },
{ label: '3 Oct', first: 76.9, second: 71.9 },
{ label: '4 Oct', first: 75.8, second: 71.7 },
{ label: '5 Oct', first: 74.7, second: 70.3 },
{ label: '6 Oct', first: 75.2, second: 69.8 },
{ label: '7 Oct', first: 75.4, second: 70.2 },
{ label: '8 Oct', first: 74.6, second: 70.4 },
{ label: '9 Oct', first: 73.9, second: 70.1 },
{ label: '10 Oct', first: 73.1, second: 68.1 },
{ label: '11 Oct', first: 72.2, second: 67.9 },
{ label: '12 Oct', first: 73.8, second: 69.4 },
{ label: '13 Oct', first: 72.4, second: 67.9 },
{ label: '14 Oct', first: 72.9, second: 68.7 },
{ label: '15 Oct', first: 71.5, second: 66 },
{ label: '16 Oct', first: 71.3, second: 67.1 },
{ label: '17 Oct', first: 70.6, second: 66.7 },
{ label: '18 Oct', first: 69.9, second: 65.9 },
{ label: '19 Oct', first: 70.8, second: 67.2 },
{ label: '20 Oct', first: 69.3, second: 65.3 },
{ label: '21 Oct', first: 69.2, second: 65.7 },
{ label: '22 Oct', first: 69.6, second: 65.4 },
{ label: '23 Oct', first: 69.6, second: 64.7 },
{ label: '24 Oct', first: 70.7, second: 66.1 },
{ label: '25 Oct', first: 69.8, second: 65.3 },
{ label: '26 Oct', first: 69.6, second: 64.6 },
{ label: '27 Oct', first: 69.8, second: 66.1 },
{ label: '28 Oct', first: 71.1, second: 67.2 },
{ label: '29 Oct', first: 70.3, second: 65.7 },
{ label: '30 Oct', first: 70.6, second: 65.6 },
],
};
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 crudespread takes:
/** Two crude oil prices and the gap between them. */
interface CrudeSpreadSpec extends Base {
type: 'crudespread';
data: { label: string; first: number | null; second: number | null }[];
/** ["Brent", "WTI"] by default. */
names?: [string, string];
/** $/bbl by default. */
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