Forma Visuals · Chart your data · Examples

Revenue year over year line chart

This year against last, month by month, so the reader sees where the gap opened. Both years' figures are in the request.

For analysts · Vega-Lite

Try it in the consoleOpen the Vega-Lite editor

The playground allows illustrative values: any number your request does not give, Forma writes, and the answer says generated. Over the API and MCP, that request is refused unless it sets allow_generated_data.

01 The chart

Drawn from the code that came back.

Revenue year over year line chart, drawn from the request below

valid · chart@cb3749b2 · 1 credit · 2026-10-07

Sent with the API's default setting, under which a chart is drawn only from values the request gives.

02 The request

In plain words, with its values.

Line chart of monthly revenue in thousands of dollars, one line for 2024 and one for 2025. month, 2024, 2025: Jan 350 412, Feb 341 398, Mar 372 455, Apr 380 470, May 395 502, Jun 401 489, Jul 410 515, Aug 418 530, Sep 405 498, Oct 430 541, Nov 446 566, Dec 470 612. Keep the months in calendar order. y axis: revenue ($k).

03 What came back

A Vega-Lite spec.

Indented for reading.

Vega-Lite
{
  "$schema": "https://vega.github.io/schema/vega-lite/v6.json",
  "name": "monthly_revenue",
  "data": {
    "values": [
      {
        "month": "Jan",
        "year": 2024,
        "revenue": 350
      },
      {
        "month": "Jan",
        "year": 2025,
        "revenue": 412
      },
      {
        "month": "Feb",
        "year": 2024,
        "revenue": 341
      },
      {
        "month": "Feb",
        "year": 2025,
        "revenue": 398
      },
      {
        "month": "Mar",
        "year": 2024,
        "revenue": 372
      },
      {
        "month": "Mar",
        "year": 2025,
        "revenue": 455
      },
      {
        "month": "Apr",
        "year": 2024,
        "revenue": 380
      },
      {
        "month": "Apr",
        "year": 2025,
        "revenue": 470
      },
      {
        "month": "May",
        "year": 2024,
        "revenue": 395
      },
      {
        "month": "May",
        "year": 2025,
        "revenue": 502
      },
      {
        "month": "Jun",
        "year": 2024,
        "revenue": 401
      },
      {
        "month": "Jun",
        "year": 2025,
        "revenue": 489
      },
      {
        "month": "Jul",
        "year": 2024,
        "revenue": 410
      },
      {
        "month": "Jul",
        "year": 2025,
        "revenue": 515
      },
      {
        "month": "Aug",
        "year": 2024,
        "revenue": 418
      },
      {
        "month": "Aug",
        "year": 2025,
        "revenue": 530
      },
      {
        "month": "Sep",
        "year": 2024,
        "revenue": 405
      },
      {
        "month": "Sep",
        "year": 2025,
        "revenue": 498
      },
      {
        "month": "Oct",
        "year": 2024,
        "revenue": 430
      },
      {
        "month": "Oct",
        "year": 2025,
        "revenue": 541
      },
      {
        "month": "Nov",
        "year": 2024,
        "revenue": 446
      },
      {
        "month": "Nov",
        "year": 2025,
        "revenue": 566
      },
      {
        "month": "Dec",
        "year": 2024,
        "revenue": 470
      },
      {
        "month": "Dec",
        "year": 2025,
        "revenue": 612
      }
    ]
  },
  "title": "Monthly Revenue (2024 vs 2025)",
  "mark": "line",
  "encoding": {
    "x": {
      "field": "month",
      "type": "nominal",
      "axis": {
        "title": "Month"
      },
      "sort": null
    },
    "y": {
      "field": "revenue",
      "type": "quantitative",
      "axis": {
        "title": "Revenue ($k)"
      }
    },
    "color": {
      "field": "year",
      "type": "nominal",
      "sort": null
    }
  }
}

04 When to use it

Where this chart helps.

  • Two years of the same monthly figure, where the question is how this year compares.
  • One line per year keeps the comparison on one axis; for more than three years, the lines start to tangle.
  • Keep the unit in the axis title ($k).