(This chart is a part of the d3-charts
collection available here.)
Shows how different parties fall on the spectrum of budget proposals relative to each other and a fabled centre in the middle.
There are three types of values types to display:
If you ever managed a budget in a spreadsheet, you are probably already familiar with denoting these as:
%
$
#
To take an example, say you want have an office with five desks, hire five more people, and as a result, need five more desks at 50 bucks a pop. You could represent this budgeting as:
% | $ | #
-------|-------|----
+100% | +$250 | +5
You can display one or several of these representations as you see fit for your explanatory chart.
(NB: Always remember the difference between per cent and percentage points.)
"Ryan Budget": {
"percentage": 0,
"money": 0
},
"Senate Democrats": {
"percentage": 2.3,
"money": 975000000000
},
"Progressive Caucus": {
"percentage": 14.1,
"money": 3900000000000
}
var thresholdTitle = "Budgets compared",
valueTypes = ["percentage", "money"],
moneyPrefix = "$", // "$", "£", "€"
moneySuffix = "", // "USD", "GBP", "EUR"
quantityNoun = "", // "Jobs", "F-35s"
valueLabel = "none", // "text", "symbol", "none"
useMultipleSymbols = false, // true, false
symbolType = "triangle-down";
// "circle", "cross", "diamond", "square",
// "triangle-up", "triangle-down"
valueTypes
are all the value( type)s you want to display, in the defined order.
They correspond to the value groups in your data, as can be seen in the data example above.
quantityNoun
is a noun for what your quantity number represents; it will be displayed on the chart, so do use short nouns.
valueLabel
displays a label for each value on the bar chart.
useMultipleSymbols
displays the value symbols in different shapes.
symbolType
chooses the shape of all the symbols, if you have set useMultipleSymbols
to false
.
Object.keys()
JavaScript function.Modified http://d3js.org/d3.v3.min.js to a secure url
https://d3js.org/d3.v3.min.js