---
layout: default
title: Embed data and visualizations in your own website
nav_order: 60
has_children: true
published: true
---
# Data Commons Web Components
Embed [Data Commons](https://datacommons.org){: target="_blank"}
[statistical variable](https://datacommons.org/tools/statvar){: target="_blank"} observation
visualizations in your web application.
info
Are you using the Data Commons Web Components?
Sign up for our announcement mailing list to stay up to date with our latest
developments. Join the list by
clicking here, then clicking the “Join group” button.
## Usage
Include `datacommons.js` in your html's
`...` tag. Then use Data Commons
[web component](https://developer.mozilla.org/en-US/docs/Web/API/Web_components){: target="_blank"}
tags (e.g. `datacommons-line`) to add embedded data visualizations.
For example, to embed a line chart:
```html
```
See a live version of this example you can play around with
[here](examples/line-chart.html){: target="_blank"}.
## Components
- [datacommons-bar](/api/web_components/bar)
- [datacommons-highlight](/api/web_components/highlight)
- [datacommons-gauge](/api/web_components/gauge)
- [datacommons-line](/api/web_components/line)
- [datacommons-map](/api/web_components/map)
- [datacommons-pie](/api/web_components/pie)
- [datacommons-ranking](/api/web_components/ranking)
- [datacommons-scatter](/api/web_components/scatter)
- [datacommons-slider](/api/web_components/slider)
## Examples
- [All chart types](examples/all-charts.html){: target="_blank"}
- [A dynamically updating map](examples/dynamic-map.html){: target="_blank"}
- [A styled map](examples/map-styles.html){: target="_blank"}
## Variables and places
Data Commons web components visualize statistical variables about one or more
places. Variables and places are identified by
[Data Commons Identifiers](/glossary.html#dcid), or
[DCID](/glossary.html#dcid)s.
To look up a DCID for an entity or variable, see the different methods described in [this page](/data_model.html#find-dcid).
To find places available for a statistical variable, see [this page](/data_model.html#find-places).
## Styling
Custom styles are supported through
[CSS shadow parts](https://developer.mozilla.org/en-US/docs/Web/CSS/::part){: target="_blank"}.
priority_high
IMPORTANT:
Escape forward slashes in `::part()` names, like in DCIDs.
| CSS `::part` | Description | Components |
| ------------------------------------- | ----------------------------------------------------------------------------------------------------------- | -------------------------- |
| `container` | Chart container element | All |
| `legend` | Chart legend | `bar`, `line`, `map`,`pie` |
| `place-path` | Geo boundary | `map` |
| `place-path-` | Geo boundary for a particular place. Example: `place-path-geoId\/12` \* | `map` |
| `series` | Series data (line, bar, lollipop, etc) | `bar`, `line`. `pie` |
| `series-place-` | Series data for a particular place. Example: `series-place-geoId\/12` \* | `bar`, `line`. `pie` |
| `series-place--variable-` | Series data for a particular place and variable. Example: `series-place-geoId\/12-variable-Count_Person` \* | `bar`, `line` |
| `series-variable-` | Series data for a variable. Example: `series-place-variable-Count_Person` | `bar`, `line`. `pie` |
| `header` | Chart title | All |
| `subheader` | Chart subtitle (if provided in `slot="subheader"`) | All |
| `tools-footer` | Chart footer with `Download`, `API Code`, and `Explore in...` buttons | All |
| `footer` | Custom chart footer (if provided in `slot="footer"`) | All |
| `x-axis` | X-axis line | `bar`, `line` |
| `x-axis-text` | X-axis label text | `bar`, `line` |
| `x-axis-tick` | X-axis tick mark | `bar`, `line` |
| `y-axis-text` | Y-Axis label text | `bar`, `line` |
| `y-axis-tick` | Y-Axis tick mark | `bar`, `line` |
Additionally, the following css variables are supported:
| CSS variable | Description | Default |
| --------------------------- | ---------------------------------------------------------- | ------------------ |
| `--dc-headings-font-family` | Font family for web component headings (`h1` through `h6`) | `Google Sans` |
| `--dc-font-family` | Font family for web component body text | `Google Sans Text` |
### Styling Example
See a live example [here](examples/map-styles.html){: target="_blank"}.
```html
```
## License
[Apache 2.0](https://github.com/datacommonsorg/website/blob/master/packages/web-components/LICENSE){: target="_blank"}
## Support
For general questions or issues, please open an issue on our
[issues](https://github.com/datacommonsorg/website/issues){: target="_blank"} page. For all other
questions, please send an email to `support@datacommons.org`.