kit

Chart

Built revision v17.10.0

React
Topics

Human support

Bring a missing role, layout, or state, or a rendering against the standard, to the session working on kit. Name the package and the entry.

On Reports

Chart

Bookings by day, 1 to 30 April 2025: 430, up 37 on the previous period
Show as a table
DateBookingsPrevious periodChange
12
10
Up 2
15
13
Up 2
11
12
Down 1
14
12
Up 2
18
15
Up 3
9
8
Up 1
8
9
Down 1
13
11
Up 2
16
14
Up 2
17
15
Up 2
15
16
Down 1
19
17
Up 2
10
9
Up 1
7
8
Down 1
14
12
Up 2
16
15
Up 1
18
16
Up 2
20
18
Up 2
21
17
Up 4
11
10
Up 1
9
8
Up 1
15
14
Up 1
17
15
Up 2
19
16
Up 3
18
17
Up 1
22
19
Up 3
12
11
Up 1
10
9
Up 1
16
14
Up 2
8
13
Down 5
Hirers by week, 1 January to 31 March 2025: 89 new and 108 returning
Show as a table
DateNew hirersReturning hirers
3
5
6
7
4
6
7
8
5
6
8
9
6
8
9
10
7
9
5
7
8
9
10
11
9
10
2
3
Hire income by month, July 2024 to March 2025: £15,610.00
Show as a table
DateHire income
£1,240.00
£1,580.00
£1,910.00
£2,230.00
£2,050.00
£1,320.00
£1,470.00
£1,690.00
£2,120.00
Deposits held by month, July 2024 to March 2025: £5,720.00
Show as a table
DateDeposits held
£620.00
£700.00
£540.00
£810.00
£760.00
£480.00
£530.00
£590.00
£690.00
Bookings
430
Up 37 on the previous period
Show as a table
DateBookings
12
15
11
14
18
9
8
13
16
17
15
19
10
7
14
16
18
20
21
11
9
15
17
19
18
22
12
10
16
8
Cancellations by day, 1 to 30 April 2025: none

No cancellations in this period

Bookings by day, 1 to 30 April 2025:
Show as a table
Hire income by month, July 2024 to March 2025:
Show as a table
Deposits held by month, July 2024 to March 2025:
Show as a table
Source
let reader = Specimen_Reader.reader
let period = (first: KitReact.Time.date, last: KitReact.Time.date) =>
  KitReact.Time.intervals(KitReact.Time.dayRange(reader, ~first, ~last))
let counts = values => values->Array.map(value => KitReact.Amount.count(reader, value))
let pounds = values => values->Array.map(value => KitReact.Amount.money(reader, ~amount=`${Int.toString(value)}.00`, ~currency="GBP"))
let april = () => period({year: 2025, month: 4, day: 1}, {year: 2025, month: 4, day: 30})
let bookings = () => counts([12, 15, 11, 14, 18, 9, 8, 13, 16, 17, 15, 19, 10, 7, 14, 16, 18, 20, 21, 11, 9, 15, 17, 19, 18, 22, 12, 10, 16, 8])
let words = text => [KitReact.Words.Text(text)]

