Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2021 02 11/tech folder git commands #2

Open
wants to merge 96 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
96 commits
Select commit Hold shift + click to select a range
58662cf
Update home.md
aaronhans Jan 5, 2021
5d91e63
Update site.json
aaronhans Jan 5, 2021
b1a6002
Update site.json
aaronhans Jan 5, 2021
12e106e
test update
aaronhans Jan 5, 2021
77733fd
Delete netlifycms.md
aaronhans Jan 5, 2021
ad99b5c
Update ordering.md
aaronhans Jan 7, 2021
a91a5a3
fix production links
aaronhans Jan 7, 2021
13d3e52
Updating homepage
m-sullivan7 Jan 7, 2021
ae92533
remove spacebook docs
aaronhans Jan 7, 2021
49a4c31
Merge branch 'main' of github.com:cagov/covid19.ca.gov-site-handbook …
aaronhans Jan 7, 2021
fa81bd2
add dev start script
aaronhans Jan 7, 2021
0e0197a
Initial content load
m-sullivan7 Jan 8, 2021
fbf4cac
Changes to make more general
m-sullivan7 Jan 8, 2021
fd030b3
Brief tweak
m-sullivan7 Jan 8, 2021
17b6686
Create content-principles
m-sullivan7 Jan 11, 2021
6f57350
Rename content-principles to content-principles.md
m-sullivan7 Jan 11, 2021
691f69b
Update content-principles.md
m-sullivan7 Jan 11, 2021
fffd1a1
Create content-formatting.md
m-sullivan7 Jan 11, 2021
1c8d9c9
Update content-principles.md
m-sullivan7 Jan 11, 2021
e1a0651
Update content-formatting.md
m-sullivan7 Jan 11, 2021
db28d5a
Create content-types
m-sullivan7 Jan 11, 2021
3669837
Rename content-types to content-types.md
m-sullivan7 Jan 11, 2021
fa9c5b3
Update content-formatting.md
m-sullivan7 Jan 11, 2021
89cffde
Update content-principles.md
m-sullivan7 Jan 11, 2021
eeb748e
Update content.md
m-sullivan7 Jan 11, 2021
acf6ef8
Update content-principles.md
m-sullivan7 Jan 11, 2021
317cd86
Create design.md
thepegisin Jan 11, 2021
07a03de
Update site.json
adam-little Jan 11, 2021
2783852
Merge pull request #1 from adam-little/patch-2
m-sullivan7 Jan 11, 2021
b906ad4
Update content.md
m-sullivan7 Jan 12, 2021
7ad5966
Update content.md
m-sullivan7 Jan 12, 2021
6240204
Update design.md
m-sullivan7 Jan 12, 2021
47d7ecc
Update content-principles.md
m-sullivan7 Jan 12, 2021
00e1195
Update content-formatting.md
m-sullivan7 Jan 12, 2021
3121fce
Update content-types.md
m-sullivan7 Jan 12, 2021
6e532d2
Update content.md
m-sullivan7 Jan 12, 2021
fcdb4c9
Update design.md
m-sullivan7 Jan 12, 2021
3860576
Update home.md
m-sullivan7 Jan 12, 2021
f4fc9dc
Update home.md
m-sullivan7 Jan 12, 2021
0ef78c5
Create design-principles.md
adam-little Jan 12, 2021
53712f4
Update design-principles.md
adam-little Jan 12, 2021
edc01a2
Create design-style-guide.md
adam-little Jan 12, 2021
e207362
Update design-style-guide.md
adam-little Jan 12, 2021
e063796
Update design-style-guide.md
adam-little Jan 12, 2021
28e6f4a
Update design.md
adam-little Jan 12, 2021
40391fd
Update design-principles.md
adam-little Jan 12, 2021
85e59cb
Update design-principles.md
adam-little Jan 12, 2021
8f7b0eb
Update design-style-guide.md
adam-little Jan 12, 2021
594a96b
Update design-style-guide.md
adam-little Jan 14, 2021
8b82779
added some tech pages
aaronhans Jan 15, 2021
1c7f821
Update and rename webcomponents.md to web-components.md
m-sullivan7 Jan 15, 2021
7c96174
Update performance.md
m-sullivan7 Jan 15, 2021
a19ee1d
Update serverless.md
m-sullivan7 Jan 15, 2021
ce5af8e
Update web-components.md
m-sullivan7 Jan 15, 2021
ec31d7f
Update ssg.md
m-sullivan7 Jan 15, 2021
b0f6bb9
Update tech.md
m-sullivan7 Jan 15, 2021
922f436
Update content.md
m-sullivan7 Jan 15, 2021
b2d9d46
Update design.md
m-sullivan7 Jan 15, 2021
459f0c0
Update content-principles.md
m-sullivan7 Jan 15, 2021
9fdeb8a
fix dates
aaronhans Jan 15, 2021
2ee335b
Update site.json
m-sullivan7 Jan 15, 2021
988b526
add bar chart graphic
aaronhans Jan 15, 2021
cbfe29e
add map graphic
aaronhans Jan 15, 2021
02e97a3
add dashboards page
aaronhans Jan 16, 2021
e742e07
add images
aaronhans Jan 16, 2021
b10cd17
Update content-principles.md
thepegisin Jan 20, 2021
6d64bc0
Update content-formatting.md
thepegisin Jan 20, 2021
75b8429
Update content-types.md
thepegisin Jan 20, 2021
2d1113c
Update design-style-guide.md
m-sullivan7 Jan 20, 2021
8f4583c
Update design-principles.md
m-sullivan7 Jan 20, 2021
a32a30b
Update content-formatting.md
m-sullivan7 Jan 20, 2021
5b4b120
Update content-types.md
m-sullivan7 Jan 20, 2021
d662f5b
Update web-components.md
m-sullivan7 Jan 20, 2021
2967758
Update performance.md
m-sullivan7 Jan 20, 2021
d0d60b0
Update ssg.md
m-sullivan7 Jan 20, 2021
c2bdf68
Update serverless.md
m-sullivan7 Jan 20, 2021
d89c413
Update fast-dashboards.md
m-sullivan7 Jan 20, 2021
66d33de
Update design-principles.md
m-sullivan7 Jan 20, 2021
6e9e7a7
Update design-style-guide.md
m-sullivan7 Jan 20, 2021
7b9f393
Update content-formatting.md
m-sullivan7 Jan 20, 2021
cd22516
Update content-types.md
m-sullivan7 Jan 20, 2021
9856c32
Update performance.md
m-sullivan7 Jan 20, 2021
8da4878
update tech homepage text with approved content from Michael
aaronhans Jan 25, 2021
0d268ab
Update content-principles.md
m-sullivan7 Feb 3, 2021
21b839b
Update content-principles.md
m-sullivan7 Feb 3, 2021
1f03cef
Create page-template.md
m-sullivan7 Feb 4, 2021
63095e3
Adding page index screenshot
m-sullivan7 Feb 4, 2021
ba2adfa
Update page-template.md
m-sullivan7 Feb 4, 2021
7c15cbc
Merge pull request #2 from cagov/m-sullivan7-patch-1
m-sullivan7 Feb 4, 2021
f340da4
Update page-template.md
m-sullivan7 Feb 4, 2021
cf5e769
Update page-template.md
m-sullivan7 Feb 4, 2021
4d88b1c
Update page-template.md
m-sullivan7 Feb 4, 2021
c56d8ab
Update content.md
m-sullivan7 Feb 4, 2021
c23ab34
Update content.md
m-sullivan7 Feb 4, 2021
39c8037
Merge pull request #3 from cagov/m-sullivan7-patch-1
m-sullivan7 Feb 4, 2021
45fb3e0
move tech files to their own folder; add git command cheatsheet; add …
chachasikes Feb 12, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added .DS_Store
Binary file not shown.
2 changes: 1 addition & 1 deletion .eleventy.js
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ module.exports = function(eleventyConfig) {
// Leading or trailing slashes are all normalized away, so don’t worry about it.
// If you don’t have a subdirectory, use "" or "/" (they do the same thing)
// This is only used for URLs (it does not affect your file structure)
pathPrefix: (process.env.NODE_ENV == 'production' ? "/spacebook/" : "/"),
pathPrefix: (process.env.NODE_ENV == 'production' ? "/covid19.ca.gov-site-handbook/" : "/"),

markdownTemplateEngine: "liquid",
htmlTemplateEngine: "njk",
Expand Down
16 changes: 8 additions & 8 deletions _data/site.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
{
"name": "Spacebook",
"subtitle": "Create a modern notebook to document or explain almost anything.",
"description": "Create a modern notebook to document or explain almost anything with spacebook.app",
"emoji": "💥",
"footer": "<a href='https://spacebook.app'>Made with ❤ in Minneapolis</a>",
"url": "https://spacebook.app",
"githubUrl": "https://github.com/broeker/spacebook",
"name": "🚧 The California Design Handbook 🚧",
"subtitle": "The future home of the California Design Handbook",
"description": "Resources to create excellent digital experiences across ca.gov",
"emoji": "🚧",
"footer": "🚧 The California Design Handbook 🚧",
"url": "https://github.com/cagov/covid19.ca.gov-site-handbook",
"githubUrl": "https://github.com/cagov/covid19.ca.gov-site-handbook",
"githubBranch": "main",
"enableSearch": false,
"enableDarkMode": true,
"enableEditButton": true,
"enableEditButton": false,
"enableGithubLink": true,
"enableContact": false,
"enableTOC": false,
Expand Down
11 changes: 10 additions & 1 deletion _includes/components/head.njk
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,16 @@
<title>{{ renderData.title or title or site.name }}</title>
<meta name="description" content="{{ metaDescription or renderData.metaDescription or site.description }}">
<link rel="stylesheet" href="https://aaronhans.github.io/spacebook/style.css?v={% version %}"/>
<link rel="icon" href="data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 100 100%22><text y=%22.9em%22 font-size=%2290%22>{{ site.emoji }}</text></svg>">

<!-- temporary style hack since looks like stylesheet is coming from aaron's repo -->
<style>
.prose code {
color: #b94674;
font-weight: 100;
}
</style>

<link rel="icon" href="data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 100 100%22><text y=%22.9em%22 font-size=%2290%22>{{ site.emoji }}</text></svg>">

{% set js %}
{% include "assets/js/inline.js" %}
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"description": "A simple site generator based on Eleventy, Tailwind 2.0, and Alpine.js",
"scripts": {
"start": "NODE_ENV=production ELEVENTY_PRODUCTION=true eleventy --serve & postcss styles/tailwind.css --o _tmp/style.css --watch",
"dev": "NODE_ENV=development ELEVENTY_PRODUCTION=true eleventy --serve & postcss styles/tailwind.css --o _tmp/style.css --watch",
"build": "NODE_ENV=production ELEVENTY_PRODUCTION=true eleventy && postcss styles/tailwind.css --o _site/style.css",
"watch": "npx eleventy --watch",
"debug": "DEBUG=* npx eleventy"
Expand Down
130 changes: 130 additions & 0 deletions pages/Tech/fast-dashboards.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
---
title: Fully accessible dashboards
date: 2021-01-15
permalink: /tech/fast-dashboards/
toc: true
eleventyNavigation:
key: Fully accessible dashboards
order: 26
parent: Tech
---

We set goals for our dashboards in the areas of:

* Accessibility
* Performance
* Reliability
* Maintenance

[California’s commitment to health equity](https://covid19.ca.gov/equity/) is an example of a dashboard that meets our goals. We evaluated several charting tools to find one that helped us to meet our goals. We used D3.js for all the data visualizations on this dashboard.

## Why

The biggest wins using D3 were:

* __Raw performance__: The total weight of the code behind the equity dashboard is < 1% the size of the Tableau code we used on the [state dashboard](https://covid19.ca.gov/state-dashboard/). The rendering time for D3 is very fast compared to Tableau. Here’s a side by side comparison:
<iframe width="560" height="315" src="https://www.youtube.com/embed/xki_Jo0NlM4" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>

* __We exceeded our accessibility standards__: The charts on the equity elements can be tabbed through so they can be used effectively with a screenreader. Dashboards built with tools like Tableau often do not make the visualization itself accessible. Instead they meet legal accessibility requirements with a short text summary outside the data visualization.
* __Complete translations__: D3 allowed us to translate the whole chart, down to the tooltips and labels. This deep translation integration was too difficult to do in dashboards built with other tools.

These are huge upgrades for the end user. Performance, accessibility, or translation failures may make a dashboard unusable for some Californians.

Other benefits of D3 architecture compared to the other tools currently used by state dev teams include:

* Data updates happen completely independently of visual representation code.
* Chart data visualization code is part of the existing front end codebase. This means:
* It requires no additional external services or subscriptions and introduces no new possible points of failure.
* It inherits all existing environment integrations. This lets the code pull from data sets to be reviewed in staging and fully-vetted datasets in production using existing build system variables.
* The chart visualization code is javascript and CSS. This lets any web developer troubleshoot or modify it without new tools or licenses.
* The chart visualization code is checked into the same git repository as the rest of the site. Changes are tracked and standard rollback procedures are available.
* Any desired layout changes happen with the existing publishing workflow. This means existing automated test tools run against the page and chart updates.
* We embed each chart into its own web component. This encapsulates the execution environment into its own class. It can be tested, modified in isolation, or quickly removed by dropping the import statement and custom element.

## How

We use the D3.js javascript library to output svg charts. We encapsulate each chart’s unique code in a web component.

### Web components

We use web components to wrap each of our charts in a separate javascript class. Web components are not required for chart development. Web components are the browser’s built in method of creating custom user interface elements. Web components allow you to define your own HTML tags known as custom elements. You associate your own javascript class with the custom element and the browser will execute a set of events associated with each custom element discovered in markup.

Here’s an example of a custom element:

```<cagov-equity-bar-chart data-url=”https://files.covid19.ca.gov/data/reviewed/equity/social-income.json” />```

The chart data source is passed in as a custom element data attribute and the data URL is defined with environment specific build time logic. All the chart code is inside our component class. It receives a set of component-specific lifecycle events and has access to standard DOM element functions.

Google offers more info on [web components](https://developers.google.com/web/updates/2017/01/webcomponents-org?hl=en).

### D3

There are many similar open source charting libraries. The state has shipped sites using highcharts, there are tons of other lightweight charting tools like chart.js and Frappe.

We chose D3 because it:

* Is open source
* Requires no license to use
* Has a large feature set for its small code footprint
* Has good documentation
* Has a strong community built over years that shares a lot of code and data visualization examples

Most of the js library type charting tools have similar basic feature sets and total code size measured in KB. These charts render much faster for end users than tools like Tableau. While Tableau allows you to drag and drop to create data visualizations, they end up outputting code sizes for users measured in MB.

D3 is often found on sites the Office of the Governor refers to as good examples of dashboards. One leading example is the [LA Times COVID-19 dashboard](https://www.latimes.com/projects/california-coronavirus-cases-tracking-outbreak/). Mapbox also uses D3 for [presenting regional data](https://blog.mapbox.com/how-we-built-usa-todays-election-night-maps-33b8a4b246b1).

#### Intro to D3

A good place to start is the [D3 API reference](https://github.com/d3/d3/blob/master/API.md).

[Observable](https://observablehq.com/) is useful for prototyping because:

* It has a friendly interface where you immediately see the results of code changes
* Anyone can start a data visualization without having to do any local environment scaffolding

It’s also easy to:

* Find prior examples to fork and modify
* Importing data files or external libraries
* Use the sharing feature to send working versions back and forth with anyone

Examples of basic chart functions

* [Bar chart with the background color filled in](https://observablehq.com/@aaronhans/test-background-fill)
* [California map with county boundaries and tooltips](https://observablehq.com/@aaronhans/ca-county-tiers)

Full tutorials

* [Official D3 tutorial from the D3 maintainers](https://observablehq.com/@d3/learn-d3)
* [Nice D3 tutorial walkthrough from square](https://square.github.io/intro-to-d3/)

You can also look at the covid19.ca.gov/equity dashboard chart [source code](https://github.com/cagov/covid19/tree/master/src/js/equity-dash/charts)

### Translations

We integrated a translation pipeline with a human-powered translation service for covid19.ca.gov. Using a javascript charting library that’s part of the page made it easy to integrate all the strings used in the chart labels, legends, and tooltips with the existing site translation services.

This let us deliver a page where each element of the chart is presented in the user’s chosen language. We had never been able to get the translation layer all the way through the data visualization before. The D3-driven charts on covid19.ca.gov/equity/ provide a much better user experience for users of translated versions.

<img src="https://cagov.github.io/covid19.ca.gov-site-handbook/static/img/viet-chart.jpg">

The above screenshot from [California’s commitment to health equity](https://covid19.ca.gov/equity/) shows a chart where all of the internal labels are translated into Vietnamese.

### Accessibility

D3 charts are elements inside the main page document. We are not embedding them inside separate frames. This makes it easier to enable them to be navigable without a mouse.

We are able to use standard HTML accessibility techniques like tabindex and focus events to allow users to tab into chart elements and interact with the data even if they can’t see the chart itself.

Accessibility tips to consider when using D3:
* Make sure the surrounding page passes accessibility audits. This is a first step, but not sufficient to certify the page because automated audit tools can skip over the data visualization itself.
* Run your own accessibility checks by launching screenreaders locally (command+F5 on Mac).
* Add tabindex to the chart elements you want the user to reach if they’re moving through the page without a mouse.
* Use ARIA labels on purely visual elements like the bars of a bar chart.
* Make any mouse-related events triggered with mouseover also fire on focus so that explanatory tooltips are presented to everybody.

### Responsive sizing

The chart outputs we use on equity are vector graphics. This lets the visuals scale crisply in different sizes. Having an element in the page that’s responsive to existing media queries makes the layout less complicated.

This means we have to take extra care to manage the text sizing inside the charts because it scales with the charts. The text can easily get too small. We’ve set up some chart configurations so that they choose maximum sizes appropriate to specific breakpoints.
Loading