Refinery yields
A distillation column and the products drawn off it, light at the top, as thick as their share. Good for what a barrel of crude becomes, for teaching and refinery reports.
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: 'refinery',
input: 300000,
data: [
{ name: 'LPG', share: 3.4 },
{ name: 'Gasoline', share: 46.6 },
{ name: 'Jet fuel', share: 9.1 },
{ name: 'Diesel', share: 30.7 },
{ name: 'Heavy fuel oil', share: 3.4 },
{ name: 'Other products', share: 6.8 },
],
};
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 refinery takes:
/** What a refinery makes from a barrel of crude: products drawn off a column, the light ones at the top. */
interface RefinerySpec extends Base {
type: 'refinery';
/** From the lightest product to the heaviest; `share` in % of the volume. */
data: { name: string; share: number; color?: string }[];
/** Crude run, in `unit` (barrels a day by default): each share is written in it too. */
input?: 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