Skip to content
Varlig Guide
Varlig home

Charts and what-if scenarios

A calc block can draw its own numbers and try other ones. A chart line draws the values it names as a bar or line chart under the block, and a scenario line gives some names other values that you can switch to without editing the note. Both are plain text, so the note still reads well in any Markdown app, and neither is added to a total or to the block’s statistic. The demo note Monthly budget has a chart and a Lisbon scenario to try.

Draw a chart

chart followed by the values to draw, separated by commas, draws a bar chart; the last two may be joined by and. line chart joins the values in order instead, for a series, and bar chart is the same as chart. A label before the chart is its title.

calc
rent = £1,450 gives £1,450.00
food = £420 gives £420.00
transport = £95 gives £95.00
chart rent, food and transport
Monthly costs: line chart rent, food, transport

The chart appears under the block, below its statistic, and redraws whenever a line above it changes. The chart line itself shows no answer; if its values can’t be drawn together, the answer column says why.

Each value can be anything the block could work out at that line: a name, a line reference, a tag’s total or a small calculation of its own. A misspelt name is an error rather than a description:

calc
£12 #food gives £12.00
£30 #food gives £30.00
£15 #fun gives £15.00
chart total of #food, total of #fun, line2 / 2
cinema = £15 gives £15.00
chart cinema, cinmea gives Unsupported: unrecognized calculation at "cinmea"

A comma followed by a space separates two values, so 1,200 and max(a, b) stay whole. To chart a name containing and as the last value, put it in brackets.

What a chart can draw

The values must be amounts of one kind: plain numbers, percentages, money, or measures of one kind, such as distances or durations. Money is drawn in the first value’s currency, converted at the note’s rates, and a measure in the first value’s unit; each value still shows as written. A list is drawn element by element, which suits a line chart:

calc
balances = [1200, 1350, 1100] gives [1,200, 1,350, 1,100]
line chart balances

When a chart can’t be drawn, its answer says why:

calc
rent = £1,450 gives £1,450.00
nap = 45 min gives 45 min
chart rent, nap gives Unsupported: nap (45 min) can't share a chart with rent (£1,450.00)
chart gives Unsupported: name the values to chart, such as chart rent, food

A chart draws up to 100 values, and a value still waiting for live data, such as the weather, is a gap until it arrives.

Try a what-if scenario

scenario, a name, a colon and what it gives one or more names (name = value, separated by commas) describes another way to read the block:

calc
rent = £1,450 gives £1,450.00
food = £420 gives £420.00
scenario Lisbon: rent = £900, food = £350 gives £900.00 · £350.00
scenario Shared: rent = rent / 2 gives £725.00
rent + food gives £1,870.00

As written, a scenario line changes nothing: the other lines answer as before, and the scenario line shows the values its scenario gives.

A block with scenario lines has a Scenario picker: at the top right of the block on a Mac, and at the end of the block’s opening line on iPhone and iPad. It offers As written and each of the block’s scenarios. Choose Lisbon, and the line that first sets each name the scenario gives answers with the scenario’s value, in the color of units, and every line below follows, charts included: here rent + food becomes £1,250.00. The note’s text doesn’t change. The choice is kept on this device only, so your other devices and the people you share the note with still see it as written.

A scenario can change a value rather than replace it, and can read other names, as Shared does with rent = rent / 2. A line further down that sets the name again, such as rent = rent + £50, works from the scenario’s value. Several scenario lines can add to the same scenario, but a name the scenario already gives, or a name no line sets, is an error.

In exports and on Free

Exports read the note as you see it, with the scenario you chose, and say under a block when a scenario gave its answers. PDF, printing and images draw each chart under its block, and HTML draws it as a picture in the page; RTF, Word, EPUB and rich text write the chart’s values as text, such as rent £1,450.00 · food £420.00.

Without Varlig Pro, charts are written as their values in every format, and every note reads as written. The scenario you chose is remembered, and comes back with Pro.