new Analemma(config [, initialise])
Creates a new solar declination vs equation of time chart.
Parameters:
| Name | Type | Argument | Description | ||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
config |
object | A configuration object. |
|||||||||||||||||||||||||||||||||||||||||||||||||
Properties of
|
|||||||||||||||||||||||||||||||||||||||||||||||||||
| Name | Type | Argument | Description |
|---|---|---|---|
svgId |
SVGElement | string | The SVG element to use, or the DOM identifier of an SVG element. |
|
sunPos |
PD.SolarPosition |
<optional> |
An optional solar position calculator to use. |
throttledRescale |
number |
<optional> |
The number of milliseconds to throttle calls to |
padding |
Array |
<optional> |
An array of padding pixels in top, right, bottom, left order. |
paddingTop |
number |
<optional> |
The number of padding pixels at the top of the chart, if |
paddingRight |
number |
<optional> |
The number of padding pixels to the right of the chart, if |
paddingBottom |
number |
<optional> |
The number of padding pixels at the bottom of the chart, if |
paddingLeft |
number |
<optional> |
The number of padding pixels to the left of the chart, if |
useGlobalState |
boolean |
<optional> |
A flag indicating that the chart uses global date, time and location, defaults to true. |
useTheme |
boolean |
<optional> |
A flag indicating that the chart uses the global dark/light theme, defaults to true. |
interactive |
boolean |
<optional> |
A flag indicating that the chart should add pointer/touch interactivity, defaults to false. |
initialiseA flag used by subclasses to control initialisation, defaults to true.
Throws:
-
Throws an error if provided with an invalid
svgIdelement or id. - Type
- Error
Members
-
:number
id
-
A unique identifier for this chart.
Type
- number
-
:boolean
interactive <readonly>
-
A flag indicating that the chart uses pointer/touch interactivity.
Type
- boolean
-
:boolean
isAnalemma <readonly>
-
A flag identifying this object as a solar analemma chart.
Type
- boolean
-
:PD.SolarPosition
sunPos
-
An internal solar position calculator.
Type
-
:SVGElement
svgElem
-
The SVG element to render the chart to.
Type
- SVGElement
-
:boolean
usesGlobalState <readonly>
-
A flag indicating that the chart uses global date, time and location.
Type
- boolean
Methods
-
dispose()
-
Cleans up the sun-path and removes all event listeners.
NOTE: Only call this method when the sun-path is no longer needed and you wish to free all its resources.
-
height( [height])
-
Get/set the overall height of the chart, in pixels.
Parameters:
Name Type Argument Description heightnumber <optional>
When provided, this sets the new chart height in pixels.
Returns:
Returns the current chart height in pixels.
- Type
- number
-
paddingBottom( [pixels])
-
Get/set the inset on the bottom side of the chart.
Parameters:
Name Type Argument Description pixelsnumber <optional>
When provided, this sets the number of pixels the chart axis is indented from the parent container edge on the bottom side.
Returns:
Returns the current bottom padding in pixels.
- Type
- number
-
paddingLeft( [pixels])
-
Get/set the inset on the left side of the chart.
Parameters:
Name Type Argument Description pixelsnumber <optional>
When provided, this sets the number of pixels the chart axis is indented from the parent container edge on the left side.
Returns:
Returns the current left padding in pixels.
- Type
- number
-
paddingRight( [pixels])
-
Get/set the inset on the right side of the chart.
Parameters:
Name Type Argument Description pixelsnumber <optional>
When provided, this sets the number of pixels the chart axis is indented from the parent container edge on the right side.
Returns:
Returns the current right padding in pixels.
- Type
- number
-
paddingTop( [pixels])
-
Get/set the inset on the top side of the chart.
Parameters:
Name Type Argument Description pixelsnumber <optional>
When provided, this sets the number of pixels the chart axis is indented from the parent container edge on the top side.
Returns:
Returns the current top padding in pixels.
- Type
- number
-
refresh()
-
Regenerates the whole chart from scratch.
Returns:
Returns this chart instance to support method chaining.
- Type
- object
-
rescale( [instant])
-
Initiates a rescaling of the chart when it has changed size or shape.
The maximum frequency at which this method will actually rescale the chart is governed by the 'throttledRescale' property.
Parameters:
Name Type Argument Default Description instantboolean <optional>
<nullable>
false An optional flag to make the rescale immediate even if debounced, defaults to false.
-
set(config)
-
Sets one or more configuration values for the chart.
Parameters:
Name Type Description configobject An object containing one or more configuration settings.
Returns:
Returns this chart instance to support method chaining.
- Type
- object
-
show(state)
-
Shows or hides the chart based on given state.
Parameters:
Name Type Description stateboolean Use true to show, false to hide.
Returns:
Returns this chart instance to support method chaining.
- Type
- object
-
throttledRescale( [ms])
-
Get/set the timer value for throttling calls to the
rescale()method.This basically means that multiple calls to the
rescale()method that occur within the specified number of milliseconds will be amalgamated to a single call that occurs at the end of that period.Parameters:
Name Type Argument Description msnumber <optional>
When provided, this sets the throttling time, in milliseconds. Any value less than 5ms effectively turns off throttling.
Returns:
Returns the current throttling time in milliseconds.
- Type
- number
-
update()
-
Regenerates just the date indicator.
Returns:
Returns this chart instance to support method chaining.
- Type
- object
-
width( [width])
-
Get/set the overall width of the chart.
Parameters:
Name Type Argument Description widthnumber <optional>
When provided, this sets the new chart width in pixels.
Returns:
Returns the current width in pixels.
- Type
- number