new WindRose(config [, initialise])
Creates a new Wind Rose diagram instance.
Parameters:
| Name | Type | Argument | Default | Description | ||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
config |
object | A configuration object. |
||||||||||||||||||||||||||||||||||||||||||
Properties of
|
||||||||||||||||||||||||||||||||||||||||||||
| Name | Type | Argument | Description |
|---|---|---|---|
svgId |
SVGElement | string | The SVG element to use, or the DOM ID of an SVG element. |
|
weather |
PD.WeatherData |
<optional> |
The weather data to generate the diagram from, defaults to project site data. |
range |
PD.DateTimeRange |
<optional> |
The date/time range to generate the diagram for, defaults to all day over a full year. |
scale |
number |
<optional> |
An optional scale factor for font sizes and line widths (0.01 to 10.0). |
angleBand |
number |
<optional> |
The preferred angle of each band in degrees, defaults to 30deg (12 bands). |
speedBand |
number |
<optional> |
The number of speed segments in each angular band (number or array), defaults to 10 kilometres per hour. |
angleGap |
number |
<optional> |
The relative gap between angular segments (0.0 to 0.5), defaults to 0.05. |
speedGap |
number |
<optional> |
The relative gap between speed segments (0.0 to 0.5), defaults to 0.05. |
useTheme |
boolean |
<optional> |
Whether or not to use the theme styles, defaults to true. |
initialiseWhether or not to initialise the diagram immediately, intended for use by sub-classes.
Throws:
-
Throws an error if provided with an invalid
svgIdelement or id. - Type
- Error
Members
-
:number
angleBand
-
The preferred angle of each band in degrees, defaults to 30deg (12 bands).
This is a preferred angle as its value will automatically be rounded to evenly divide into 360, so that the full circle is divided into equal segments.
Type
- number
-
:number
angleGap
-
The relative gap between angular segments (0.0 to 0.5), defaults to 0.05.
Type
- number
-
:number
id
-
A unique identifier for this diagram.
Type
- number
-
:PD.DateTimeRange
range
-
The date/time range to generate the diagram for.
Type
-
:number|Array.<number>
speedBand
-
The number of speed segments in each angular band (number or array), defaults to 10 kilometres per hour.
Instead of a speed value in km/h, the wind speed band can also be given as an array of wind speed thresholds in kilometers per hour if you need irregular sized speed bands. If you pass an empty array, the speed bands will default to the Beaufort scale.
Type
- number | Array.<number>
-
:number
speedGap
-
The relative gap between speed segments (0.0 to 0.5), defaults to 0.05.
Type
- number
-
:number
speedMax
-
The maximum wind speed in kilometres per hour (1 to 150), defaults to 100 km/h.
Type
- number
-
:SVGElement
svgElem
-
The SVG element to render the diagram to.
Type
- SVGElement
-
:PD.WeatherData
weather
-
The weather data to generate the diagram from.
Type
Methods
-
set(config [, update])
-
Sets the weather data and date/time range of the diagram and updates it.
Parameters:
Name Type Argument Default Description confignumber A configuration object.
Properties of
config:Name Type Argument Description scalenumber <optional>
An optional scale factor for font sizes and line widths (0.01 to 10.0).
weatherPD.WeatherData <optional>
The weather data to generate the diagram from, defaults to project site data.
rangePD.DateTimeRange <optional>
The date/time range to generate the diagram for, defaults to all day over a full year.
fromDaynumber <optional>
The day of the year to start calculating, inclusive (0 to 365/6).
toDaynumber <optional>
The day of the year to end calculating, inclusive (0 to 365/6).
fromTimenumber <optional>
The hour of each day to start calculating, in decimal hours (0.0 to 24.0).
toTimenumber <optional>
The hour of each day to stop calculating, in decimal hours (0.0 to 24.0).
timeStepnumber <optional>
The fractional hour for each calculation step (0 to 1).
sunriseToSunsetboolean <optional>
Whether or not to use daily sunrise and sunset as from/to times, defaults to false.
updateboolean <optional>
true Whether or not to update sun-path diagram if changed.
Returns:
Returns true if anything changed, otherwise false.
- Type
- boolean
-
setDateTimeRange(range [, update])
-
Sets the date/time range of the diagram and updates it.
Parameters:
Name Type Argument Default Description rangePD.DateTimeRange A date/time range object.
updateboolean <optional>
true Whether or not to update sun-path diagram if changed.
Returns:
Returns true if date or time changed, otherwise false.
- Type
- boolean
-
setScale(scale [, update])
-
Sets the scale of detail in the wind-rose diagram and updates it.
This scale is used to adjust the font sizes and line widths relative to the overall size of the diagram.
Parameters:
Name Type Argument Default Description scalefloat The new wind-rose feature scale (0.01 to 2.5).
updateboolean <optional>
true Whether or not to update wind-rose diagram if changed.
Returns:
Returns true if the scale changed, otherwise false.
- Type
- boolean
-
setWeatherData(weather [, update])
-
Sets the weather data the wind rose diagram is based on and updates it.
Parameters:
Name Type Argument Default Description weatherPD.WeatherData A weather data object.
updateboolean <optional>
true Whether or not to update the diagram if changed.
Returns:
Returns true if the weather data changed, otherwise false.
- Type
- boolean
-
show(state)
-
Shows or hides the diagram based on given state.
Parameters:
Name Type Description stateboolean Use true to show, false to hide.
Returns:
Returns this diagram instance to support method chaining.
- Type
- object
-
update()
-
Performs a complete update of the diagram.
This method updates the diagram to reflect the current date, time and location.
Returns:
Returns this Sun-path instance to support method chaining.
- Type
- PD.SVG.SunPath