Developer guide / Time series

Compare calendar periods

Line up hours, weekdays, or dates across periods to see where patterns repeat and where they change.

Sample data / Reservations

Monthly booking patterns

Calendar period
Reservations

    Hover over the chart to compare values.

    Heatmap

    Where activity clusters

    Each row is a period. The same controls update the line chart and heatmap.

    Fewer reservationsMore

    Donut charts

    How the year breaks down

    One donut per year, with matching colors for the same month.

    Annual totals · hover a segment for its month and value

    Implementation

    Start with timestamps

    Call calendarCharts() to turn timestamped values into chart options. Pass each returned panel to createChart().

    The live charts use a preview build from source. Use a build that exports calendarCharts to run these snippets.

    JavaScript

    import { calendarCharts, createChart } from "fastplotjs";
    
      const samples = [
        { timestamp: "2026-05-15T08:00:00Z", value: 18 },
        { timestamp: "2026-05-15T12:00:00Z", value: 27 },
        { timestamp: "2026-06-15T08:00:00Z", value: 31 },
      ];
    
      const [panel] = calendarCharts(
        { type: "line", legend: true },
        samples,
        "month",
        "sum",
      );
    
      if (panel) createChart(document.querySelector("#chart"), panel);

    Python

    from fastplotpy import calendarCharts, createChart
    
      samples = [
          {"timestamp": "2026-05-15T08:00:00Z", "value": 18},
          {"timestamp": "2026-05-15T12:00:00Z", "value": 27},
          {"timestamp": "2026-06-15T08:00:00Z", "value": 31},
      ]
    
      panel, = calendarCharts(
          {"type": "line", "legend": True},
          samples,
          "month",
          "sum",
      )
    
      chart = createChart(panel)
      print(chart.serve())

    For JavaScript, add <canvas id="chart" width="800" height="400"></canvas> to the page. To switch periods, call calendarCharts again with the original samples.

    API reference

    Where each value lands

    Calendar boundaries use UTC. Send an ISO date, an ISO timestamp with an explicit offset, or epoch milliseconds.

    PeriodShared slots
    day00:00–23:00 UTC
    weekMonday–Sunday
    monthDay 1–31
    yearJanuary–December
    Sum · default
    Add all observations in each slot.
    Mean
    Average the observations present in each slot.
    Last
    Use the latest timestamp in each slot. Later input order breaks timestamp ties.

    Empty slots stay missing. Line, bar, wonderplot, and polar use one trace per period. Heatmap uses one row per period. Pie and donut each use a separate panel per period. Map uses one panel per populated slot in each period and aggregates separately by coordinate or region ID. The mode supports 2D chart families.