This function adds a curve to the plot. The parameter name
will be the reference used to address the curve. For example, the temperature of a curve can be set using the following syntax:
plotMC.addCurve("curveName");
plotMC.curveName.temperature = 5800;
(See "Curve Specific Properties and Methods" below for other curve features.)
The temp
and style
parameters are optional. style
should be an object with thickness
, color
, and alpha
properties.
Note that you don't have to use code to add a curve. Typing a value in the "bbCurve temperature" field in the Properties Inspector will cause the plot component to automatically add a curve (with the name of "bbCurve") to the plot with the given temperature.
mode
should be either of the strings "autoscale", "locked", or "custom", indicating whether the vertical axis rescales in response to changes in the curves' temperatures. The default behavior is to autoscale to all curves so that the peak brightness is at 90% of the vertical height of the plot area (even if the peak is off to the left or right of the plot area).
In "custom" mode the vertical scaling of each curve can be set using each curve's peakHeight
property (see below). The y-axis labels and tickmarks are suppressed in this mode since the plot is no longer showing intensity.
targetHeight
is the preferred ratio of the maximum peak brightness (of all the curves selected for autoscaling) to the brightness at the top of the plot window. So if targetHeight
is 1 the highest peak will touch the top of the plot, and if it is 0.75 the peak will reach three-quarters of the way to the top of the plot. The default is 0.9.
curves
can be a single name (a string) or an array of names specifying which curves should be used to do autoscaling. If this parameter is omitted all curves will be used.
This function sets the color of the axes labels (both x and y). This can also be done in the properties inspector. No update is required after calling this function. If you aren't using the default tickmark labels in the resources folder please note that the label colors are set by sending the label movieclips labelColor
as an initObject with the color given in the properties inspector, and by attempting to call the function setLabelColor
when the color changes after initialization.
There are several update functions, but the catch-all function update
is probably the only one you need to use. If the argument updateEverything
is true then all the update functions will be called. Otherwise only the scale, vertical axis, and curves will be updated (which is what you want if you just changed a curve's temperature and autoscaling is on). Unless there is some need for saving every last CPU cycle, the thing to do is
plotMC.update()
if a curve's temperature has changedplotMC.update(true)
otherwiseThese properties set the dimensions of the plot area. Default dimensions are 400px by 250px.
These properties set the range of the horizontal axis (in meters). Defaults are 100e-9 and 900e-9.
A boolean indicating whether the visual spectrum rainbow is drawn. The default is true.
Booleans indicating whether to draw the horizontal and vertical axes, which include the axis line, tickmarks, and labels. Defaults are true.
These are the linestyle properties used for the drawing the axes. The default is a black (100% alpha) line with thickness of 1px.
A boolean that determines whether a border is drawn around the plot area. The default is false.
These are the linestyle properties for the border. The default is a gray (0xcccccc, 100% alpha) line of thickness 1px.
These are the fill properties for the background of the plot area. The default is white at 100% alpha.
These properties specify the distances that the tickmarks stick out from the axes. minorTickmarkExtent
also determines the size of the visible spectrum band (if shown). The defaults are 10px for majorTickmarkExtent
and 7px for minorTickmarkExtent
.
These are the linkage names of the movieclips in the library to use for the axes' labels. The default clips are "Default X Tickmark Label" and "Default Y Tickmark Label", which are found in the Resources subfolder. You can leave these fields blank to suppress the labels (while leaving the tickmarks). These values should only be set with the Properties Inspector.
These properties set the mininum allowed screen distances between labels on each axis. Defaults are 45px for the horizontal axis and 30px for the vertical axis.
This is the brightness limit ('intensity' may be the more precise term) of the vertical axis in W/(m2·sr·m). Changing this value is useful only when the vertical axis is "locked" (cf. setVerticalScalingMode
).
The temperature associated with the curve. The default is null
(which means the curve is not drawn).
styleObj
should be an object with any of the following properties: thickness
, color
, alpha
, fillColor
, and fillAlpha
. The default style is a black (100% alpha) line of thickness 1px and a 20% transparent red fill. Note that the fill (that is, the area under the curve) is not shown by default, see showFill
below.
A boolean property that determines whether the area under the curve is colored. The default is false
. Use setStyle
to set the style of the fill.
If "custom" vertical scaling is used peakHeight
specifies how high the peak of the curve is as a fraction of the plot area height. So if peakHeight
is 1 the curve is scaled so that the peak is at the top of the plot area. The default is 0.9.
linkageName
is the name of the movieclip in the library to be displayed at the peak. Optionally, you can provide an initObject
to populate the attached clip.
The property peakLabel
(see below) can be used to access the movieclip.
peakLabel
is the instance of the peak label (if one has been attached). This property is useful if you want to change the label text.
This function returns the wavelength (in meters) where the curve peaks.
This function toggles the visibility of the curve. You must call the update
function (see above) after making a curve visible. However, hiding a curve requires no update.
This function removes the curve from the plot. The change is immediate — no update is required.