API Docs for: 0.0.1
Show:

SLFProfile Class

Extends TabularProfile
Defined in: lib/graphs/slf.js:37
Module: niviz

Visualization of a singular snow profile SLF style.

Constructor

SLFProfile

()

Methods

add

(
  • object
  • [position]
)
private
Add a column to the table for a certain parameter.

Parameters:

  • object Object
    An object with a width and parameter property
  • [position] Number optional
    Where to insert the column. Default: at the end.

align

(
  • partitions
)
Array< Array > private
Once the zoomed primary partition has been subjected to layout adjust all other partitions to represent the initial relations.

Parameters:

  • partitions Array< Array >

    Returns:

    Array< Array >: Partitions in zoomed range.

    arrange

    (
    • partitions
    )
    private
    Initially (without zooming) arrange all the layers in the table by first allocating enough space for the primary (first) column to be rendered and then increasing the table size in case more space is needed for later columns.

    Parameters:

    • partitions Array< Array >

      arrows

      (
      • params
      • name
      )
      private

      Draw the arrows for the parameters passed.

      Parameters:

      • params Array

        The parameters to be drawn

      • name String

        Name for the svg group container, that will hold the arrows

      • buildpopup

        (
        • paper
        • p
        • text
        • x
        • y
        )
        private

        Build the popup for the temperature / gradient curve.

        Parameters:

        • paper Object

          SnapSVG paper object

        • p Object

          Properties object

        • text String

          Popup text

        • x Number

          Popup position x-coordinate

        • y Number

          Popup position y-coordinate

        clear

        () private

        Delete the hs, datesmall and layerlines elements.

        comment

        () private

        Draw the comment box on the graph.

        commentstxt

        (
        • paper
        • p
        • center
        • txt
        • layer
        • offsetx
        • width
        • height
        • lindex
        )
        Object private
        Render the cell text for the comments type.

        Parameters:

        • paper Object
          SnapSVG paper
        • p Object
          Properties object
        • center Object
          Pixel coordinates used for positioning
        • txt Object
          Font object
        • layer Value
          The layer object,
        • offsetx Value
          The x-coord at the left of the column
        • width Value
          Max-width number of fontsizes
        • height Value
          Height of the cell in pixel
        • lindex Number
          Layer index (for cross referencing)

        Returns:

        Object: svg group container

        config

        () private

        Inherited from TabularProfile but overwritten in lib/graphs/slf.js:102

        Configure basic properties of the SLFProfile and the parent class TabularProfile such as font, table margins, height and width.

        connect

        (
        • partition
        • offset
        )
        private
        Connect table and graph through dotted lines and store reference in an object called this.blanket to later reference the individual lines.

        Parameters:

        • partition Array
          Primary partition, to be connected to graph
        • offset Number
          Pixel position of the right edge of the graph
        • coordsys

          () private

          Draw the coordinate system

          cttxt

          (
          • paper
          • p
          • center
          • txt
          • layer
          )
          Object private
          Render the cell text for the CT parameter.

          Parameters:

          • paper Object
            SnapSVG paper
          • p Object
            Properties object
          • center Object
            Pixel coordinates used for positioning
          • txt Object
            Font object
          • layer Value
            The flags value object

          Returns:

          Object: svg group container

          destroy

          ()

          Deregister events

          directlayout

          (
          • partition
          • data
          )
          private
          For parameters that are not layed out relatively to the primary partition: directly place them at the actual height of the layer

          Parameters:

          • partition Array
            The partition (column) to be layed out
          • data Feature
          • draw

            ()

            Inherited from Graph but overwritten in lib/graphs/slf.js:815

            Draw the SLFProfile and set up the mouse events.

            draw_block

            (
            • parameter
            • color
            • name
            )
            private

            Draw a parameter of the profile as a staircase graph.

            Parameters:

            • parameter String

              The profile parameter (e. g. ramm)

            • color String
            • name String

              The name of the value of the parameter to be drawn (e. g. value)

            draw_columns

            (
            • partitions
            )
            private
            Draw all columns.

            Parameters:

            • partitions Array< Array >
              All partitions

              draw_curve

              (
              • parameter
              )
              private

              Draw a parameter of the profile as a curve.

              Parameters:

              • parameter String

                The profile parameter (e. g. temperature, gradient)

              draw_lower_legend

              (
              • parameter
              )
              private

              Draw legend for the curve (temperature/gradient) at the bottom of the graph.

              Parameters:

              • parameter String

                The profile parameter (e. g. temperature, gradient)

              ecttxt

              (
              • paper
              • p
              • center
              • txt
              • layer
              )
              Object private
              Render the cell text for the ECT parameter.

              Parameters:

              • paper Object
                SnapSVG paper
              • p Object
                Properties object
              • center Object
                Pixel coordinates used for positioning
              • txt Object
                Font object
              • layer Value
                The flags value object

              Returns:

              Object: svg group container

              flags

              (
              • offset
              • data
              )
              private
              Draw a column header for the yellow flags feature.

              Parameters:

              • offset Number
                Pixel position
              • data Feature

              flagstxt

              (
              • paper
              • p
              • center
              • txt
              • layer
              • offset
              )
              Object private
              Render the cell text for the flags parameter. Either asterisks or flags.

              Parameters:

              • paper Object
                SnapSVG paper
              • p Object
                Properties object
              • center Object
                Pixel coordinates used for positioning
              • txt Object
                Font object
              • layer Value
                The flags value object
              • offset Number
                The column offset

              Returns:

              Object: svg group container

              format

              (
              • textbox
              • current
              • addendum
              )
              String private

              Actually add the addendum string by making sure it doesn't transgress the boundaries of the textbox.

              Parameters:

              • textbox Object

                svg text element

              • current String

                The current comment string

              • addendum String

                Text string to be added

              Returns:

              String:

              The altered comment string

              header

              (
              • offset
              • options
              • data
              )
              private
              Draw a column header at the position specified by offset.

              Parameters:

              • offset Number
                Pixel position
              • options Object
                Holds the symbol and unit properties
              • data Feature

              highlight

              (
              • y
              )
              private
              Highlight the table row that spans the passed y-coordinate pixel. Draw snow height label (this.hs()), if applicable.

              Parameters:

              • y Number
                y-coordinate as pixel value

              hs

              (
              • snowheight
              )
              protected

              Display the snow height label.

              Parameters:

              index

              (
              • y
              )
              Number private
              This method returns the reference to the blanket object that spans the given y-coordinate - or undefined if no table row matches the y-coordinate.

              Parameters:

              • y Number
                y-coordinate as pixel value

              Returns:

              Number: key of this.blanket object to reference actual object

              layout

              (
              • partitions
              )
              Array< Array > private
              Layout the primary partition in zoomed state.

              Parameters:

              • partitions Array< Array >

                Returns:

                Array< Array >: Partitions in zoomed range.

                loadcolumns

                () private
                Set all possible columns of the table. These consist of the fixed columns for stratigraphic parameters and some configured by the user.

                mousemove

                () Boolean private

                Method to be called when mousemove event is detected. It calls the method SLFProfile:show in turn and deals with the comment box.

                Returns:

                Boolean:

                on Turn mouse events on

                mouseon

                () private
                This method enables the mousemove event on the area spanning the table.

                partition

                (
                • partition
                • data
                • height
                )
                Number private
                Primary (first existant) column layout. If there is too little space to fit the column layers than a value >0 is returned. The canvas needs to be resized appropriately.

                Parameters:

                • partition Array
                  The primary (column) to be layed out
                • data Feature
                • height Number
                  The minimal height of a table row
                • Returns:

                  Number: Number of pixels to enlarge the canvas

                  position

                  (
                  • partitions
                  • index
                  • primeindex
                  • data
                  • height
                  )
                  Number private
                  Position another column relatively to the primary partition.

                  Parameters:

                  • partitions Array< Array >
                    All partitions
                  • index Number
                    Index of partition to be positioned
                  • primeindex Number
                    Index of primary partition
                  • data Feature
                  • height Number
                    The minimal height of a table row
                  • Returns:

                    Number: Number of pixels to enlarge the canvas

                    print

                    (
                    • param
                    • lbl
                    • box
                    • current
                    )
                    String private

                    Print the stability test ECT and CT (comment section).

                    Parameters:

                    • param String

                      Name of string within the txt object

                    • lbl String

                      The label for the current text block

                    • box Object

                      svg text element

                    • current String

                      The current comment string

                    Returns:

                    String:

                    The altered comment string

                    rbtxt

                    (
                    • paper
                    • p
                    • center
                    • txt
                    • layer
                    )
                    Object private
                    Render the cell text for the Rutschblock parameter.

                    Parameters:

                    • paper Object
                      SnapSVG paper
                    • p Object
                      Properties object
                    • center Object
                      Pixel coordinates used for positioning
                    • txt Object
                      Font object
                    • layer Value
                      The flags value object

                    Returns:

                    Object: svg group container

                    remove

                    (
                    • column
                    )
                    private
                    Remove a column from the table.

                    Parameters:

                    • column Number

                      The column index to remove

                    select

                    () Array< Array > private
                    Select all layers in all partitions that are within p.table.min and p.table.max.

                    Returns:

                    Array< Array >: Partitions in zoomed range.

                    setProperties

                    (
                    • properties
                    )

                    Inherited from TabularProfile but overwritten in lib/graphs/slf.js:91

                    Overwrite current properties with the ones passed as parameter.

                    Parameters:

                    setup

                    () private

                    Configure the axes for hs, hardness, temperature and the gradient parameters.

                    shiftdown

                    (
                    • partitions
                    • primeindex
                    • primepos
                    • index
                    • shift
                    • height
                    )
                    private
                    Shift down all partitions already layed out up until a certain partition and layer height.

                    Parameters:

                    • partitions Array< Array >
                      All partitions
                    • primeindex Number
                      Index of primary partition
                    • primepos Number
                      Only shift down below this height of the primary partition
                    • index Number
                      Index up to which shifting may occur (i. e. currently positioned)
                    • shift Number
                      Number of pixels to shift down
                    • height Number
                      Minimal height of a row
                    • show

                      (
                      • x
                      • y
                      )
                      private

                      Draw the popup for the temperature or gradient curve (whichever is present) if mouse cursor is close to or on data point of the curve.

                      Parameters:

                      slope

                      (
                      • x
                      • y
                      • svg
                      )
                      private
                      Draw the slope angle at the bottom of the table and display exposition.

                      Parameters:

                      stbtxt

                      (
                      • paper
                      • p
                      • center
                      • txt
                      • layer
                      )
                      Object private
                      Generic rendering for stability types.

                      Parameters:

                      • paper Object
                        SnapSVG paper
                      • p Object
                        Properties object
                      • center Object
                        Pixel coordinates used for positioning
                      • txt Object
                        Font object
                      • layer Value
                        The flags value object

                      Returns:

                      Object: svg group container

                      table

                      () protected
                      A closure that provides the property this.table().width to get the exact width of the table.

                      testorder

                      (
                      • test
                      )
                      Array private

                      Check if the passed stability test is ordered and if so return the ordered sequence.

                      Parameters:

                      • test Feature

                        CT or ECT

                      Returns:

                      Array:

                      The sequence of tests

                      testprint

                      (
                      • box
                      • current
                      )
                      String private

                      Print the stability test ECT and CT (comment section).

                      Parameters:

                      • box Object

                        svg text element

                      • current String

                        The current comment string

                      Returns:

                      String:

                      The altered comment string

                      toggle

                      () private

                      Toggle between gradient and temperature curve.

                      toString

                      (
                      • value
                      • type
                      • offset
                      • y
                      • width
                      • height
                      • layer
                      )
                      Object private
                      Draw the text of the current layer and column, depending on the type of paramater different renderings are required.

                      Parameters:

                      • value Value
                        The current value
                      • type String
                        The parameter name
                      • offset Number
                        Pixel offset of the current table column
                      • y Number
                        Pixel y-coordinate of the layer top
                      • width Number
                        Column width
                      • height Number
                        Row height
                      • layer Number
                        Layer index (for cross-reference)

                      Returns:

                      Object: svg group container

                      unhighlight

                      () private
                      Remove any highlights and the snow height label, if there is one.

                      y

                      (
                      • y
                      )
                      Number private
                      Get the pixel value for a given snow height.

                      Parameters:

                      Returns:

                      Number: Pixel value

                      zoom

                      (
                      • range
                      )
                      protected
                      Zoom in on a certain snow height range.

                      Parameters:

                      • range Object
                        An object with a min, max and axis property