Menu
Content Services

Premium Weather Trend Widget

Displays historical and forecast weather trend data.

Installation

script

Example

                              window.dtn.localWeather.createPremiumWeatherTrendWidget({
 


                                
});
                              
                            

Types

Units

type Units = "Imperial" | "Metric";

These are the available metric systems that widget support.

Coordinates

type Coordinates = { latitude: number, longitude: number };

This type describe coordinates data that may be used to supply the defaultLocation property.

PostalCode

type PostalCode = { postalCode: string };

This type describe postal code data that may be used to supply the defaultLocation property.

StationId

type StationId = string;

This type describe station id data that may be used to supply the defaultLocation property.

Station

type Station = { id: StationId, displayName: string };

This type describe station data that is needed in stations array property.

WeatherFields

type WeatherFields = 
 | "AVERAGE_TEMPERATURE" 
 | "AVERAGE_FEELS_LIKE" 
 | "AVERAGE_HUMIDITY" 
 | "AVERAGE_PRESSURE" 
 | "AVERAGE_DEW_POINT" 
 | "AVERAGE_WIND_SPEED" 
 | "EVAPOTRANSPIRATION" 
 | "GROWING_DEGREE_DAY" 
 | "MAXIMUM_TEMPERATURE" 
 | "MINIMUM_TEMPERATURE" 
 | "MINUTES_OF_SUNSHINE" 
 | "SOIL_DEPTH_AVERAGE_TEMPERATURE" 
 | "SOIL_DEPTH_AVERAGE_MOISTURE";

These are the available weather fields that widget supports.

Configuration

apiKey

apiKey: string;

The widget access api key associated with your DTN account.

container

container: HTMLElement | string;

The container to mount the widget on. This can be a reference to an HTML element, or a valid selector string. If a string is encountered, document.querySelector will be used to search document for the container.

userId

userId: string;

User name in format: "firstName.lastName".

units

units?: Units = "Imperial";

The measuring units that are used for presenting numbers in the weather forecast.

defaultLocation

defaultLocation?: PostalCode | Coordinates | { stationId: StationId };

If { postalCode: "postal code value" } object is passed in the configurations, the composite widget will be default populated with the data fetched by the specified postal code. If { stationId: "station id value"} object is passed in the configurations, the composite widget will be default populated with the data fetched by the station Id. If { latitude: "latitude coordinates value", longitude: "longitude coordinates value"} object is passed in the configurations, the composite widget will be default populated with the data fetched by the specified latitude and longitude.

weatherfield

weatherfield: WeatherFields

Set the default weatherfield

weatherFields

weatherFields?: WeatherFields[]

Specify the order of fields.

showWeatherVariables

showWeatherVariables?: boolean | WeatherFields[] = true

The fields that can be turn ON/OFF from current conditions listed field. Default set to true.

Methods

setLocation

setLocation: (
  location: PostalCode | Coordinates | { stationId: StationId }
) => void;

Set location and load the widget with it.