API Docs for: 0.0.1
Show:

Meteograph Class

Extends Rangegraph
Module: niviz

Visualization of a time series of parameters present in Meteo objects. Multiple such parameters and groups thereof may be displayed simultanously.

Constructor

Meteograph

(
  • data
  • canvas
  • properties
)

Parameters:

  • data Meteo

    Time series of data

  • canvas Object

    A svg element that will be used as SnapSVG paper

  • properties Object

Methods

clip

(
  • start
  • end
)
private

Show a part (or all) of the data within a start and an end date.

Parameters:

  • start Moment

    Start date

  • end Moment

    End date

config

() protected
Configure basic properties of the Rangegraph such as font, margins, height and width

datelabel

(
  • date
)
protected
Draw a date label below the abscissa for any given date

Parameters:

  • date Moment
    Date to be highlighted on the abscissa

desynchronize

(
  • graph
)
protected
Desynchronize this graph with another rangegraph derivate by registering for all the relevant events.

Parameters:

drag

(
  • current
)
protected

Inherited from Rangegraph but overwritten in lib/graphs/meteograph.js:343

Method to be called during dragging on top of cover.

Parameters:

  • current Moment

    Date at current drag position

dragend

(
  • current
  • ms
)
protected

Inherited from Rangegraph but overwritten in lib/graphs/meteograph.js:366

Method to be called at the end of dragging on top of cover.

Parameters:

  • current Moment

    Date at current drag position

  • ms Number

    Duration of drag in ms

draggable

(
  • element
)
private
Drag functions used for zooming when mouse goes down over this.cover, start drawing selection box.

Parameters:

  • element Element
    SnapSVG element to set up with drag functionality

dragstart

(
  • current
)
protected

Inherited from Rangegraph but overwritten in lib/graphs/meteograph.js:355

Method to be called at the start of dragging on top of cover.

Parameters:

  • current Moment

    Date at current drag position

draw

() chainable

Inherited from Graph but overwritten in lib/graphs/meteograph.js:680

Draw the Meteograph and set up the mouse events.

drawgrid

(
  • config
  • heights
  • axis
  • position
)
Object private

Draw the ordinate legend and grid for a specific parameter / parameter group.

Parameters:

  • config Object

    Configuration for a parameter / parameter group

  • heights Array

    Ordinate points to draw grid at

  • axis Axis

    The axis of the ordinate to calculate coords to pixels

  • position String

    'left' if the legend should be placed on the left side

Returns:

Object:

svg group container comprising legend and grid lines

getcurves

() private

Parameters and parameter groups are mashed together in an object called 'curves'. The 'curves' object associates names (e. g. ta or tsurf) with a parameters array.

getpaper

() private
Check if this instance has a valid SnapSVG paper object, in case the size of the canvas element has changed or no paper object is present resize or create the paper object.

griddates

(
  • start
  • end
)
Array private
Given a start and an end date return an array of dates that divide up the range between the start and end date into approximately even intervals

Parameters:

  • start Moment
    Start date of time series
  • end Moment
    End date of time series

Returns:

Array: Array of dates

gridx

() protected
Draw the coordinate system with dotted lines and a frame around it

gridy

() private chainable

Prepare the ordinate axis (axes) that shall have a legend (up to two). Calculate the grid points (call Grid.gridify). Estimate the pixel width of the axis annotation and position the axis label accordingly. Call Meteograph:drawgrid on all legends to be drawn.

header

() private chainable

Draw a header on the left top of the graph.

highlight

(
  • current
)
private

Highlight the current cursor position by adding dots at the x-coordinate of the cursor and display the values for the parameters at that position in the top left corner of the graph (actual drawing of the values is done by Meteograph:legend).

Parameters:

  • current Number

    Index of current data in meteo data array

indices

(
  • startdate
  • enddate
)
private

Given a start and end index (for the data property data in the Meteo object) draw all parameters and parameter groups, removing any previously present curves. In case the start index is not 0 and the end index is not the last index show the resetbutton.

Parameters:

  • startdate Moment

    Start date of range

  • enddate Moment

    End date of range

labelsx

(
  • dates
)
Array private
Given an array of dates, create the respective labels to be shown

Parameters:

  • dates Array
    An array of dates as moment objects

Returns:

Array: Array of strings representing the passed dates

legend

(
  • meteo
)
private

Display the values for the parameters in the graph at the current position of the mouse cursor at the top left corner of the graph.

Parameters:

  • meteo MeteoData

    The meteo object at the current cursor position

mode

(
  • start
  • end
)
String private
Check the size of the date range given.

Parameters:

  • start Moment
    Start date of time series
  • end Moment
    End date of time series

Returns:

String: Categorization of date range as 'years', 'months', 'monthweeks' or 'days'

mousemove

(
  • e
  • canvas
)
private

Inherited from Rangegraph but overwritten in lib/graphs/meteograph.js:320

Method to be called when mousemove event is detected. It calls the method Meteograph:highlight in turn.

Parameters:

  • e Object

    Mousemove DOM event object

  • canvas Object

    offset object

mouseon

(
  • on
)
protected
This method enables/disables the mousemove event on the area spanning the graph. Children may implement the methods mouseout, mousemove and mouseoff to tap into this event.

Parameters:

  • on Boolean
    Whether to turn the mousemove event on or off

mouseout

() protected

Inherited from Rangegraph but overwritten in lib/graphs/meteograph.js:297

Method to be called when mouseout event is detected. Delete the currently displayed date label (unhighlight) and display the date label for the current indicator position, if the indicator is set.

mouseout

() protected

Method to be called when mouse events are turned off.

range

(
  • start
  • end
)
protected
Set the new date range for the abscissa

Parameters:

  • start Moment
    Start date of time series
  • end Moment
    End date of time series

remove

(
  • ctx
  • name
)
protected
Check if the object with identifier name exists in context ctx and try to remove it from the paper and then delete the object itself.

Parameters:

reset

() private

Show all the data from start to end and remove the 'Show all' button.

resetbutton

(
  • show
  • callback
)
protected
Show or delete the resetbutton

Parameters:

  • show Boolean
    true = show button, false = hide button
  • callback Function
    Callback function executed on click

set

(
  • parameters
)
chainable

Set the set of parameters or group of parameters that shall be displayed. The method removes all highlights and curves previously displayed and then triggers a draw with the new set of parameters (and groups).

Parameters:

  • parameters Array

    Array of parameter and group names

setProperties

(
  • properties
)
Overwrite current properties with the ones passed as parameter.

Parameters:

setup

() private chainable

Setup all axes and configurations for all curves in this.curves. Every curve may consist of one or more actual parameters, all configurations for every parameter and an axis for every curve needs to be instantiated.

show

(
  • parameter
  • axis
  • svg
  • start
  • end
)
private

Given an Axis object, draw a single curve for one parameter with its ordinate values calculated on that axis.

Parameters:

  • parameter String

    Name of the parameter to be drawn (not a group)

  • axis Axis

    Axis object, the reference system for the ordinate values

  • svg Object

    group container object to append curve to

  • start Number

    Index of first data point to be displayed

  • end Number

    Index of last data point to be displayed

synchronize

(
  • graph
)
protected
Synchronize this graph with another rangegraph derivate by registering for all the relevant events.

Parameters:

unhighlight

() private

Remove all dots on the curves and the in-graph legend with the values of the parameters at the current cursor position.

Properties

all

Array

Get all selectable parameters and parameter groups