Data Commons Slider Web Component
Data Commons Web Component for controlling the date in datacommons-map.
Usage
<!-- Map being controlled -->
<datacommons-map
[...other map attributes here]
subscribe="event-name-here"
></datacommons-map>
<!-- Slider -->
<datacommons-slider
publish="event-name-here"
variable="variable_dcid"
parentPlace="place_dcid"
childPlaceType="child_place_type_dcid"
></datacommons-slider>
Attributes
Required
Name | Type | Description |
---|---|---|
childPlaceType | string | Child place types of date range. Example: State .dates is specified. |
dates | list | Set date option range. Example: "2001 2002 2003" variable , parentPlace , and childPlaceType are specified. |
parentPlace | string | Parent place DCID of date range. Example: country/USA .dates is specified. |
publish | string | Event name to publish on slider change. |
variable | string | Variable DCID of date range. Example: Count_Person .dates is specified. |
Optional
Name | Type | Description |
---|---|---|
header | string | Override default header text. |
value | number | Initial slider value. |
Advanced Configuration
Name | Type | Description |
---|---|---|
apiRoot | string | Domain to make data fetch API calls from. Used primarily for fetching data from custom DCs. Default: https://datacommons.org . |
Examples
Example 1: Use slider to change dates on a datacommons map web component
Code:
<!-- Listen for date changes on the "dc-year" channel -->
<datacommons-map
header="Population"
parentPlace="country/USA"
childPlaceType="State"
subscribe="dc-map"
variable="Count_Person"
></datacommons-map>
<!-- Publish date changes on the "dc-year" channel -->
<datacommons-slider
publish="dc-map"
variable="Count_Person"
parentPlace="country/USA"
childPlaceType="State"
></datacommons-slider>