Professional Documents
Culture Documents
an
as
Mark Bernstein
Copyright
2015 by Eastgate
Tinderboxr"
is a trademark
the property
of Eastgate
of their respective
owners.
account data used here is a work of fiction. All persons,
entirely coincidental.
Table of Contents
1. Actions and Dashboards
3. Collecting
12
23
5. Summarizing
33
Agent Information
Routine Chores
40
7. Progress Bars
47
55
9. Treemaps
60
If you're just getting started with Tinderbox, you might want to read some of
Getting Started With Tinderbox first. You'll find that tutorial in the Tinderbox
Help menu.
Actions can help reduce boring and routine chores, freeing you to
concentrate on matters that do require your full attention. They can help
avoid mistakes and oversights, such as filling in dates or copying routine
metadata. Not every Tinderbox project requires lots of actions. If you find it
easier to do something yourself, there may be no reason to have Tinderbox
do it for you.
Things Change
This tutorial was originally written for Tinderbox 6.3. New versions of
Tinderbox appear frequently, and the version you're using is probably newer.
Nearly 100 official Tinderbox versions have already been released to
customers, and updates arrive frequently.
Details of the sample document may have changed since the screen shots in
this tutorial were captured, and as a result some of the results will differ
numerically from those illustrated here.
Some details discussed here may vary from the version of the program you
are using. Don't worry too much: the underlying principles and concepts still
apply. If you're stuck, feel free to ask on the Tinderbox Forum, or email
Eastgate.
TheProblem
In this tutorial, we '11explore and analyze some expenses incurred during a
fictional business trip. The sample data and analytical tools can be found in a
Tinderbox document you can download from:
http:/ /www.eastgate.com/ download/ ActionsAndDashboards.dmg
In this tutorial, we explore some ways we can use Tinderbox to automate,
analyze, and visualize this rather mundane information. Realistically, you
would be unlikely to want to invest this much care in such mundane and
manageable data, but the same techniques can be applied to your own,
subtler problems.
Suspend your disbelief: If you're confronting problems that don't seem
analogous to those described here, Tinderbox might still be able to help.
Again, ask in the Tinderbox forum, where lots of Tinderbox users welcome
such questions, or email Eastgate.
Other Resources
2.
A LookAtTheData
1 All
the people, places, and institutions mentioned here are fictitious, or are used fictitiously.
Over the course of the following weeks, Nakamura visits a number of cities
across Europe and North Africa, meeting with TK personnel, contractors,
vendors, government officials, heads of charitable foundations and other
stakeholders in order to understand the causes for these problems.
The first, leftmost tab in the example Tinderbox document is simply a list of
expenses incurred during this trip.
e
=- Expense
I=IExpen.. .
Chara ... I~
lnfrastr .. . -
Account. tbx
Status
~-'-~~~~-'-,.-~~___;:_~~~--
ii]
Ed'tec!
Protot...
Chara ...
laBJExpen .. . ~
cities
HTML
Expense Account
T LI
Boston
ti
O ()
Friday, 2'+
April
flight to Paris
Cl
lunch
El
ti
guidebook
[j
maps
T LI
Friday,2lf April
Start Date
ti
Prev iew
4/24/2015, 6:33 PM
power adapter
0
Paris
ti
Saturday, 25 April
Cl
car to hotel
ti
evening dress
Cl
taxi
ti
Sunday,26 April
[j
lunch
...
This list contains three kinds of notes. Each type of note has its own
prototype and appearance:
1. City notes are containers for each major stop in Nakamura's trip. Their
titles are bold.
2. Summary notes briefly outline each day's business, both for mandatory
record-keeping and to provide context to the Account Department when
they come to authorize reimbursement. Their titles use the Sketchnote
font.
3. Expense notes describe one expenditure, explaining who was paid, how
the payment was made, and occasionally providing additional detail for
the benefit of the Accounting or Legal departments. Their titles use plain
font.
Prototypes
Click on the Prototypes tab to see the prototypes used in this document. In
the upper right-hand corner of the map, the adornment named Data
Prototypes contains prototypes used to characterize these expenses:
City
Summary
Draft Summary
Expense
The prototype defines what sort of note each note is. Every expense record
adopts Expense as its prototype, so it's easy to find expenses and separate
them from other notes.
Second, the prototype defines the base appearance of each note. The
distinctive font and color the Summary notes and the bold font of City notes
are inherited from the prototype; we don't need to remember to set these
manually, and have no worries about
accidental inconsistencies.
,.,Expense Account.tbx
~ ~ ~ ~-- =~--~~---~
Edited
~~- -m~ .. ~.
HTML
ncy
rt oate
Preview
10
HTML
Preview
,----------,
Later, we will arrange this Tinderbox document so it automatically performs the currency conversions for us, and fills out many of
these fields automatically. If we expect to have only a few expenses over a short period of time, we could simply fill these out
manually; if we will be using this project daily for months or years, we might eventually decide to automate some of the more tedious
or error-prone chores as we have done in this example.
11
record whether we paid in Euros or Dollars or Swiss Francs. The list of key
attributes helps ensure that we will capture the information we need.
rr2r
Resist the temptation to add unnecessary key attributes. When you are in a hurry, you'll
be tempted to skip over them or to add the data later, but questions that can be answered
today with ease may prove nettlesome to recall next week, or the night before the expense
report is due.
12
Collecting Expenses
The first agent in the Example is named All Expenses, and collects every
note that uses the Expense prototype. In outline view, click on All Expenses
to select it, and click on its disclosure triangle to expand it. Inside the agent,
13
_.___
<>
All Expenses
entire document.
With All Expenses selected, open
the Inspector by choosing Inspector
from the Windows menu. Select the
._ A,...
c.....
t io___
n_,,
l_
ns__
p___
ec_to,...
r_
:E
_x_,,
pe_n_se
_A
_,_
c_c_ou...,
nt
4
Action
Rule
Examples:
$Text.contains{ Lincoln");
$Prototype-=' Person ;
Edict
Sort
Items Found
51
$Prototype=="Expense"
Priority
--- ---
I Normal
14
The unusual operator"==" is the comparison operator, and is true if two things are equal.
We use it here to avoid confusion with the assignment operator"=", which sets the value
of an attribute.
Note that, in the right-hand corner of this pane, Tinderbox displays the
number of notes currently found by this agent.
Sorting Expenses
<>
All Expenses
I
Query
Act ion
Rule
Edict
Sort By
reverse
I StartDate
I~
and by
_ d_o_n_
't _so_rt~
-- -
l_c_a_
se_-s_e_
ns_it1_
've~
_. B_
15
sorting criteria. Be sure that All Expenses is still selected, and click on the
Sort By pulldown menu and select Dollars from the User category, near the
top of the menu. The list is now sorted by expense, starting with a $4.99
downloadable map. Click on the reverse checkbox to invert the sort order;
now, the first item is our costly same-day flight from Boston to Paris.
For convenience, collapse the outline disclosure triangle of All Expenses
before continuing.
<>
Expense Account
Info
17 agents
meals
is our
at a
11 rules
days
Indicates the most recently evaluated rule and
agent. The marker reflects the agent's position
the document outline
on
blue
. I
te
S 1mpeno
Oed icts
in
16
marker gradually moves from left to right as Tinderbox runs agents from the
start of your document to its end, and you can judge from its progress how
much time it takes for Tinderbox to bring all your agents up to date.
Meals
$Prototype==''Expense''
$StartDate
& $Tags.contains(''meal'')
To qualify for this agent, a note must be an expense and it must have the tag
"meal." The ampersand (&) is the logical "and" operator; the query is true if
its left side is true and its right side is also true.
$Tags is a set attribute - a list of labels or "tags," separated by semicolons.
The expression
$Tags.contains(''meal'')
17
Tinderbox knows that if the left side of the & is false, the result must be false and that
there is no need for further work. Knowing this can sometimes make your agents more
efficient.
Again, view the query and sort in the inspector, and expand the agent in
outline view to see which notes it has gathered. It's always a good idea to
examine what your agents find!
$Method=''cash'')
The first clause is true for all notes that are inside the agent All Expenses
inside the container Examples. In this case, we might equivalently have
written
$Prototype==''Expense''
18
but if All Expenses required lots of computing work to finds its results,
inside() lets other agents take advantage of that work without having to
replicate it.
The second clause
($Dollars>1000
$Method==''cash'')
Weekends,
Only
Because a proposed cost-control initiative advocates minimizing business
travel over weekends, we might need to identify expenditures on Saturdays
and Sundays.
Agent: Weekends Only
Query: $Prototype==''Expense''
Sort:
$StartDate
& ( $StartDate.weekday==6l$StartDate.weekday==7)
19
this agent's results by $StartDate for clarity, so expenses from our first
weekend abroad aren't mixed with expenses from our second weekend.
May Day
We might want to locate all expenses from a specific date.
Agent: May Day
Query: $Prototype==''Expense''
Sort:
$StartDate
& $StartDate==date(''5/1/2015''
This is simple enough, but does raise a few tricky issues concerning dates.
First, the date() operator converts strings to dates. The string can be any
date that Tinderbox recognizes, including dates expressed in your
computer's local date preferences. If we were using a computer configured
with British date preferences (in System Preferences:Language and Region),
we'd write "1/5/2015" in conformance with British usage. Alternatively, we
could write "May 1, 2015" in either in the US or 1 May 2015 in the UK.
Second, Tinderbox dates always include a time of day. By convention, the
equality operator ==is true if two dates fall on the same calendar day. If
event A begins on Monday morning and event B begins on Monday
20
== $StartDate(B)
~aking A Timeline
Lise Nakamura's trip is long and complicated, and the Accounting
Department might find it a bit confusing. A timeline can help sort things out.
lvienna
lzurich
!Boston
lstavange r(bycar)
!Marra1<esh
fnearComo
laoston
!Gothenburg
!Torino
!Pars
!London:
Watchfu/Co r,
!Te/Aviv
loijon
4/26/20 15
5/3/20 15
5/ 10/20 15
5/ 17/201 5
All Tinderbox date attributes record a moment in time, including the time of day. When people ask whether two dates are equal,
though, they most often want to know if they refer to the same calendar day, not the same second.
21
Next, we '11focus the view to focus only on the results of this agent. Select
All Cities and choose Focus View
l:l
Paris
l:l
Torino
l:l
London: Watchfu/Con
l:l
Tel Aviv
l:l
22
& $Tags==''''
Only slightly more work is required to locate expenses for meals that aren't
tagged with a particular meal.
Agent: No Meal
& $Tags.contains(''meal'')
Query: $Prototype==''Expense''
& !($Tags.contains(''breakfast'')
I $Tags.contains(''lunch'')
$Tags.contains(''dinner'')
)
The "!" operator is the "not" operator: if what follows it is true, it returns
false.
23
All Expenses:55
Subtitle
Caption
Co lor:
automatic
Alignment:
left
Map
Size:
l 14
n
Hover
Text
A
V
Outline
14
Bold
Strikethrough
Display Expression
$Name+ ": "+$Ch ildCount
II
If a note has no $DisplayExpression, Tinderbox displays the note's $Name. If the note has a $DisplayExpression, Tinderbox
evaluates the expression and displays the result.
24
Display Expression is a formula, a recipe for constructing the name. Don't confuse
the expression with its result. Several notes might have the identical expression but, since
the notes are different, they would display different results.
Counting Notes
The first agent we created in the Examples container collected every Expense
in the document.
Agent: All Expenses
Query: $Prototype== Expense
11
11
$Name+
11
11
:
Sandbox
a place for experimental agents
All Expenses: 55
+$ChildCount
When applied to strings like $Name, the"+" operator joins two strings
together. Thus, Tinderbox starts with the note's $Name, appends a colon,
and then appends the number of children inside the agent.
Alternatively, we might write
25
DisplayExpression:
$ChildCount+''
Expenses''
Total Expense
Rather than reporting the number of expenses, we might be interested in the
cumulative total. Rather than change the agent All Expenses again, we'll
define a new agent.
Agent: Total
Query: inside(/Examples/All
Expenses)
Display Expression: $Name+'': ''+sum(children,$Dollars)
The query simply matches all notes that the agent named "All Expenses" has
found; this is a convenient shortcut that lets agents work together without
duplicating work.
The display expression adds up the value of $Dollars for all the agent's
children, and appends the result to the agent's name. This will display the
total as a number.
Total: 16167
Since we know the result is expressed in our local currency, we might format
it more suitably:
26
Display
Expression:
$Name+'': ''+sum(children,$Dollars).format(''$'')
27
We sort the agent to ensure that the first child is the earliest expense. The
"l" argument to the format() operator formats the date using your locale's
short date format. In the US, the result should look something like this:
Range: 4/25/15
Elsewhere, the date will be formatted according to your system settings
We might display the latest expense, too, changing the display expression to
$Name+'': ''+$StartDate(child).format(''l'')+''-''+$StartDate(lastChild).format(''l'')
28
Expression:
$Name+'': ''
This displays:
Dinners:
The min and max operators require a list of values. We can create a list using
the co 11 ec t () function.
Display
Expression:
$Name+'': ''+collect(children,$Dollars)
....
Tinderbox has gone through each of the agent's children, collected its value
of $Dollars, and appended it to this list. To find the smallest bill, we pass the
list to min():
Display
Expression:
$Name+'': ''+min(collect(children,$Dollars))
29
Dinners: 20.8
As before, we'll format the result as currency.
Display Expression:
$Name+'': ''+min(collect(children,$Dollars)).format(''$'')
which displays:
Dinners: $20.80
Finally, we'll add a dash and then find the largest dinner bill:
Display Expression:
30
Incrementally building and testing complex expressions lets you re.fine your
work in small and simple steps and helps identify mistakes at once.
SummaryTables
In maps, when an agent has located some notes, we
typically see those notes inside the agent.
Sometimes, it's more informative to list those notes
by name, perhaps appending some additional
columns of information we want to see. We can add
a summary table to any container or agent to do this.
For example, select the tab named Status and locate
the agent "missing tags". This agent looks for any Expense reports that have
no tags; because every expense should have some category or explanation,
31
we'll need to locate any unexplained expenses before submitting our report
to the Accounting Department.
<>
missing tags
)@M
Act ion
Rule
Examp es:
$Text contains( Lincoln");
$Prototype=="Person ;
Edict
Sort
Items Found
Z) Case insensitive
Priority
Normal
---
32
IHeading
Name
G] - ll
Expression
$Name
Use Headings
Finally, delete "test expense"; after a few seconds, the note will disappe ar
from the summary table.
[if
33
A Dashboard
Note
The left-hand side of this dashboard has several notes that use the prototype
Dashboard for a distinctive appearance. The Dashboard prototype is located
in the Prototypes folder, and has the following properties:
Color: "3" (matching the background color)
BorderColor: transparent
34
BorderStyle: plain
Shadow: false
SubtitleSize: 75
SubtitleColor: greens
Using the Inspector to set all these parameters for each dashboard note
could be tedious, but prototypes lets notes inherit all these characteristics in
one step, and also let you modify the appearance of all dashboard notes by
changing the prototype.
expenses)
This rule asks Tinderbox to locate the child count of another note - an
agent named "all expenses" inside a container named "Infrastructure" - and
then to store the result in this note's subtitle.
s The color "green" in this document has been defined as #5e8663 - a neutral gray-green.
35
Tinderbox constantly evaluates rules, running the rules for each note until it
reaches the end of the document and then starting over at the document's
beginning6.
transactions
55
Getting The Total
In the upper left-hand corner of the dashboard, we see a
note named "total cost" that adds up the cost of every
expense in the document. Again, we construct a rule
which finds the total cost and stores that cost in Subtitle.
Let's consider how we might write this rule in small and
simple steps.
total cost
42
6 A second kind of rule, called an Edict, is run less frequently than regular rules and is useful when the result of a rule will seldom
change.
This is very simple indeed - it takes the number "42" and stores it in
$Subtitle. Once the rule runs, this dummy value will appear in the dashboard.
(You may need to deselect the note to allow the screen to update.)
We'd like the subtitle to be formatted as currency.
total cost
$42.00
Account),$Dollars).format("$")
total cost
___
11,955.30
37
builds exactly this list, returning the $Path for each note that uses "Expense"
as its prototype. Next, we find the value of $City for each expense:
collect(find($Prototype=''Expense''),
$City)
$City).unique
and, to wrap everything up, we get the size of the remaining list
collect(find($Prototype=''Expense''),
$City).unique.size
cities
14
So, our dashboard note is:
Name: cities
Rule: $Subtitle=collect(find($Prototype=''Expense''),$City).unique.size
38
What is the earliest expense associated with this trip? We already have an
agent /Infrastructure/ all expenses that locates every expense record. It
keeps the expenses sorted by date, so the earliest expense will be that agent's
first child.
$StartDate(child(/Infrastructure/all
expenses))
expenses))
start
expenses))
Finally, we format the date and store the result in the dashboard
note's subtitle.
Name: start
Rule: $StartDate=$StartDate(child(/Infrastructure/all
m/d
$Subtitle=$StartDate.format(
11
11
expenses));
4/24
end
5/7
39
How long have we been away? Our start date is now conveniently available
as
$StartDate(/Status/start)
so we can very easily write a note that reports how long we've
been away from the office.
Name: days
Rule: $Subtitle=days($StartDate(/Status/start),
$StartDate(/Status/end))
days
13
40
41
taxis
inside(/Infrastructure/all
expenses)
$Tags.contains(''taxi''))
$Tags=$Tags+''taxi;transportation''
& ($Name.contains(''taxi'')
The action makes adds the tags "transportation" and "taxi" to the tags of
any expense the agent finds. Since $Tags is a set, duplicate tags are ignored;
if "taxi" or "transportation" - or both - have already been added, the action
leaves them untouched. But if one or both tags were forgotten, this agent
automatically adds them.
Currency Conversion
When we add an expense item, we write down the $Amount we paid and the
$Currency we used. In the US, the value of $Currency will be "$", in the
42
UK, $Currency will be"", in the EU, "". Our company maintains
accounts in dollars, and Ms. Nakamura will want to be reimbursed in dollars;
naturally, we want to be clear and consistent in converting currency
Inside the Infrastructure container, you will find a container named
"currency conversion" that automates conversion of other currency into
dollars. The first agent,"$", simply copies $Amount to $Dollars since no
conversion is needed:
Name: $
Query: inside(/Infrastructure/all
Action:$Dollars=$Amount
expenses)&$Currency=''$''
43
Name: f
Query: inside(/Infrastructure/all
expenses)&$Currency="f"
Action:$D0llars=$Amount*$ExchangeRate(/Config/f)
Similar agents convert Swiss Francs (CHF) and Israeli Shekels (ILS). We
never need to record more than one amount per transaction, and there is no
risk of an accidental mistake or inconsistency when applying conversion
rates.
which is "Boston".
e
L...=
__,_
--'
<>
Boston
Query
ExarnplE. ;iiuolor
'rnd '.
$City=$Name(parent);
$Prototype="Expense";
$Currency
= $Currency(parent);
$StartDate
= $StartDate(prevSibling)
44
Note that these are all initial assumptions, not hard and fast constraints. If
we want the note to be a summary, we can change the prototype from
"Expense" to "Summary". If we want to specify a different date or use a
different currency, we are free to do so. By providing reasonable guesses,
Tinderbox saves time and avoid missing data.
Saving Steps: Initial Values
The City notes in our expense container serve two functions. First, they
organize expenses according to the major stops in our trip, breaking up the
long list of expense records into manageable segments. Second, each City
container has an OnAdd action, inherited from the prototype, which enters
some preliminary guesses about each newly-created note.
OnAdd: $Prototype="Expense";
$City=$Name(parent);
$Currency
$Currency(parent);
$StartDate I= $StartDate(prevSibling)
I=
45
46
Summary, we simply change the prototype for the new note. Tinderbox
might guesses that we had lunch in London, since that's where we are
staying; if we were actually in Oxford, we simply change the City.
47
7. Progress Bars
Inside the Expense Account container, we have three kinds of notes:
Summaries provide narrative context for each day
Cities mark arrivals in each new place
Expenses record individual expenditures
It is clearly desirable to record each expense promptly, while the details are
fresh in our mind. Summaries are indispensable and mandatory, but these
always pose a problem. First, the traveller is frequently exhausted at the end
of the day, and the last thing he or she wants to do is to stay up writing a
narrative for the Accounting department. Second, the key elements from the
day's activities might not always be immediately apparent, and a few day's
perspective may help focus the summary on the most consequential matters.
Nevertheless, the summary is important and ought to be written while
matters remain fresh in our mind. One section of the Status dashboard keeps
track of summaries and draft summaries, reminding us of what has been
done and what remains to do.
Summaries
Bummaries
drafts
6
I
empty
I
short
15 1
short drafts
1
I
empty di afts
0
I
1s
2
I
49
tools, it may be
Color: "6"
Accent Color: "3"
Border Color: black
Border Style: plain
Border Width: narrow
Shadow: off (unchecked)
Progress
42
to match illustration)
50
Prog ress
Expected Progress
Next, select the note named "summaries" and open the Rule pane of the
Action Inspector.
Rule: $Subtitle=find(Prototype="Summary").size
The rule makes a list of all the summary notes in the document, recording the
size of that list in the note's subtitle.
51
,0.
<>
summaries
I
Interior
Pattern
Express ion
Border
Shadow
Bkgnd
I bar
~~~~~~~~--
L---1
$_Su
_b_tit_le______
Minimum
lo
Plot Color
green
Background
lO
white
Maximum
__J
I 1+$Subti11
bar($Subtitle,0, 1+$Subtitle(/
Status/days). toNumber)
52
Spotting Trouble
We might create Summary (or Draft Summary) notes as placeholders,
intending to come back later and flesh them out. The note "empty" finds
summaries with no text:
Rule: $Subtitle=find(Prototype==''Summary''
& $WordCount==0).size
The notes "short" and "short drafts" identify summaries and drafts that are
very short - less than 100 words long.
Rule: $Subtitle=find(Prototype=''Summary''
Setting A Target
It can be difficult to write summaries immediately, but too often we may
return from a long trip to find that we've postponed writing summaries for
53
days on end. This can leads to long evenings of tedium, forgotten details, and
unpleasant memos from the Accounting Department.
The number of draft summaries is a useful indicator that
paperwork is piling up. For this trip, we might attempt a
resolution to keep: we'll try to keep the number of
unfinished drafts down to three or four.
drafts
1a I
The progress bar's target is specified in the Plot Inspector, and may be a
constant number (here it's "4") or an expression. The marker is drawn using
the note's $PlotColor, alternating with the contrasting color from the
progress bar.
Color Coding
Dashboards might want to call attention to problems. In the example above,
we have too many unfinished drafts: we resolved to aim for four drafts at a
time, and we currently have 18.
We can use a rule to change the appearance of notes that require attention.
For example, we could use this three-part rule (in which we've added some
extra space a line-breaks for clarity on the page):
54
$MyNumber=find(Prototype="Draft Summary").size;
$Subtitle=$MyNumber;
if($MyNumber>4){$SubtitleColor="dark bright red"} else {$SubtitleColor=;}
First, as before, we make a list of drafts, count them, and store the result in
$My Number. Next, we copy that result to the subtitle. And third, if the
result shows that we have more than four drafts, we set the subtitle color to
dark bright red; otherwise, the action
$SubtitleColor=;
adds a warning symbol if far too many drafts have piled up.
55
os
CHF
ILS
0
D
MAD
SEK
by currency
!li;?Asa rule, prefer progress bars and histograms to pie charts. The pie chart is generally
overused and is frequently uninformative. In addition, readers are not very skilled at
judging the relative sizes of arcs and wedges, making pie charts hard to read unless the
reader already knows what the chart means to convey. Still, when you need to examine
the proportion of a few categories, pie charts can be a good solution.
56
Query: inside(/Infrastructure/currency
conversion)&$AgentQuery!=""
Note that agents always have an AgentQuery, while regular notes have no
use for one, so locating notes with a query is a good way to locate agents 7
Next, select the "By Currency agent, open
the Appearance Inspector, and select the
Plot pane. Several settings merit noting.
e
'--=
Pattern
Border
Shadow
Bkgnd
pie
Express ion
Minimum
[ auto
Plot Color
Background
Maximum
[ au_to
.__
_
_,
blac k
~ _____
J _
__;;_
----pie(sum(children(orlginal),
$Dollars))
0 $
D t:
CHF
IO I
by currency
Interior
Smart Adornments also have queries, but because agents never examine adornments that need not concern us here ,
57
Os
0
CHF
ILS
0
0
MAD
SEK
by currency
green;lighter
green;darker
green;light
green;black;white;blue
If you change the first color from green to red, the segment for $ will change
color.
58
expenses)
ii
-4
<>
expenses by day
Int erior
Border
Shadow
Minimum
Plot Co lor
green
Back ground
white
bargraph($Dollars,0, 1000)
expenses by day
(lo
59
It might also be helpful to see how the costs are distributed. Are there lots of
expenses for the same amount? Are there anomalous expense reports? The
agent named distribution of expenses helps us keep an eye on these questions.
Agent: distribution
of expenses (log)
Query: inside(/Infrastructure/all
expenses)
Sort:
$Dollars
60
Expense Account
Boston
Paris
London: WatchfulCon
Saturday, 25
flight to
Paris
Sunday,26 April
Draft: Frida
April
D D
,~~
o OyM~C'"
D
I
I
1~D~D
DD
evening dri
~ g,idebook
lp,b ,,ooh I
Ilunch
lunch
dinner
hotel
drinks
I
power adapter
~I
Tel Aviv
Dijon
Monday,
flight: Lor
Ziirich
Tuesday,28
April
n ['""m
Wednesday,6
May
I Vienna
I Draft: Thursday, 7 May
D
DD~
taxi to
dinner
I lunch
taxi to Alliance
Against
Exploitation
May
[workout clothes
Ouarzazate
I lunch
[[ lunch
Gothenburg
[ J -Mm
,
Dratt:1car rental
[Bar Z
I flowers
9. Treemaps
M~
I[ hotel
~D
Draft: Thursday,
1ttM ay
Draft: Friday,15
May
Stavanger
Draft : Saturday, 16
May
I.,.,
..'"'''.
rhotol
Oraft:Wed1Ibreakfast
Torino
IDraft: Saturday, 9 11
0[J[J
Marrakesh
near Como
Wednesd1lunch
II pharmacy
: Holmbrich breakfast (suppl)
Iclinic
~~
D
nft,
r,.,,,,.5M,y
Dnft,
1.,.,.
....
maps
IIflight
I
Boston
IIta xi
I
61
62
Weighted Treemaps
Initially, treemaps apply equal weight to
every note. We can instead tie the area of
each note to that note's properties. For
example, we might make the areas of each
note proportional to the expense it records.
In the treemap tab, note the small "Info" button. Click that button to display
the the treemap popover.
The treemap expression can be any
Treemap Expression:
$Dollars
numerical expression. If a note's
Color Expression:
$Dollars
Start:
1I End:
result is zero or negative, that note is
Border Color:
omitted from the treemap;
otherwise, the note's area will be
roughly proportional to the result and the sum of the results of the note's
descendants.
11
11
1I
63
Expense Account
Boston
London: WatchfulCon
flight to Paris
Oyster
CI registration
dinner
-Idinner I
_[theater
Tel Aviv
flight: London-> Tel Aviv
hotel
-.....
Vienna
clinic
hotel
Paris
I dinner
evening dress
----
l hote-1
~
Dijon
---
Marrakesh
--
hotel
Zurich
~di =
nne=r ~
-~ho~tel----------,
Ouarzazate
dinner
Stavanger
car rental flight
flight
LJL
nea r Como
I[hotel
flowers
Idinner
Torino
~ traffic
fine
64
Note that the daily summaries no longer appear in the treemap; because they
do not record an expense, their $Dollars attribute is zero and they are
omitted. The very-expensive last-minute flight at the start of the trip
occupies a great deal of space; the pre-flight snack and guidebook, which
were accorded equal weight in our first treemap, are now tiny slivers to the
right of the plane ticket.
::::--~
---- -
--.,.....
Color Coding
The color expression can be used to
highlight specific elements in the
treemap. For example, try this color
.
expression:
-----
- --- -- ..
- --~ -
-
..
-_...--~
...
if($Tags.contains(meal)){1}else{0}
Expenses for meals will use the End Color; other expenses will use the Start
Color.
\/e might want to identify transactions that use various currencies. We can
use the same approach to color transactions in currencies other than dollars:
if ($Currency!="$") {1}else{0}
65
Here, if $Currency is not"$" the treemap uses EndColor - light green while if the $Currency is"$" the item uses StartColor - off-white.
Perhaps we want distinct colors for transactions in dollars, euros, and in
other currencies. We could use nested if() statements to accomplish this:
if($Currency=="$"){0}else{if($Currency==""){0.5}
else
{1}}
:0.33;
:0.66;
...
--
default:1"
:0.33;
:0.66;
default:1".at($Currency)
66
To make the result clearer, we use a slightly darker green for EndColor.
Now, transactions denominated in dollars, euros, pounds, and in other
currencies can be identified at a
Paris
glance.
Expense Accom t
Boston
~Dijon
flig ht to Pari s
Zll r1ch
) .at($Currency)
ho tel
dinner
din ner
]L
Como
j
owers
Torino
Ouarzazatle
fligh t
ho tel
IC
Stavanger
flight
re gistration
:J
I- ~
j hotel
car rent al
Vienna
"'~"~'~""""w~,
hotel
flight
Marrakesh
lw"