Skip to content

Navigation Menu

Sign up

MUGL Normalization Rules

embeepea edited this page Sep 28, 2012 · 27 revisions

In order to allow for more convenient authoring of MUGL files, the MUGL specification allows certain tags and attributes to be omitted, and Multigraph will assume that those tags/attributes have certain default values. In many cases, the default values are simply constants; for example, the default color for an axis is black. In some cases, though, default values need to be computed based on the context; for example, the default format for axis labels depends on the data type of the axis.

We say that a MUGL file is "normalized" if it contains values for everything that Multigraph needs, with no need to compute any additional defaults. This file lists the rules used to "normalize" a MUGL file.

Constant Defaults

Set default values for all unspecified attributes whose defaults are constants

Missing data.variables

If a <data> tag does not have a <variables> section but does have a <values> section, examine the first row of values in the <values> section to determine the number of variables (columns) present, and create a <variables> section with one <variable> tag for each variable. If a <data> section does not have a <variables> section and also does not have a <values> section, throw an error (we insist on <variables> sections for both <csv> and <service> data objects).

Default data.variables.variable id attribute

If a <variable> tag does not specify an id, assign it an id of 'x' for a variable in column 0, 'y' for a variable in column 1, 'y1' for a variable in column 2, 'y2' for a variable in column 3, and so on. These default ids should be chosen based strictly on the column number, regardless on which variables in the data section have explicitly specified ids. So, for example, if we have

 <data>
 <variables>
 <variable column="0" type="datetime" id="time"/>
 </variables>
 <values>
 20120602, 13.1
 </values>
 </data>

Then we would insert

 <variable column="1" type="number" id="y"/>

after the first <variable> tag.

Clone this wiki locally

AltStyle によって変換されたページ (->オリジナル) /