Skip to content
This repository has been archived by the owner on Sep 30, 2023. It is now read-only.

Commit

Permalink
Add annotations (#1)
Browse files Browse the repository at this point in the history
* Add support for annotations

Annotations are lines and boxes that show up on
line charts with time axis. They can be used to mark
events and periods.

* Refactor annotations fetching

* Add annotations presence tests

* Add README for annotations

* Adjust charts annotation ui

* Add an ability to override colors

* Allow overriding annotation service

* Clean up rebase
  • Loading branch information
khasinski committed Sep 24, 2023
1 parent b95047b commit 4700101
Show file tree
Hide file tree
Showing 12 changed files with 1,081 additions and 0 deletions.
26 changes: 26 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,32 @@ smart_columns:
status: {0: "Active", 1: "Archived"}
```

### Annotations

Shows overlay lines or box ranges for line queries.

Suppose your sales data and your deployments data, given a query:

```sql
SELECT date_trunc('hour', created_at), sum(value) FROM sales GROUP BY 1
```

You might want to see the influence of a deployment for those sales.

```yml
annotations:
deployments: SELECT date, name FROM deployments WHERE date BETWEEN {min_date} AND {max_date}
```

You can also show periods:

```yml
annotations:
holidays: SELECT min_date, max_date, name FROM holidays WHERE (min_date, max_date) OVERLAPS ({min_date}, {max_date})
```

Conditions for those queries are optional, but they will help to only fetch the relevant annotations for a particular chart.

### Caching

Blazer can automatically cache results to improve speed. It can cache slow queries:
Expand Down
1 change: 1 addition & 0 deletions app/assets/javascripts/blazer/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
//= require ./chartjs-adapter-date-fns.bundle
//= require ./chartkick
//= require ./mapkick.bundle
//= require ./chartjs-plugin-annotation.js
//= require ./ace
//= require ./Sortable
//= require ./bootstrap
Expand Down
Loading

0 comments on commit 4700101

Please # to comment.