Menu
Content Services

Premium Long Range Forecast Widget

A widget to display long range forecasts of temperature and precipitation

Installation

script

Example

                              window.dtn.forecast.createPremiumLongRangeForecastWidget({
 


                                
});
                              
                            

Types

Units

type Units = "Imperial" | "Metric";

These are the available metric systems that widget support.

Region

type Region =
    | "NORTH_AMERICA"
    | "EUROPE"
    | "AUSTRALIA"

These are the regions available to view the long range forecast for.

LayerId

type LayerId =
    | "LONG_RANGE_PRECIPITATION"
    | "LONG_RANGE_TEMPERATURE"

These are the available layer's IDs.

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.

units

units?: Units = "Imperial";

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

userId

userId: string;

User name in format: "firstName.lastName".

defaultRegion

defaultRegion?: Region = "NORTH_AMERICA";

Specify which region should be focused on load. This configuration option can take a single Region type.

defaultLayer

defaultLayer?: LayerId = "LONG_RANGE_TEMPERATURE";

Specify which layer should be active on load. This configuration option can take a single LayerId.

Methods

setRegion

setRegion: (region: Region) => void;

Set the widget to the provided region.

setLayer

setLayer: (layer: LayerId) => void;

Set the currently active layer.

Callbacks

onRegionChange

onRegionChange: (region: Region) => void;

This callback is called whenever the region has changed.