Skip to content

Kagi chart ​

A line that turns only when prices come back far enough; thick above the last high, thin below the last low. Good for trends and reversals of a price, without the noise of small moves.

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

In your framework

import { Chart } from 'nervure/react';

const spec = {
  type: 'kagi',
  data: [
    { label: '1 Jan', close: 119.7 },
    { label: '2 Jan', close: 114.4 },
    { label: '3 Jan', close: 110.8 },
    { label: '4 Jan', close: 104.2 },
    { label: '5 Jan', close: 100.6 },
    { label: '6 Jan', close: 99.9 },
    { label: '7 Jan', close: 95.6 },
    { label: '8 Jan', close: 91.8 },
    { label: '9 Jan', close: 95.9 },
    { label: '10 Jan', close: 101.7 },
    { label: '11 Jan', close: 100.3 },
    { label: '12 Jan', close: 108.1 },
    { label: '13 Jan', close: 101.5 },
    { label: '14 Jan', close: 105 },
    { label: '15 Jan', close: 99.5 },
    { label: '16 Jan', close: 102.5 },
    { label: '17 Jan', close: 104.5 },
    { label: '18 Jan', close: 102.2 },
    { label: '19 Jan', close: 104.9 },
    { label: '20 Jan', close: 110.7 },
    { label: '21 Jan', close: 105.8 },
    { label: '22 Jan', close: 109.1 },
    { label: '23 Jan', close: 107.9 },
    { label: '24 Jan', close: 112.4 },
    { label: '25 Jan', close: 106.4 },
    { label: '26 Jan', close: 107 },
    { label: '27 Jan', close: 108.1 },
    { label: '28 Jan', close: 109.2 },
    { label: '1 Feb', close: 112.3 },
    { label: '2 Feb', close: 115.2 },
    { label: '3 Feb', close: 109.1 },
    { label: '4 Feb', close: 104.6 },
    { label: '5 Feb', close: 100 },
    { label: '6 Feb', close: 102.3 },
    { label: '7 Feb', close: 99.6 },
    { label: '8 Feb', close: 96 },
    { label: '9 Feb', close: 91.1 },
    { label: '10 Feb', close: 93.1 },
    { label: '11 Feb', close: 99.4 },
    { label: '12 Feb', close: 96.9 },
    { label: '13 Feb', close: 101 },
    { label: '14 Feb', close: 96.5 },
    { label: '15 Feb', close: 97.3 },
    { label: '16 Feb', close: 90.6 },
    { label: '17 Feb', close: 86.4 },
    { label: '18 Feb', close: 87.6 },
    { label: '19 Feb', close: 93.3 },
    { label: '20 Feb', close: 86.8 },
    { label: '21 Feb', close: 94.1 },
    { label: '22 Feb', close: 94.6 },
    { label: '23 Feb', close: 96.8 },
    { label: '24 Feb', close: 103.1 },
    { label: '25 Feb', close: 110.6 },
    { label: '26 Feb', close: 104.2 },
    { label: '27 Feb', close: 102.6 },
    { label: '28 Feb', close: 102.4 },
    { label: '1 Mar', close: 106.6 },
    { label: '2 Mar', close: 110.6 },
    { label: '3 Mar', close: 106.8 },
    { label: '4 Mar', close: 103.9 },
    { label: '5 Mar', close: 99.8 },
    { label: '6 Mar', close: 103.2 },
    { label: '7 Mar', close: 98.8 },
    { label: '8 Mar', close: 99.6 },
    { label: '9 Mar', close: 94.5 },
    { label: '10 Mar', close: 100.2 },
    { label: '11 Mar', close: 105.6 },
    { label: '12 Mar', close: 103.2 },
    { label: '13 Mar', close: 106.2 },
    { label: '14 Mar', close: 110.9 },
    { label: '15 Mar', close: 104.1 },
    { label: '16 Mar', close: 100 },
    { label: '17 Mar', close: 95.6 },
    { label: '18 Mar', close: 90.9 },
    { label: '19 Mar', close: 97.9 },
    { label: '20 Mar', close: 92.2 },
    { label: '21 Mar', close: 93.8 },
    { label: '22 Mar', close: 96.1 },
    { label: '23 Mar', close: 99.2 },
    { label: '24 Mar', close: 103.7 },
    { label: '25 Mar', close: 103.4 },
    { label: '26 Mar', close: 99.3 },
    { label: '27 Mar', close: 105.1 },
    { label: '28 Mar', close: 101.4 },
    { label: '1 Apr', close: 98.3 },
    { label: '2 Apr', close: 91.7 },
    { label: '3 Apr', close: 90.2 },
    { label: '4 Apr', close: 86.8 },
    { label: '5 Apr', close: 84.7 },
    { label: '6 Apr', close: 78.5 },
    { label: '7 Apr', close: 77.8 },
    { label: '8 Apr', close: 75.3 },
    { label: '9 Apr', close: 79 },
    { label: '10 Apr', close: 86.6 },
    { label: '11 Apr', close: 89.4 },
    { label: '12 Apr', close: 88.9 },
    { label: '13 Apr', close: 88.6 },
    { label: '14 Apr', close: 91.9 },
    { label: '15 Apr', close: 85.6 },
    { label: '16 Apr', close: 79.3 },
    { label: '17 Apr', close: 79.7 },
    { label: '18 Apr', close: 82.6 },
    { label: '19 Apr', close: 87.6 },
    { label: '20 Apr', close: 87.6 },
    { label: '21 Apr', close: 92 },
    { label: '22 Apr', close: 85 },
    { label: '23 Apr', close: 79.5 },
    { label: '24 Apr', close: 73.1 },
    { label: '25 Apr', close: 70.7 },
    { label: '26 Apr', close: 69.8 },
    { label: '27 Apr', close: 71.6 },
    { label: '28 Apr', close: 78.8 },
    { label: '1 May', close: 74.8 },
    { label: '2 May', close: 79.8 },
    { label: '3 May', close: 83.7 },
    { label: '4 May', close: 89.8 },
    { label: '5 May', close: 96.7 },
    { label: '6 May', close: 94.5 },
    { label: '7 May', close: 95.2 },
    { label: '8 May', close: 99.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 kagi takes:

/** Kagi: a line that turns only when prices come back by `reversal`; thick above the last shoulder, thin below the last waist. */
interface KagiSpec extends Base {
  type: 'kagi';
  data: { label: string; close: number }[];
  /** Move that turns the line: a price, or a share (0.04 = 4 %) with `percent`. */
  reversal?: number;
  percent?: boolean;
  up?: string;
  down?: 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