@react.component
let make = () =>
  <>
    <KitReact.Roles.Chart.Trend
      id="react-chart-bookings"
      label="Bookings by day, 1 to 30 April 2025: 430, up 37 on the previous period"
      kind=Line
      intervals={april()}
      ongoing=true
      series=One({name: "Bookings", values: bookings()})
      prior={{name: "Previous period", values: counts([10, 13, 12, 12, 15, 8, 9, 11, 14, 15, 16, 17, 9, 8, 12, 15, 16, 18, 17, 10, 8, 14, 15, 16, 17, 19, 11, 9, 14, 13])}}
      changes={[2, 2, -1, 2, 3, 1, -1, 2, 2, 2, -1, 2, 1, -1, 2, 1, 2, 2, 4, 1, 1, 1, 2, 3, 1, 3, 1, 1, 2, -5]->Array.map(change =>
        words(change < 0 ? `Down ${Int.toString(-change)}` : `Up ${Int.toString(change)}`)
      )}
      empty={words("No bookings in this period")}
    />
    <KitReact.Roles.Chart.Trend
      id="react-chart-hirers"
      label="Hirers by week, 1 January to 31 March 2025: 89 new and 108 returning"
      kind=Columns
      intervals={period({year: 2025, month: 1, day: 1}, {year: 2025, month: 3, day: 31})}
      series=Two(
        {name: "New hirers", values: counts([3, 6, 4, 7, 5, 8, 6, 9, 7, 5, 8, 10, 9, 2])},
        {name: "Returning hirers", values: counts([5, 7, 6, 8, 6, 9, 8, 10, 9, 7, 9, 11, 10, 3])},
      )
      empty={words("No hirers in this period")}
    />
    <KitReact.Roles.Chart.Multiples
      id="react-chart-income"
      trends=[
        {
          label: "Hire income by month, July 2024 to March 2025: £15,610.00",
          kind: Line,
          intervals: period({year: 2024, month: 7, day: 1}, {year: 2025, month: 3, day: 31}),
          series: One({name: "Hire income", values: pounds([1240, 1580, 1910, 2230, 2050, 1320, 1470, 1690, 2120])}),
          empty: words("No hire income in this period"),
        },
        {
          label: "Deposits held by month, July 2024 to March 2025: £5,720.00",
          kind: Line,
          intervals: period({year: 2024, month: 7, day: 1}, {year: 2025, month: 3, day: 31}),
          series: One({name: "Deposits held", values: pounds([620, 700, 540, 810, 760, 480, 530, 590, 690])}),
          empty: words("No deposits held in this period"),
        },
      ]
    />
    <KitReact.Roles.FactGroup>
      <KitReact.Roles.LabelledFact
        name={React.string("Bookings")}
        value={Words([KitReact.Words.Amount(KitReact.Amount.count(reader, 430))])}
        supporting=[{pieces: words("Up 37 on the previous period")}]
        spark={{
          id: "react-chart-bookings-spark",
          label: "Bookings by day, 1 to 30 April 2025: 430, up 37 on the previous period",
          intervals: april(),
          ongoing: true,
          series: {name: "Bookings", values: bookings()},
          empty: words("No bookings in this period"),
        }}
      />
    </KitReact.Roles.FactGroup>
    <KitReact.Roles.Chart.Trend
      id="react-chart-cancellations"
      label="Cancellations by day, 1 to 30 April 2025: none"
      kind=Line
      intervals={april()}
      series=One({name: "Cancellations", values: []})
      empty={words("No cancellations in this period")}
    />
    <KitReact.Roles.Chart.Trend
      id="react-chart-loading"
      label="Bookings by day, 1 to 30 April 2025:"
      total=true
      change=true
      kind=Line
      intervals={april()}
      series=One({name: "Bookings", values: []})
      prior={{name: "Previous period", values: []}}
      empty={words("No bookings in this period")}
      loading="Bookings by day had not loaded."
    />
    <KitReact.Roles.Chart.Multiples
      id="react-chart-income-loading"
      trends=[
        {
          label: "Hire income by month, July 2024 to March 2025:",
          kind: Line,
          intervals: period({year: 2024, month: 7, day: 1}, {year: 2025, month: 3, day: 31}),
          series: One({name: "Hire income", values: []}),
          total: true,
          empty: words("No hire income in this period"),
        },
        {
          label: "Deposits held by month, July 2024 to March 2025:",
          kind: Line,
          intervals: period({year: 2024, month: 7, day: 1}, {year: 2025, month: 3, day: 31}),
          series: One({name: "Deposits held", values: []}),
          total: true,
          empty: words("No deposits held in this period"),
        },
      ]
      loading="Hire income and deposits held had not loaded."
    />
  </>