Code
svg text {
font-family: "Rubik";
font-size: 14px;
font-weight: 300;
}The wish of the project coordination is for all releases to be more uniformly designed and recocnisable as a piece of work related to FIW. This inlucdes the graphs and other content published on the FIW website.
Therefore this guide tries to establish guiding principles in crafting data visualizations for FIW. The overall result should be that the style of the graph fits the website well. If you feel the need to change or add aspects to this styleguide, mail data.science@wifo.ac.at
The examples on this page are written in CSS/JS/HTML in an Observable Notebook via Quarto.
Most importantly, the text should match the rest of the website, which uses Rubik. The font size should be a bit smaller or equal to the rest of the website (14-16px depending on the window width). Notice that the font weight is set pretty thin, which is important for the overall appearance. The most basic CSS for the graph should therefore be:
or for example
Generally speaking, the font is loaded on the website, so setting the css is sufficient. You can find it here or load it with:
The color palette is given by:
colors_fiw = [
"#3e5ba2", // deep blue
"#df5154", // vibrant red
"#4caf50", // green
"#ffb74d", // orange
"#8d6e63", // warm medium brown
"#c2185b", // deep rose
"#0097a7", // teal blue
"#f2f2f2", // gray bg
]
function hexToRgb(hex) {
const bigint = parseInt(hex.slice(1), 16)
const r = (bigint >> 16) & 255
const g = (bigint >> 8) & 255
const b = bigint & 255
return `(${r}, ${g}, ${b})`
}
html`
<div class="logo-container-styleguide">
${colors_fiw.map(color => html`
<div class="swatches">
<div
title="${color}"
style="
margin-bottom: 1em;
width: 24px;
height: 24px;
background-color: ${color};
border: 0.75px solid black;"
>
</div>
<div>${color}</div>
<div>${hexToRgb(color)}</div>
</div>
`)}
</div>`Most importantly, the two main colors of the FIW logo should be included in any colored visualization and the gray color can be used as a background color.
The graph should be rendered as an svg into the DOM. If you have to render many objects, rendering on canvas is acceptable. Make sure the style still applies if you use canvas. Please do not use pixel graphs on the website. These formats suffer from poor responsiveness and adaptability.
Speaking of logos:

The logo of the ministry is (as of now) only available as png. Linking the logo is not desired by the ministry (At least this was the case when working on the FIW Trade Indicator). But inlcuding and linking a small logo bar at the bottom including the involvedinstitutions is also a nice to have feature:
The box and fade effect on hover are styled as:
.logo-container {
padding: 20px;
background-color: #f2f2f2;
border-radius: 6px;
}
.institution-logo:hover {
filter: grayscale(0%);
-webkit-filter: grayscale(0%);
transition: all 0.5s ease-in-out;
transition-property: all;
transition-duration: 0.5s;
transition-timing-function: ease-in-out;
transition-delay: 0s;
}
.institution-logo {
filter: grayscale(100%);
-webkit-filter: grayscale(100%);
transition: all 0.5s ease-in-out;
transition-property: all;
transition-duration: 0.5s;
transition-timing-function: ease-in-out;
transition-delay: 0s;
}
.institution-logo {
margin-right: 12px;
height: 46px;
}More than 50% of all internet traffic today happens via mobile devices. Therefore it is advisable to spend some time adapting designs to typical mobile widths.
The website has major breaking points are at 980px (sizing body to width below and switching font-size from 14px to 16px), 1200px and 1480px where it reaches the final body width. At mobile width sizes, it makes sense to reduce graphical and textual elements: Usability over feature richness is key.
As a general rule of thumb, if it works well on an IPhone SE, iw works well on most devices. If it is not possible to port the graph to a nice mobile view, it is better to hide the visualization and refer to the desktop version.
viewof selectDevice = {
const input = Inputs.radio(
new Map([["Mobile", "mobile"], ["Desktop", "desktop"]]),
{
label: width > 800 ?
htl.html`<span class="icon-monospace">∾</span>Device` :
htl.html`<span class="icon-monospace">∾</span>`,
value: "mobile",
format: x => html`<div class = "button"> ${x[0]}`, // adds class to <div>
disabled: ["no"],
})
input.classList.add("button") // adds class to <radio>
return input
}htl.html`
<div class="mobile-phone" style="width:${selectDevice == "mobile" ? 414 : 1280}px;height:${selectDevice == "mobile" ? 896 : 720}px;">
<iframe src= ${
selectDevice == "mobile" ?
"https://data-science.wifo.ac.at/fiw-data/mobile.html" :
"https://data-science.wifo.ac.at/fiw-data/desktop.html"
}></iframe>
</div>
`Here is a simple example of a button made with Observable Inputs:
viewof myButton = {
const input = Inputs.radio(
width > 800 ? // hide third option on mobile device
new Map([["⇶ Cool", "cool"], ["↺ Uncool", "uncool"], ["⤤ Don't even try", "no"]]) :
new Map([["⇶ Cool", "cool"], ["↺ Uncool", "uncool"]]),
{
label: width > 800 ?
htl.html`<span class="icon-monospace">⟁</span>Buttons` :
htl.html`<span class="icon-monospace">⟁</span>`,
value: "cool",
format: x => html`<div class = "button"> ${x[0]}`, // adds class to <div>
disabled: ["no"],
})
input.classList.add("button") // adds class to <radio>
return input
}They are basically radio elements with a div above with class button styled as
div[class=button] {
position: relative;
display: flex;
align-items: center;
justify-content: center;
}
input[type=radio]{
position: absolute;
visibility: hidden;
align-items: center;
justify-content: center;
}
input[type=radio] + div {
border: 0.75px solid black;
border-radius: 2px;
background: linear-gradient(to top, #d3d3d3 -50%, #FCFCFC 110%);
opacity: 0.50;
cursor: pointer;
min-width: 120px;
height: 24px;
font-size: 14px;
}
input[type=radio]:checked + div {
opacity: 1;
}
input[type=radio]:disabled + div {
opacity: 0.20;
cursor: not-allowed;
}If you look closely at the button element above you can see that the buttons change depending on the width by using JS ifelse condiotions. Another (even better way) to achieve this is by using css. For example:
Since Austrian ministries started requiring more stringent accesibility rules, it is important that FIW also follows these guidelines. Setting alternative texts is a minimum requirement but often lacks behind real barrier-free design. Setting ARIA attributes is better but requires much more time and attention. In any case, a quick visit to the screen reader to check accesibility is recommended.
In general, there is no requirement of using any specific software / librariy to create visualizations on the FIW website, as long as the most important style rules (font and colors) match the website / styleguide here. However, a recommendation would be to use Observable and Vega-Lite with Quarto. See for example the Data Dashboard.
Minimum requirements and a quick “before you publish” checklist that might help: