Datum class

The Datum class gives you access to datums in T/HIS. More...

The T/HIS JavaScript API provides many class constants, properties and methods. For Arup to be able to extend and enhance the API in the future any constant, property or method names beginning with a lowercase or uppercase letter are reserved.
If you need to add your own properties or methods to one of the existing classes then to avoid any potential future conflict you should ensure that the name begins with either an underscore (_) or a dollar sign ($) or the name is prefixed with your own unique identifier.
For example if company 'ABC' need to add a property called 'example' then to avoid any potential future conflict use one of:

Class functions

Member functions

Datum constants

Name Description
Datum.CONSTANT_X Constant X type datum.
Datum.CONSTANT_Y Constant Y type datum.
Datum.CONSTANT_Y2 Constant Y2 type datum.
Datum.FILL_ABOVE_BELOW Fill datum above and below.
Datum.FILL_RIGHT_LEFT Fill datum right and left.
Datum.LABEL_10_POINT Label font size 10.
Datum.LABEL_12_POINT Label font size 12.
Datum.LABEL_14_POINT Label font size 14.
Datum.LABEL_18_POINT Label font size 16.
Datum.LABEL_24_POINT Label font size 24.
Datum.LABEL_8_POINT Label font size 8.
Datum.LABEL_ABOVE_CENTRE Label position above centre.
Datum.LABEL_ABOVE_LEFT Label position above left.
Datum.LABEL_ABOVE_RIGHT Label position above right.
Datum.LABEL_AUTOMATIC Label automatic font size.
Datum.LABEL_BELOW_CENTRE Label position below centre.
Datum.LABEL_BELOW_LEFT Label position below left.
Datum.LABEL_BELOW_RIGHT Label position below right.
Datum.LABEL_BOTTOM_LEFT Label position bottom left.
Datum.LABEL_BOTTOM_RIGHT Label position bottom right.
Datum.LABEL_COURIER_BOLD Label Courier bold font.
Datum.LABEL_COURIER_MEDIUM Label Courier medium font.
Datum.LABEL_DEFAULT Label default font.
Datum.LABEL_HELVETICA_BOLD Label Helvetica bold font.
Datum.LABEL_HELVETICA_MEDIUM Label Helvetica medium font.
Datum.LABEL_HORIZONTAL Label horizonal orientation.
Datum.LABEL_MIDDLE_LEFT Label position middle left.
Datum.LABEL_MIDDLE_RIGHT Label position middle right.
Datum.LABEL_NONE No label.
Datum.LABEL_TIMES_BOLD Label Times bold font.
Datum.LABEL_TIMES_MEDIUM Label Times medium font.
Datum.LABEL_TOP_LEFT Label position top left.
Datum.LABEL_TOP_RIGHT Label position top right.
Datum.LABEL_VERTICAL Label vertical orientation.
Datum.POINTS Points type datum.

Datum properties

Name Type Description
acronym string Datum acronym
fill_colour_above Colour The colour above the datum line
fill_colour_below Colour The colour below the datum line
fill_colour_between Colour The colour in between the datum line and the optional second datum line
fill_colour_left Colour The colour left of the datum line
fill_colour_right Colour The colour right of the datum line
fill_type integer The fill type. Can be Datum.FILL_ABOVE_BELOW, Datum.FILL_RIGHT_LEFT. Note that this can only be changed if the datum is of the type Datum.POINTS.
label string Datum label
label2 string Label for optional 2nd datum line
label_colour Colour The colour of the datum label
label_font integer The label font. Can be Datum.LABEL_DEFAULT, Datum.LABEL_HELVETICA_BOLD, Datum.LABEL_HELVETICA_MEDIUM, Datum.LABEL_TIMES_BOLD, Datum.LABEL_TIMES_MEDIUM, Datum.LABEL_COURIER_BOLD, Datum.LABEL_COURIER_MEDIUM
label_orientation integer The orientation of the label. Can be Datum.LABEL_HORIZONTAL, Datum.LABEL_VERTICAL
label_position integer The label position. Can be Datum.LABEL_NONE, Datum.LABEL_ABOVE_CENTRE, Datum.LABEL_ABOVE_LEFT, Datum.LABEL_ABOVE_RIGHT, Datum.LABEL_BELOW_CENTRE, Datum.LABEL_BELOW_LEFT, Datum.LABEL_BELOW_RIGHT, Datum.LABEL_MIDDLE_LEFT, Datum.LABEL_TOP_LEFT, Datum.LABEL_BOTTOM_LEFT, Datum.LABEL_MIDDLE_RIGHT, Datum.LABEL_TOP_RIGHT, Datum.LABEL_BOTTOM_RIGHT
label_size integer The label font size. Can be Datum.LABEL_AUTOMATIC, Datum.LABEL_8_POINT, Datum.LABEL_10_POINT, Datum.LABEL_12_POINT, Datum.LABEL_14_POINT, Datum.LABEL_18_POINT, Datum.LABEL_24_POINT,
line_colour Colour The colour of the datum line
line_style LineStyle The line style used to draw the datum line
line_width LineWidth The line width used to draw the datum line

