|
1 | 1 | # Observable Framework examples
|
2 | 2 |
|
3 |
| -*First:* [Get started with Observable Framework](https://observablehq.com/framework/getting-started) |
4 |
| - |
5 |
| -*This repository shows different flavors and features of what you can build with Framework:* |
6 |
| - |
7 |
| -- **API** — Millions of API requests, stored in Arrow format, are analyzed in a report. [[code](./api)] [[live project](https://observablehq.com/framework/examples/api/)] |
8 |
| -- **Chess** — A data loader that retrieves several large zip files from the FIDE, extracts information about the top 10 players, and displays a rank chart. [[code](./chess)] [[live project](https://observablehq.com/framework/examples/chess/)] |
9 |
| -- **EIA** — JavaScript data loaders retrieve hourly data from the U.S. Energy Information Administration API to produce a map and time series charts. [[code](./eia)] [[live project](https://observablehq.com/framework/examples/eia/)] |
10 |
| -- **Google analytics** — Load data from the G.A. API and analyze your website’s traffic. [[code](./google-analytics)] [[live project](https://observablehq.com/framework/examples/google-analytics/)] |
11 |
| -- **Hello, world!** — A minimal test. [[code](./hello-world)] [[live project](https://observablehq.com/framework/examples/hello-world/)] |
12 |
| -- **Plot** — TypeScript data loaders that access metadata from the Observable Plot Github repo. [[code](./plot)] [[live project](https://observablehq.com/framework/examples/plot/)] |
13 |
| -- **Mortgage rates** — A small dashboard reproducing Freddie Mac’s historic mortgage rates dashboard. [[code](./mortgage-rates)] [[live project](https://observablehq.com/framework/examples/mortgage-rates/)][[interactive version](https://observablehq.com/framework/examples/mortgage-rates/interactive)] |
14 |
| -- **Penguin classification** — In a Python data loader, we use logistic regression to predict penguin species based on body size measurements. [[code](./penguin-classification)] [[live project](https://observablehq.com/framework/examples/penguin-classification/)] |
| 3 | +> [!NOTE] |
| 4 | +> To get started with Framework, please read [_Getting started_](https://observablehq.com/framework/getting-started). |
| 5 | +
|
| 6 | +## Showcase examples 🖼️ |
| 7 | + |
| 8 | +### [`api`](https://observablehq.observablehq.cloud/framework-example-api/) - Analyzing web logs |
| 9 | + |
| 10 | +<a href="https://observablehq.observablehq.cloud/framework-example-api/"><img src="../docs/assets/api.webp" alt="Analyzing web logs" width="312" height="237"></a> |
| 11 | + |
| 12 | +[View source](./api) · This report visualizes millions of requests to Observable’s API servers over a 7-day period in January 2024, revealing both traffic patterns and performance characteristics of Observable’s web service. This example showcases the flexibility of Observable Plot for creating custom, performant visualizations, and hints at the potential of Framework’s data loaders for working with large datasets. This example also demonstrates reading [Apache Parquet files](https://observablehq.com/framework/lib/arrow). (While this public example uses static data, at Observable we use [Snowflake data loaders](https://observablehq.observablehq.cloud/framework-example-loader-snowflake/) internally to create a similar live dashboard.) |
| 13 | + |
| 14 | +### [`eia`](https://observablehq.observablehq.cloud/framework-example-eia/) - U.S. electricity grid |
| 15 | + |
| 16 | +<a href="https://observablehq.observablehq.cloud/framework-example-eia/"><img src="../docs/assets/eia.webp" alt="U.S. electricity grid" width="312" height="237"></a> |
| 17 | + |
| 18 | +[View source](./eia) · This dashboard visualizes electricity generation and demand across the U.S. electricity grid. The included data loaders demonstrate how to retrieve live data from the U.S. Energy Information Administration (EIA) API, while the dashboard demonstrates how to produce interactive maps, bar charts, and time-series charts with Observable Plot. A range input allows the user to rewind time to any point in the previous 24 hours, and a table shows details. |
| 19 | + |
| 20 | +### [`plot`](https://observablehq.observablehq.cloud/framework-example-plot/) - Observable Plot downloads |
| 21 | + |
| 22 | +<a href="https://observablehq.observablehq.cloud/framework-example-plot/"><img src="../docs/assets/plot.webp" alt="Observable Plot downloads" width="312" height="237"></a> |
| 23 | + |
| 24 | +[View source](./plot) · This dashboard visualizes the popularity and development of [Observable Plot](https://observablehq.com/plot/), our open-source visualization library. The included data loaders demonstrate how to retrieve data from GitHub and npm APIs, including star counts, releases, downloads, and open issues. A time-series chart shows daily npm downloads with 7- and 28-day moving averages, and a burndown chart shows the age of open issues over time. |
| 25 | + |
| 26 | +### [`mortgage-rates`](https://observablehq.observablehq.cloud/framework-example-mortgage-rates/) - Primary mortgage market survey |
| 27 | + |
| 28 | +<a href="https://observablehq.observablehq.cloud/framework-example-mortgage-rates/"><img src="../docs/assets/mortgage-rates.webp" alt="Primary mortgage market survey" width="312" height="237"></a> |
| 29 | + |
| 30 | +[View source](./mortgage-rates) · This dashboard visualizes Freddie Mac’s historical mortgage rates data. The included data loader demonstrates how to retrieve CSV data from Freddie Mac and visualize the result as a zoomable chart with Observable Plot. The larger time-series line chart at the bottom allows brushing to select an arbitrary time range, while the smaller visualization above zooms to show the selected range. |
| 31 | + |
| 32 | +## Technique examples 🛠️ |
| 33 | + |
| 34 | +### Charts |
| 35 | + |
| 36 | +* [`vega-dark`](https://observablehq.observablehq.cloud/framework-example-vega-dark/) - Responsive dark mode in Vega-Lite |
| 37 | +* [`vega-responsive`](https://observablehq.observablehq.cloud/framework-example-vega-responsive/) - Responsive width in Vega-Lite using ResizeObserver |
| 38 | + |
| 39 | +### Data loaders |
| 40 | + |
| 41 | +* [`loader-arrow`](https://observablehq.observablehq.cloud/framework-example-loader-arrow/) - Generating Apache Arrow IPC files |
| 42 | +* [`loader-databricks`](https://observablehq.observablehq.cloud/framework-example-loader-databricks/) - Loading data from Databricks |
| 43 | +* [`loader-github`](https://observablehq.observablehq.cloud/framework-example-loader-github/) - Loading data from GitHub |
| 44 | +* [`loader-google-analytics`](https://observablehq.observablehq.cloud/framework-example-loader-google-analytics/) - Loading data from Google Analytics |
| 45 | +* [`loader-parquet`](https://observablehq.observablehq.cloud/framework-example-loader-parquet/) - Generating Apache Parquet files |
| 46 | +* [`loader-postgres`](https://observablehq.observablehq.cloud/framework-example-loader-postgres/) - Loading data from PostgreSQL |
| 47 | +* [`loader-snowflake`](https://observablehq.observablehq.cloud/framework-example-loader-snowflake/) - Loading data from Snowflake |
| 48 | + |
| 49 | +### Inputs |
| 50 | + |
| 51 | +* [`custom-input-2d`](https://observablehq.observablehq.cloud/framework-example-custom-input-2d/) - A custom 2D input with bidirectional binding |
| 52 | + |
| 53 | +### Markdown |
| 54 | + |
| 55 | +* [`markdown-it-container`](https://observablehq.observablehq.cloud/framework-example-markdown-it-container/) - The markdown-it-container plugin |
| 56 | +* [`markdown-it-footnote`](https://observablehq.observablehq.cloud/framework-example-markdown-it-footnote/) - The markdown-it-footnote plugin |
| 57 | +* [`markdown-it-wikilinks`](https://observablehq.observablehq.cloud/framework-example-markdown-it-wikilinks/) - The markdown-it-wikilinks plugin |
| 58 | + |
| 59 | +### Other |
| 60 | + |
| 61 | +* [`chess`](https://observablehq.observablehq.cloud/framework-example-chess/) - Loading Zip data from FIDE; creating a bump chart with Observable Plot |
| 62 | +* [`custom-stylesheet`](https://observablehq.observablehq.cloud/framework-example-custom-stylesheet/) - Defining a custom stylesheet (custom theme) |
| 63 | +* [`google-analytics`](https://observablehq.observablehq.cloud/framework-example-google-analytics/) - A Google Analytics dashboard with numbers and charts |
| 64 | +* [`hello-world`](https://observablehq.observablehq.cloud/framework-example-hello-world/) - A minimal Framework project |
| 65 | +* [`intersection-observer`](https://observablehq.observablehq.cloud/framework-example-intersection-observer/) - Scrollytelling with IntersectionObserver |
| 66 | +* [`penguin-classification`](https://observablehq.observablehq.cloud/framework-example-penguin-classification/) - Logistic regression in Python; validating models with Observable Plot |
| 67 | + |
| 68 | +## About these examples |
| 69 | + |
| 70 | +We offer two types of examples: **techniques** and **showcases**. |
| 71 | + |
| 72 | +Technique examples address lower-level needs such as “how to load data from Google Analytics” or “how to make a bump chart”. They’re smaller, piecemeal examples for common development tasks. Technique examples are intended to teach you how to accomplish a specific task and to provide reusable code that can be copy-pasted into your Framework project. |
| 73 | + |
| 74 | +Showcase examples, in contrast, address higher-level user needs such as “how to analyze website traffic” or “how to show the growth of an open-source project”. These larger, complete examples demonstrate how to create useful data apps. Showcase examples are intended primarily to inspire and show Framework’s potential. As applied examples, showcase examples also demonstrate multiple techniques working together; we encourage you to view source. |
| 75 | + |
| 76 | +### How to use these examples |
| 77 | + |
| 78 | +You can browse the source code for any of the examples by navigating to the respective folder on GitHub. You can then copy-paste the code into your own project or download individual files. All of the example code in this repository is covered by the same [open-source license](../LICENSE) as Framework itself. |
| 79 | + |
| 80 | +If you’d like to run (and tinker with) these examples locally, you can [clone the repo](https://docs.github.com/en/repositories/creating-and-managing-repositories/cloning-a-repository) like so: |
| 81 | + |
| 82 | +```sh |
| 83 | +git clone [email protected]:observablehq/framework.git |
| 84 | +``` |
| 85 | + |
| 86 | +Then `cd` into the desired example directory. From there you would typically run `npm install` or `yarn` to install dependencies. Please refer to each example’s `README.md` file for specific instructions; some examples may require additional configuration, such as setting environment variables to talk to external data sources. |
| 87 | + |
| 88 | +### Can’t find what you need? 🧐 |
| 89 | + |
| 90 | +If there’s an example you’d like to see, please let us know by [filing an issue](https://github.com/observablehq/framework/issues). |
| 91 | + |
| 92 | +If you have questions about an existing example, please [open a discussion](https://github.com/observablehq/framework/discussions). |
| 93 | + |
| 94 | +### We welcome contributions! 🤗 |
| 95 | + |
| 96 | +If you have an example that you’d like to share with the community, please [open a pull request](https://docs.github.com/en/pull-requests). Please follow the conventions set by the existing examples and let us know if you have any questions. |
| 97 | + |
| 98 | +Here are some technique examples we’d like to see: |
| 99 | + |
| 100 | +* Visualization |
| 101 | + * Big number with area chart |
| 102 | + * Daily metric chart with moving average |
| 103 | + * Punchcard chart (activity by day of week and hour of day) |
| 104 | + * Bump chart/rank chart |
| 105 | + * Brushing |
| 106 | + * Zooming |
| 107 | +* Data loaders |
| 108 | + * JSZip data loader |
| 109 | + * npm data loader |
| 110 | +* Markdown |
| 111 | + * Inline TeX `$…$` |
0 commit comments