Share via


Units of Measure

In general, the formulas of cell elements that represent some numeric value (for example, the shape position, a dimension, or an angle) require a number-unit pair that consists of a number and the unit type that is needed to interpret the number. In DatadiagramML, however, even though the unit type information is stored, the value of an element is expressed in whatever the appropriate internal units are for that value. An internal unit is the unit of measure used by Microsoft Visio to represent a particular type of value and is the value Visio writes to DatadiagramML files.

For example, values representing units that are a measurement of length are expressed as floating-point numbers in inches, because the inch is the internal unit used by Visio to represent length. Therefore, if an element has a value of "2 feet", its Unit attribute is 'FT' for "feet," and its value is the number 24.

Other units, such as date/time, are expressed as formatted strings. In the case of date/time, the unit is a string, such as "2004-12-20T23:00:00".

If a unit of measure is explicitly set, and if it is different from the default unit for the cell, Microsoft Visio writes out the Unit attribute in DatadiagramML files. If no Unit attribute is present in an element that represents a cell, Visio will use the default unit for that element.

For more information about how units of measure work in Visio, see About units of measure in the Microsoft Visio ShapeSheet Reference.

The following tables describe valid units of measure and provide information about internal units and how they are expressed in a DatadiagramML file.

Area, distance, and typographical units of measure

The values of these unit types are expressed as floating-point values in inches (internal units). Therefore, a value of "2 feet" would be expressed as:

<Width Unit='FT'>24</Width>

A value of "12 points" would be expressed as:

<Width Unit='FT'>24</Width>

Note

Units of measure that represent an area (acre and hectare) are expressed in square inches.

Unit

Description

AC

Acre

C

Ciceros

C_D

Ciceros/didots

CM

Centimeters

D

Didots

DL

Default length units

DP

Default page units

DT

Default type units

F_I

Feet/inches

FT

Feet

HA

Hectare

IN

Inches

IN_F

Inches-fractional

KM

Kilometers

M

Meters

MI

Miles

MI_F

Miles-fractional

MM

Millimeters

NM

Nautical miles

P

Picas

PT

Points

P_PT

Picas/points

YD

Yards

Angular units of measure

Angle values are expressed as floating-point values in radians (internal units).

Therefore, 180 fractional degrees appears as the following:

<Angle Unit='DEG'>3.1415926535898</Angle>

Unit

Description

AD

Degrees

AM

Minutes

AS

Seconds

DA

Default angle units

DEG

Fractional degrees

RAD

Radians

Duration units of measure

Values of this unit type are expressed as floating-point values in elapsed days. (Days are the internal units for time). For example, the C element below contains the elapsed days between the dates stored in the A and B elements.

<A Unit='DATE' F='Date(1969,9,12)'>1969-09-12T00:00:00</A>
<B Unit='DATE' F='Date(1969,9,13)'>1969-09-13T00:00:00</B>
<C Unit='ED' F='Scratch.B1-Scratch.A1'>1</C>

Unit

Description

DE

Default duration days

ED

Elapsed days

EH

Elapsed hours

EM

Elapsed minutes

ES

Elapsed seconds

EW

Elapsed weeks

Date/time units of measure

Values of this unit type are expressed as string values written out in the ISO 8601 format:

<code language="XML" type="developer">yyyy-mm-ddThh:mm[:ss[.ss]]</code>

Note

  • The uppercase letter "T" is a required delimiter between the date portion and the time portion.

  • The date portion must be complete: a four-digit year, a dash, a two-digit month, a dash, and a two-digit day.

  • The time portion must include a two-digit hour (based on a 24-hour clock), a colon, and a two-digit minute. The time can optionally include another colon and two-digit seconds. After the optional seconds, there can be a dot, followed by digits representing fractional seconds. Fractional seconds can be as precise as nanoseconds.

For example:

yyyy-mm-ddThh:mm[:ss[.ss]]

Unit

Description

DATE

Date and time

Miscellaneous units of measure

Values of these unit types are expressed as strings. The following table provides an example of each unit type.

Unit

Description

Example

BOOL

Boolean

An integer that can be 0 (FALSE) or 1 (TRUE). For example:

<A Unit='BOOL'>1</A>

COLOR

A color value

A color value is specified by its red, green, and blue (RGB) components or its index within the document color table. The value can appear as a hash (#) followed by a 6-digit hexadecimal number or as an integer value between 0 and 23.

For example, the color green would appear as follows:

<A Unit='COLOR'>#00FF00</A>

A color at index 3 of the ColorEntry element would appear as follows:

<A Unit='COLOR'>3</A>

CY

Currency

<A Unit='CY'>####.####xxx</A>

where ####.#### is the amount and xxx is the ISO 4217 currency symbol. For example, $234.45 in U.S. dollars would appear as follows:

<A Unit='CY'>234.4500USD</A>

GUID

A globally unique identifier

A string that represents a globally unique identifier (GUID). For example:

<A Unit='GUID'>{4A1A0046-7A0D-4395-99CA-9939AD2D567E}</A>

MULTIDIM

Multidimensional value

<A Unit='MULTIDIM'>###unit^pow</A>

where ### is a floating-point value, unit is one of the floating-point units of measure (area, angle, distance, duration, or typographical) as previously described, and pow is a power. For example, 12 cubic feet would appear as:

<A Unit='MULTIDIM'>1728 IN^3</A>

NUM

Number

Expressed as a floating-point value.

NURBS

NURBS curve data

Expressed in the same format as a formula with a NURBS (non-uniform rational B-spline) function:

NURBS(knotLast, degree, xType, yType, x1, y1, knot1, weight1, ...)

<E Unit='NURBS'>NURBS(2.3,2,0,0,0.6,-1.1,0,1)</E>

PER

Percent

Expressed as a floating-point value between 0 and 1. For example, 50% would appear as:

<A Unit='PER'>0.5</A>

PNT

2-D coordinate

<A Unit='PNT'>PNT(x unit, y unit )</A>

where x and y are floating-point values and unit is one of the floating-point units of measure (area, angle, distance, duration, or typographical) described earlier.

For example,

<A Unit='PNT'>PNT(2,3)</A>

POLYLINE

Polyline point data

POLYLINE function:

POLYLINE(xType, yType, x1, y1...)

<E Unit='POLYLINE'>POLYLINE(0,0,0,1)</E>

STR

String

<A Unit='STR'>some string</A>

where some string is a PCDATA string.