Detailed Description

The Datum class allows you to create and manipulate datums. See the documentation below for more details.

Constructor

new Datum(acronym[string], type[integer], value[real or array of reals], second value (optional)[real])

Description

Create a new Datum object. The datum will be added to all the currently active graphs.

Arguments

  • acronym (string)

    Datum acronym

  • type (integer)

    Specify type of datum line. Can be Datum.CONSTANT_X, Datum.CONSTANT_Y, Datum.CONSTANT_Y2, Datum.POINTS

  • value (real or array of reals)

    Value for Datum.CONSTANT_X, Datum.CONSTANT_Y or Datum.CONSTANT_Y2 type Datum. If it is a Datum.POINTS type Datum then this should be an array of X, Y pairs or a curve ID to copy points from.

  • second value (optional) (real)

    Second constant value for use with constant X,Y or Y2 datums and can optionally be provided

    Returns

    Datum object

    Return type

    Datum

    Example

    To create a new datum with acronym my_datum and a constant Y value of 100

    var d = new Datum("my_datum", Datum.CONSTANT_Y, 100);

    To create a new datum with acronym my_datum and some X, Y points

    var points = new Array(6);
    points[0] = 0.0;
    points[1] = 10.0;
    points[2] = 1.0;
    points[3] = 15.0;
    points[4] = 2.0;
    points[5] = 17.0;
    var d = new Datum("my_datum", Datum.POINTS, points);

    Details of functions

    AddToGraph(graph (optional)[int])

    Description

    Adds a datum to a graph.

    Arguments

  • graph (optional) (int)

    Graph to add the datum to. If undefined then the datum is added to all graphs.

    This argument can be repeated if required
    Alternatively a single array argument containing the multiple values can be given

    Returns

    No return value.

    Example

    To add a datum (d) to graphs 1 and 3:

    d.AddToGraph(1, 3);

    To add a datum (d) to all graphs:

    d.AddToGraph();


    Delete(datum[string]) [static]

    Description

    Deletes a datum

    Arguments

  • datum (string)

    Acronym of datum to delete

    Returns

    No return value

    Example

    To delete datum "my_datum"

    Datum.Delete("my_datum");


    Exists(datum[string]) [static]

    Description

    Checks if a datum exists

    Arguments

  • datum (string)

    Acronym of datum to check

    Returns

    TRUE if the datum exists, otherwise FALSE

    Return type

    Boolean

    Example

    To check if a datum "my_datum" exists

    var exists = Datum.Exists("my_datum");


    First() [static]

    Description

    Returns the first datum.

    Arguments

    No arguments

    Returns

    Datum object (or null if there are no datum in the model).

    Return type

    Datum

    Example

    To get the 1st datum

    var d = Datum.First();


    GetFromAcronym(datum[string]) [static]

    Description

    Returns the datum object for a datum acronym.

    Arguments

  • datum (string)

    Acronym of datum to return object for

    Returns

    Datum object (or null if the datum does not exist).

    Return type

    Datum

    Example

    To get the datum "my_datum"

    var d = Datum.GetFromAcronym("my_datum");


    IsOnGraph(graph[int])

    Description

    Returns whether a datum is on a graph.

    Arguments

  • graph (int)

    Graph id

    Returns

    true if it is on the graph, false otherwise

    Return type

    Boolean

    Example

    To check if datum (d) is on graph 3:

    d.IsOnGraph(3);


    Next()

    Description

    Returns the next datum in the model.

    Arguments

    No arguments

    Returns

    Datum object (or null if there are no more datums in the model).

    Return type

    Datum

    Example

    To get the next datum after datum d:

    var datum = d.Next();


    RemoveFromGraph(graph (optional)[int])

    Description

    Removes a datum from a graph.

    Arguments

  • graph (optional) (int)

    Graph to remove the datum from. If undefined then the datum is removed from all graphs.

    This argument can be repeated if required
    Alternatively a single array argument containing the multiple values can be given

    Returns

    No return value.

    Example

    To remove a datum (d) from graphs 1 and 3:

    d.RemoveFromGraph(1,3);

    To remove a datum (d) from all graphs:

    d.RemoveFromGraph();