Platforms to show: All Mac Windows Linux Cross-Platform
Back to CDContourLayerMBS class.
CDContourLayerMBS.addCustomContour(z as double, contourColor as Integer, contourWidth as Integer, contourLabel as string, font as string = "normal", fontsize as double = 12, fontColor as integer = &hffff0002) as CDMarkMBS
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | ChartDirector | MBS ChartDirector Plugin | 21.2 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | All |
You can also add a custom contour by using Axis.addMark on the ColorAxis, in which case a label will also be added to the color axis. The addCustomContour method adds the label to the contour without affecting the color axis.
Argument | Default | Description |
z | (Mandatory) | The z value of the contour. |
contourColor | (Mandatory) | The contour line color. |
contourWidth | (Mandatory) | The contour line width in pixels. |
contourLabel | (Mandatory) | The text of the contour label. |
font | "normal" | The font used to draw the label. |
fontSize | 8 | The font size used to draw the label. |
fontColor | TextColor | The color used to draw the labels. |
CDContourLayerMBS.colorAxis as CDColorAxisMBS
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | ChartDirector | MBS ChartDirector Plugin | 9.2 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | All |
CDContourLayerMBS.getCrossSection(x0 as Integer, y0 as Integer, x1 as Integer, y1 as Integer) as Double()
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | ChartDirector | MBS ChartDirector Plugin | 21.2 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | All |
Note: This method should be used only after ChartDirector has output the chart image, or after BaseChart.layout has been called.
This method will return an array of numbers representing the z values of evenly spaced samples along a straight line joining the two end-points. The end-points are specified in pixel coordinates. If the input are data values, they can be converted to pixel coordinates using XYChart.getXCoor and XYChart.getYCoor.
Argument | Default | Description |
x0 | (Mandatory) | The x pixel coordinate of the first end-point. |
y0 | (Mandatory) | The y pixel coordinate of the first end-point. |
x1 | (Mandatory) | The x pixel coordinate of the second end-point. |
y1 | (Mandatory) | The y pixel coordinate of the second end-point. |
Return Value
An array of numbers epresenting the z values of evenly spaced samples along a straight line joining the two end-points. The array can contain NoValue if.
CDContourLayerMBS.getZAtPixel(x as Integer, y as Integer) as Double
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | ChartDirector | MBS ChartDirector Plugin | 21.2 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | All |
This method should be used only after ChartDirector has output the chart image, or after BaseChart.layout has been called.
Argument | Default | Description |
x | (Mandatory) | The x pixel coordinate. |
y | (Mandatory) | The y pixel coordinate. |
Return Value
The z value at the sepcified (x, y) pixel coordinate, or NoValue if the point lie outside the contour region.
CDContourLayerMBS.getZAtValue(x as double, y as double) as Double
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | ChartDirector | MBS ChartDirector Plugin | 21.2 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | All |
This method should be used only after ChartDirector has output the chart image, or after BaseChart.layout has been called.
Argument | Default | Description |
x | (Mandatory) | The x data value. |
y | (Mandatory) | The y data value. |
Return Value
The z value at the sepcified (x, y) data coordinate, or NoValue if the point lie outside the contour region.
CDContourLayerMBS.setColorAxis(x as Integer, y as Integer, alignment as Integer, length as Integer, orientation as Integer) as CDColorAxisMBS
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | ChartDirector | MBS ChartDirector Plugin | 9.2 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | All |
Arguments:
Argument | Default | Description |
x | (Mandatory) | The x-coordinate of the reference point used to position the color axis. |
y | (Mandatory) | The y-coordinate of the reference point used to position the color axis. |
alignment | (Mandatory) | The alignment of the color axis with respect to the reference point. For example, a value of kTopLeft means the reference point is the top- left corner of the color axis. See Alignment Specification for supported alignment types. |
length | (Mandatory) | The length of the color axis in pixels. |
orientation | (Mandatory) | The orientation of the color axis. A value of kTop/kBottom means the axis is horizontal, and the axis labels are at top/bottom side of the axis. A value of kLeft/kRight means the axis is vertical, and the axis labels are at the left/right side of the axis. |
CDContourLayerMBS.setContourColor(contourColor as color, minorContourColor as color)
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | ChartDirector | MBS ChartDirector Plugin | 11.1 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | All |
See also:
CDContourLayerMBS.setContourColor(contourColor as Integer, minorContourColor as Integer = -1)
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | ChartDirector | MBS ChartDirector Plugin | 9.2 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | All |
Argument | Default | Description |
contourColor | (Mandatory) | The major contour line color. If this method is never called, the default contour line color is semi-transparent black (&h80000000). |
minorContourColor | -1 | The minor contour line color. -1 means the minor contour line color is the same as the major contour line color. |
See also:
CDContourLayerMBS.setContourLabelFormat(formatString as string)
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | ChartDirector | MBS ChartDirector Plugin | 21.2 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | All |
By default, the data label format is "{label}". Please refer to Parameter Substitution and Formatting on available parameters and how to format them.
Argument | Default | Description |
formatString | (Mandatory) | The format string. |
CDContourLayerMBS.setContourLabelSpacing(labelSpacing as Integer, minContourLen as Integer)
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | ChartDirector | MBS ChartDirector Plugin | 21.2 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | All |
ChartDirector will try to place labels at relative straight segments along the contour while ensuring the labels are not too close together. The default target label spacing is 300 pixels.
If the contour is short relative to the label length, all or a large part of the contour may become the label, and the contour line may become hard to see. By default, ChartDirector will not put a label on a contour if the contour length is less than 3 times that of the label length. This allows the contour on either side of the label to be as least as long as the label.
This method can be used to adjust what is the target label spacing and contour length for positioning labels.
Argument | Default | Description |
labelSpacing | (Mandatory) | The target label spacing in pixels. The actual spacing may be different as the labels can only be placed on relatively straight segments along the contour. |
minContourLen | (Mandatory) | The minimum contour length in pixels below which there will be no contour label. |
CDContourLayerMBS.setContourLabelStyle(font as string = "normal", fontsize as double = 12, fontColor as integer = &hffff0002) as CDTextBoxMBS
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | ChartDirector | MBS ChartDirector Plugin | 21.2 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | All |
Argument | Default | Description |
font | "normal" | The font used to draw the labels. |
fontSize | 8 | The font size used to draw the labels. |
fontColor | TextColor | The color used to draw the labels. |
Returns a TextBox object representing the prototype of the contour labels. This may be used to fine-tune the appearance of the contour labels.
CDContourLayerMBS.setContourWidth(contourWidth as Integer, minorContourWidth as Integer = -1)
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | ChartDirector | MBS ChartDirector Plugin | 9.2 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | All |
Arguments:
Argument | Default | Description |
contourWidth | (Mandatory) | The major contour line width in pixels. If this method is never called, the default contour line width is 1 pixel. |
minorContourWidth | -1 | The minor contour line width. -1 means the minor contour line width is the same as the major contour line width. |
CDContourLayerMBS.setExactContour(contour as boolean = true)
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | ChartDirector | MBS ChartDirector Plugin | 12.3 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | All |
In exact contour mode, the contour at z = N refers to all points at z = N. For example, the contour at z = 10 refers to all points at z = 10. These points normally constitute lines. However, in case there is an exactly flat region at z = 10, the entire region will be the contour and will be colored using the contour color. In other words, instead of lines, a contour can become a region.
In boundary contour mode, the contour at z = N refers to the boundary between z < N and z >= N, except for the highest contour in which case the contour is the boundary between z <= N and z > N. With this method, if there is a flat region, the contour will occur at the boundary of the region.
If this method is never called, the default is to use boundary contour mode.
Argument | Default | Description |
contour | true | A true value specifies exact contour mode for standard contours, otherwise boundary contour mode will be used. |
markContour | [Same_As_Contour] | A true value specifies exact contour mode for mark contours. A false value specifies boundary contour mode for mark contours. A mark contour is an extra contour added using Axis.addMark on the color axis (obtained using ContourLayer.colorAxis). If this parameter is not specified, the default is to use the same contour mode as standard contours. |
See also:
CDContourLayerMBS.setExactContour(contour as boolean, markContour as boolean)
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | ChartDirector | MBS ChartDirector Plugin | 12.3 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | All |
In exact contour mode, the contour at z = N refers to all points at z = N. For example, the contour at z = 10 refers to all points at z = 10. These points normally constitute lines. However, in case there is an exactly flat region at z = 10, the entire region will be the contour and will be colored using the contour color. In other words, instead of lines, a contour can become a region.
In boundary contour mode, the contour at z = N refers to the boundary between z < N and z >= N, except for the highest contour in which case the contour is the boundary between z <= N and z > N. With this method, if there is a flat region, the contour will occur at the boundary of the region.
If this method is never called, the default is to use boundary contour mode.
Argument | Default | Description |
contour | true | A true value specifies exact contour mode for standard contours, otherwise boundary contour mode will be used. |
markContour | [Same_As_Contour] | A true value specifies exact contour mode for mark contours. A false value specifies boundary contour mode for mark contours. A mark contour is an extra contour added using Axis.addMark on the color axis (obtained using ContourLayer.colorAxis). If this parameter is not specified, the default is to use the same contour mode as standard contours. |
See also:
CDContourLayerMBS.setSmoothInterpolation(b as boolean)
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | ChartDirector | MBS ChartDirector Plugin | 9.2 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | All |
The data points for the contour layer are samples of the z values at certain gridded or scattered (x, y) points. However, to draw the contour and to color the layer, it is necessarily to know the z values at all pixels in the xy plane. ChartDirector uses surface interpolation to compute the z values at all pixels from the given data points.
In spline surface interpolation, ChartDirector will compute a smooth surface that passes through all data points. In bilinear/linear surface interpolation, ChartDirector will use the data points to partition the (x, y) plane into rectangular or triangular regions, and will fit bilinear or linear surfaces to the regions.
Spline surface interpolation generally produces smoother contours and is the default.
Arguments:
Argument | Default | Description |
b | (Mandatory) | A true value means to use spline surface interpolation. A false value means to use bilinear/linear surface interpolation. |
Some examples using this method:
CDContourLayerMBS.setZBounds(minZ as Double, maxZ as Double)
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | ChartDirector | MBS ChartDirector Plugin | 12.3 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | All |
In spline surface interpolation (see ContourLayer.setSmoothInterpolation), it is possible that the interpolated surface contains regions that are higher than the highest data point, or lower than the lowest data point.
As an example, consider a linear sequence of points with z values [10, 20, 30, 40, 40, 30, 20, 10]. The first 4 points represent an upward slope, while the last 4 points represent a download slope. If these points are to be joined with a smooth spline, the peak will naturally fall somewhere between the middle two points and exceed 40. So there will be a region in the spline higher than the highest data point.
In some applications, it may be desirable to limit the z values to certain bounds. For example, if the data are about rainfall, it is not desirable if the interpolated surface falls below 0, as there cannot be negative rainfall. The setZBounds method can be used to clip the interpolated surface to the desired bounds.
Argument | Default | Description |
minZ | DataBound | The minimum z value to clip to. Use NoValue if there is no minimum z bound. The special constant DataBound means that the minimum z value is the minimum data value. |
maxZ | DataBound | The maximum z value to clip to. Use NoValue if there is no maximum z bound. The special constant DataBound means that the maximum z value is the maximum data value. |
CDContourLayerMBS.setZData(zData() as Double)
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | ChartDirector | MBS ChartDirector Plugin | 9.2 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | All |
Arguments:
Argument | Default | Description |
zData | (Mandatory) | An array of numbers as the z data for the contour chart. |
The items on this page are in the following plugins: MBS ChartDirector Plugin.