Skip to content

Commit

Permalink
Update readme to new chart interface
Browse files Browse the repository at this point in the history
The HTML/JSON interface for creating charts was recently changed. This
updates the readme accordingly. Additionally, this adds missing
documentation about the allowed configuration options.
  • Loading branch information
pluehne authored and larsxschneider committed Jan 22, 2018
1 parent 7d8d3d5 commit b0e0ab5
Showing 1 changed file with 48 additions and 4 deletions.
52 changes: 48 additions & 4 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,58 @@ This web application is built as a [Jekyll](https://jekyllrb.com/) site and is i
### Charts

Each `.html` page in this directory contains one or more charts.
Each chart is defined as an `<svg>` element with a few special attributes that define their behavior:
Charts are dynamically created by [`charts.js`](assets/js/charts.js) from `<div class="chart-placeholder">` placeholders.

#### Structure

Charts generally have the following structure:

```html
<div class="chart-placeholder">
<h3>Title</h3>
<canvas
data-url="{{ site.dataURL }}/chart-data.tsv"
data-type="history"
data-config='{...}'
></canvas>
<div class="info-box">
<p>
Description of the chart.
</p>
</div>
</div>
```

1. `data-url`: a `.tsv` file generated by the [updater](../updater/README.md) (URL to the data file to be rendered by the chart)
1. `class`: the kind of chart that will be rendered (`chart`, `table`, or `collaboration`)
1. `data-type`: the subtype of a chart (`history` or `list`, only applicable if `class` is set to `chart`)
- `<h3>`: the title of the chart (required)
- `<canvas>`: used to configure regular charts; change the tag to `<table>` for tables and `<svg>` for collaboration charts
- `data-url`: the URL to the `.tsv` file that shall be rendered by the chart (generated by the [updater](../updater/README.md))
- `data-type`: the chart type, supported types are:
- `history`: time series charts for tracking metrics over time
- `list`: horizontal bar charts for general numeric data
- `table`: tables directly rendered from the TSV source
- `collaboration`: chord diagrams used to visualize connections between entities
- `data-config`: chart-type-specific configuration options (see [option list below](#configuration-options))
- `<div class="info-box">`: zero or more info boxes with descriptive texts

For details on how each kind of chart is rendered, take a look at [`charts.js`](assets/js/charts.js).

#### Configuration Options

##### History Charts

| option | values | description |
|---|---|---|
| `series ` | array of strings | only include these data series and drop all others (referenced by TSV table headings) |
| `visibleSeries ` | array of strings | only show the listed data series and hide all others initially (referenced by TSV table headings) |
| `sliceData ` | array `[t0, t1]` | slice the data from the TSV file as if `data.slice(t0, t1)` was called |
| `aggregate ` | weekly | if set to `weekly`, aggregate the data by week by computing the sum of the values within each week |

##### List Charts

| option | values | description |
|---|---|---|
| `stacked ` | `true`, `false` | render the data series as stacked bars instead of showing multiple bars per row |

### Development

To run the site locally, install [Jekyll](https://jekyllrb.com/).
Expand Down

0 comments on commit b0e0ab5

Please sign in to comment.