API Docs for: 0.0.1
Show:

SimpleProfile Class

Extends TabularProfile
Module: niviz

Visualization of a singular snow profile in a simple way with arrows indicating failed stability tests. A miniature version exists which may be used in combination with a timeline graph.

Constructor

SimpleProfile

(
  • station
  • canvas
  • properties
)

Parameters:

  • station Station

    A niViz station object

  • canvas Object

    A svg element that will be used as SnapSVG paper

  • properties Object

Methods

adapt

() Function private

In case the bargraph is zoomed or resized, the table and curves need to be adapted to the area visible. The adapt method returns a callback function that in turn calls all necessary functions of SimpleProfile and TabularProfile.

Returns:

Function:

A function to be called a

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

      Draws arrows for one or more parameters specified by calling the Visuals:Arrows method.

      Parameters:

      • params Array

        All parameter that require arrow drawing

      • name String

        Name of the svg group to bundle the arrows

      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/simple.js:455

      Configure all properties related to the TabularProfile parent class. This method overrides TabularProfile:config and is called by TabularProfile:draw, TabularProfile:zoom and TabularProfile:arrange.

      configure

      () private

      Configure all properties and axes dependent on canvas size and whether the graph shall be used in miniature or normal mode.

      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
      • 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

        dblclickhandler

        (
        • current
        )
        private

        Parameters:

        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

          (
          • profile
          )

          Inherited from Graph but overwritten in lib/graphs/simple.js:617

          Draw the SimpleProfile by drawing the bargraph.

          Parameters:

          • profile Profile

            The niViz profile to render

          draw_columns

          (
          • partitions
          )
          private
          Draw all columns.

          Parameters:

          • partitions Array< Array >
            All partitions

            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

            graph

            (
            • param
            )
            private

            Callback to graph the currently selected additional parameter. Calculates the constraints and calls this.bargraph.curve.

            Parameters:

            • param String

              Name of parameter active

            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

            hhlabels

            () private

            Draws the hand hardness index labels below the top abscissa.

            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

            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.

              matchfeatures

              () private

              Populate the features array, which will hold all features that are present in both the barparams array and the station's features array

              miniconfig

              () private

              Configure parameters for miniature mode.

              mouseon

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

              next

              () private

              Set this.counter to the next valid additional parameter that a curve or stair case graph shall be drawn for.

              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

                  printDate

                  () private

                  In case the bargraph is in miniature mode print the date of the currently profile in the top right corner.

                  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

                  (
                  • name
                  )
                  static

                  Inherited from TabularProfile but overwritten in lib/graphs/simple.js:101

                  Remove a parameter from the barparams Config SimpleProfile.defaults. This method is invoked by the settings modal when a user removes a parameter from the additional parameters section.

                  Parameters:

                  • name String

                    Paramter name (e. g. ramm, density)

                  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.

                  setbarcfg

                  () private

                  Configure bargraph properties.

                  setcounter

                  () private

                  Set the variable this.counter to a parameter present in the profile by trying to preserve the last selected parameter (e. g. grainsize) which is buffered in the this.lastcounter variable.

                  setParameter

                  (
                  • param
                  )
                  private

                  If a parameter is active in the timeline graph, check whether this parameter also exists as additional parameter in the SimpleProfile. Note: grainshape is mapped to temperature

                  Parameters:

                  • param String

                    Name of parameter active

                  setProperties

                  (
                  • properties
                  )

                  Inherited from TabularProfile but overwritten in lib/graphs/simple.js:128

                  Overwrite current properties with the ones passed as parameter.

                  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: