Platforms to show: All Mac Windows Linux Cross-Platform
Back to CDAxisMBS class.
CDAxisMBS.setAngle(angle as Double)
| Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
| method | ChartDirector | MBS ChartDirector Plugin | 8.2 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | All |
CDAxisMBS.setAutoScale(topExtension as Double = 0.1, bottomExtension as Double = 0.1, zeroAffinity as Double = 0.8)
| Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
| method | ChartDirector | MBS ChartDirector Plugin | 8.2 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | All |
During auto-scaling, it is often desirable to leave some margins at the ends of the axis. For example, suppose in a bar chart, the longest bar is 10 units. If auto-scaling chooses 0 - 10 as the scale, the longest bar will touch the top edge of the plot area. In many cases, the chart will look better if there is some margin so that the longest bar does not touch the top edge.
The setAutoScale can be used to reserve some margins at the ends of the axis by using a scale that is larger than necessary. For example, in the above case, if a scale of 0 - 12 is used, then the longest bar will not touch the top edge.
Other common reasons for reserving margins at the ends of the axis include making sure the data labels (which may be drawn on top of the data points) will not go outside the plot area, and that objects put at the top or bottom of the plot area (such as legend box and custom text box) will not overlap with the data points.
Note that there is an alternative way to reserve space at the ends of the axis - the Axis.setMargin method.
In the setAutoScale method, the amount of margins reserved is controlled by the topExtension and bottomExtension arguments. These arguments determine the portion of the axis where no data point can reach. For example, a topExtension of 0.2 will ensure no data point can fall within the top 20% of the axis.
Note that ChartDirector will not extend the scale across the 0 point.
For example, suppose the data range is 0.1 - 9.9. If 10% margin is added to the bottom end of the axis, the bottom end may become negative. In this case, ChartDirector will extend the bottom end to 0 at most.
In other words, if the data range is completely positive, ChartDirector will not extend the axis to negative, as it would be undesirable in most applications. The same applies if the data range is completely negative.
For a purely positive axis, the bottom end has "zero affinity". That means ChartDirector will tend to choose 0 as the bottom end because zero is a natural starting point for the axis. However, if the data range is too extreme (e.g. the data is in the range 10000 - 10005), it may be "unreasonable" to choose 0 as the axis starting point. In this case, ChartDirector will not use 0 as the axis starting point.
ChartDirector will determine that it is "unreasonable" to use 0 as the axis starting point if the data fluctuation (the difference between the maximum and minimum data values) is too small compare with the data value. ChartDirector test the "too small" condition using the formula:
maxDataValue * zeroAffinity < minDataValue
where zeroAffinity by default is 0.8.
Similar "zero affinity" mechanism applies to the top end of the axis for a purely negative axis. If the data range contains both positive and negative values, the zero point is always included.
The zeroAffinity argument of the setAutoScale method allows you to modify the zero affinity when performing auto-scaling. Zero affinity should be between 0 and 1. A large value encourages ChartDirector to start the axis from zero.
A zero affinity of 1 means the axis always includes the zero point. A zero affinity of 0 means that the axis is scaled purely according to the data range, without any preference for the zero point.
Note that zero affinity is ignored for log scale axis as log scale axis cannot contain 0.
| Parameter | Default | Description |
|---|---|---|
| topExtension | 0.1 | The top portion of the axis that no data point should fall into. For example, a value of 0.2 means no data value will fall within the top 20% of the axis. The topExtension must be between 0 to 1. |
| bottomExtension | 0.1 | The bottom portion of the axis that no data point should fall into. For example, a value of 0.2 means no data value will fall within the bottom 20% of the axis. The bottomExtension must be between 0 to 1. |
| zeroAffinity | 0.8 | The tendency of ChartDirector to include zero in the axis during auto-scaling. The value must be between 0 and 1. A large value encourages ChartDirector to start the axis from zero. A value of 1 means the axis always includes the zero point. A value of 0 means there is no preference for the zero point during auto-scaling. |
CDAxisMBS.setColors(axisColor as color, labelColor as color, titleColor as color, tickColor 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:
CDAxisMBS.setColors(axisColor as Integer, labelColor as Integer = &hffff0002, titleColor as Integer = -1, tickColor as Integer = -1)
| Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
| method | ChartDirector | MBS ChartDirector Plugin | 8.2 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | All |
By default, the axis and axis ticks are drawn using the LineColor, while the axis label and axis title are drawn using the TextColor. You may use this method to change their colors.
| Parameter | Default | Description |
|---|---|---|
| axisColor | (Mandatory) | The color of the axis itself. |
| labelColor | TextColor | The color of the axis labels. |
| titleColor | -1 | The color of the axis title. -1 means the axis title color is the same as the axis label color. |
| tickColor | -1 | The color of the axis ticks. -1 means the axis ticks color is the same as the axis color. |
See also:
CDAxisMBS.setDateScale(formatString as string = "")
| Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
| method | ChartDirector | MBS ChartDirector Plugin | 8.2 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | All |
| Parameter | Default | Description |
|---|---|---|
| formatString | "" | The format used for the labels on the axis. Please refer to Axis.setLabelFormat for the syntax of the format string. An empty string means the format will be automatically determined. |
See also:
CDAxisMBS.setDateScale(lowerLimit as Double, upperLimit as Double, labels() as string)
| Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
| method | ChartDirector | MBS ChartDirector Plugin | 8.2 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | All |
| Parameter | Default | Description |
|---|---|---|
| lowerLimit | (Mandatory) | The lower bound of the axis, representing using one of the ChartDirector supported date format. |
| upperLimit | (Mandatory) | The upper bound of the axis, representing using one of the ChartDirector supported date format. |
| labels | (Mandatory) | An array of text strings to be used as the labels on the axis. ChartDirector will distribute the labels evenly on the axis. By default, all labels are associated with major ticks. These can be modified by using '-' or '~' as the first character. Please refer to Axis.setLabels for details. |
See also:
CDAxisMBS.setDateScale(lowerLimit as Double, upperLimit as Double, majorTickInc as Double = 0, minorTickInc as Double = 0)
| Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
| method | ChartDirector | MBS ChartDirector Plugin | 8.2 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | All |
| Parameter | Default | Description |
|---|---|---|
| lowerLimit | (Mandatory) | The lower bound of the axis, representing using one of the ChartDirector supported date format. |
| upperLimit | (Mandatory) | The upper bound of the axis, representing using one of the ChartDirector supported date format. |
| majorTickInc | 0 | Adds major ticks to the axis, where the major ticks are separated by majorTickInc seconds. Each major tick will have an associated text label for the value if the axis at the tick. The value 30 * 86400 will be assume to mean one month (which actually contains a variable number of seconds), and 60 * 86400 will be assumed to mean 2 months and so on. The value 360 * 86400 therefore means 12 months, or 1 year. The default value of 0 means the major ticks will be automatically determined. In this case, the lowerLimit and upperLimit may be automatically adjusted to align with the ticks. Use kNoValue to disable major ticks. |
| minorTickInc | 0 | Adds minor ticks to the x-axis, where the minor ticks are separated by minorTickInc seconds. |
The value 30 * 86400 will be assume to mean one month (which actually contains a variable number of seconds), and 60 * 86400 will be assumed to mean 2 months and so on. The value 360 * 86400 therefore means 12 months, or 1 year.
The default value of 0 means no minor tick is used.
See also:
CDAxisMBS.setFormatCondition(condition as string, operand as Double = 0)
| Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
| method | ChartDirector | MBS ChartDirector Plugin | 8.2 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | All |
In some applications, the axis range can vary greatly. For example, for a date/time axis, the ticks on the axis can be hourly ticks if the duration is short, or daily ticks (or even monthly or yearly) if the duration is long. One can always use a universal axis format that is applicable in all cases (such as "mmm dd, yyyy<*br*>hh:nn:ss"), or one can leave ChartDirector to automatically come up with a suitable axis format.
Sometimes it may be desirable to explicitly specify different axis formats depending on tick types. For example, one may want to specify a certain format if the ticks are hourly, and another format if the ticks are daily.
If it is possible to predict which kind of ticks will be on the axis, one can always use "if" statements to specify different axis formats for various cases.
The setFormatCondition method is for cases in which it is difficult to predict which type of ticks would appear on the axis. For example, in an auto-scaled axis in which the duration can vary continuously, in some marginal cases, it is difficult to predict if auto-scaling will choose hourly or daily ticks.
The setFormatCondition method allows you to specify a condition to be tested against the auto-scaling result, so that subsequent
Axis.setLabelFormat or Axis.setMultiFormat will be applicable only if the condition is true.
The types of condition supported are:
Condition
Description
| "align" | Test if all the ticks are aligned to the operand. Use 3600 for testing hourly alignment, 86400 (1 day = 86400) for daily alignment, 30 * 86400 for monthly alignment and 360 * 86400 for yearly alignment. (Note: The values for monthly and yearly alignments are special values recognized by ChartDirector. They works even if a month or year is not exactly 30 or 360 days.) |
| ">" | Test if the maximum absolute value of the ticks are larger than the operand. This is useful when one needs to apply different formats to large numbers (eg. use scientific formats if the axis range exceed certain values). |
| ">=" | Test if the maximum absolute value of the ticks is larger than or equal to the operand. |
| "<" | Test if the maximum absolute value of the ticks is less than the operand. |
| "<=" | Test if the maximum absolute value of the ticks is less than or equal to the operand. |
| "==" | Test if the maximum absolute value of the ticks is equal to the operand. |
| "=" | Same as "==" above. |
| "!=" | Test if the maximum absolute value of the ticks is not equal to the operand. |
| "<>" | Same as "!=" above. |
| "else" | This condition is true if and only if the previous condition is false. |
| "true" | This condition is always true. It is useful as a "catch all" condition. |
| "false" | This condition is always false. |
| Parameter | Default | Description |
|---|---|---|
| condition | (Mandatory) | The type of condition to test. Must be one of the condition types in the above table. This text string is case sensitive. |
| operand | 0 | The operand for condition types that need an operand. |
CDAxisMBS.setIndent(indent as boolean)
| Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
| method | ChartDirector | MBS ChartDirector Plugin | 8.2 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | All |
Normally, the x-axis is automatically scaled so that x coordinate of first data point is at the beginning of the x-axis, and the x coordinate last data point is at the end of the axis. If a line layer is drawn, the line will span from the left border of the plot area to the right border of the plot area.
However, for bar layer, if the x-axis is scaled as above, half of the first bar and half of the last bar will be outside the plot area. The same applies to HLOC layers, candlestick layers and box-whisker layers.
When the axis is "indented", some margins will be reserved at the ends of the axis, so that all data representation are within the plot area.
By default, "indented" mode is automatically used in x-axis for charts that contain bar, HLOC, candlestick or box-whisker layers.
The setIndent method allows you to manually configure whether "indented" mode is used or not. One common usage is to align the x-axes in different charts.
For example, suppose a web page contains a bar chart and a line chart. The bar chart will be using "indented" mode x-axis, while the line chart will be using "non-indented" mode. If the two charts are on top of one another for ease of comparison (common for finance style charts), it is desirable that their x-axes should align. In this case, the setIndent method can be used to force the line chart to use indented mode x-axis.
| Parameter | Default | Description |
|---|---|---|
| indent | (Mandatory) | A true value sets the axis to indented mode. A false value sets the axis to non-indented mode. |
CDAxisMBS.setLabelAlignment(alignment as Integer, minLabelSpace as Integer = 3)
| Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
| method | ChartDirector | MBS ChartDirector Plugin | 15.1 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | All |
CDAxisMBS.setLabelFormat(formatString as string)
| Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
| method | ChartDirector | MBS ChartDirector Plugin | 8.2 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | All |
By default, ChartDirector will try to guess if the axis represents numbers or dates. If the axis represents numbers, it will use "{value}" as the default format. If the axis represents dates, it will guess the format based on resolution of the dates (e.g. whether the dates contain hourly data or monthly data, etc). It may use formats such as {value|mm/dd/yy<*br*>hh:nn:ss}, {value|mm/dd/yy hh:nn:ss}, {value|mm/dd/yyyy}, {value|mm/yyyy} or {value|yyyy}.
Please refer to Parameter Substitution and Formatting on all available parameters and how to format them.
| Parameter | Default | Description |
|---|---|---|
| formatString | (Mandatory) | The format string. |
CDAxisMBS.setLabelGap(d as Integer)
| Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
| method | ChartDirector | MBS ChartDirector Plugin | 8.2 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | All |
| Parameter | Default | Description |
|---|---|---|
| d | (Mandatory) | The distance between the axis label and the tick in pixels. |
CDAxisMBS.setLabelOffset(offset as Double)
| Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
| method | ChartDirector | MBS ChartDirector Plugin | 8.2 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | All |
This method expects the offset along the axis being a value on the axis scale. The Box.setPos method of the axis label prototype (obtained using Axis.setLabelStyle) can also be used to shift the labels, with the offsets specified in pixel units.
| Parameter | Default | Description |
|---|---|---|
| offset | (Mandatory) | The distance to shift the labels along the axis as a value on the axis scale. |
CDAxisMBS.setLabels(labels() as Double, formatString as string = "") as CDTextBoxMBS
| Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
| method | ChartDirector | MBS ChartDirector Plugin | 8.2 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | All |
This method is typically used to set the x-axis to enumerated scale. For more details on what is enumerated axis scale, please refer to
Axis.setLabels.
This method assumes the labels are in their "native" form (that is, not formatted). Please refer to Date Representation for the native date/time formats supported in ChartDirector.
If the labels are already formatted into human readable form (that is, they are text strings), use Axis.setLabels instead.
One common issue is that there may be too many labels on the axis. In this case, the Axis.setLabelStep method may be used show only a regularly spaced subset of labels on the axis.
For date/time labels, another alternative is to use Axis.setMultiFormat, which uses filters to select important dates/times (such as dates/times representing the start of a month) for display as labels.
A third method to avoid too many labels is to remove some labels by replacing them with kNoValue before passing them to ChartDirector. If you want to remove the label text but leave a minor tick, use MinorTickOnly as the label value.
| labels | (Mandatory) | An array of numbers/dates to be used as the axis labels. |
| formatString | "" | A format string to specified how to format the labels into human readable form. Please refer to Axis.setLabelFormat for the syntax of the format string. An empty string means the format will be automatically determined. |
Return Value
A TextBox object representing the prototype of the obj. This may be used to fine-tune the appearance of the obj.
See also:
CDAxisMBS.setLabels(labels() as string) as CDTextBoxMBS
| Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
| method | ChartDirector | MBS ChartDirector Plugin | 8.2 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | All |
This method is typically used to set the x-axis to enumerated scale. In enumerated scale, the data points are associated with the x-axis by position. The first data point will be plotted at the first label position on the x-axis, the second data point at the second label position, and so on.
Enumerated axis is a very flexible axis type. It is most suitable for chart types where the data points are evenly spaced on the x-axis. The axis labels can be any text. They do not need to be numbers or dates. If they are numbers or dates, you can format them in any way you like before calling this method.
Internally, ChartDirector will assign a value of 0 to the first axis label, 1 to the second axis label, and so on. These values are not visible. Only the axis labels are visible. However, these values may be useful for some ChartDirector features that need to reference the axis position by value, such as adding mark lines using Axis.addMark.
By default, all axis labels will be associated major ticks. To associate a label with a minor tick, use '-' as the first character of the label. To draw a label without any tick at all, use '~' as the first character of the label.
Leading '-' or '~' characters are tick specification characters and will not appear on the labels. They just specify the the tick style to be associated with the labels. If you want have a label that actually begins these characters, add '\' as the first character as the escape character.
One common issue is that there may be too many labels on the axis. In this case, the Axis.setLabelStep method may be used show only a regularly spaced subset of labels on the axis.
Another method is to remove some labels is to replace them with empty strings before passing them to ChartDirector. If you want to remove the label text but leave a major tick, use a space character " " as the label text. If you want to remove the label text but leave a major tick, use "-" as the label text.
| Parameter | Default | Description |
|---|---|---|
| text | (Mandatory) | An array of strings containing the text of the labels. |
Return Value
A TextBox object representing the prototype of the obj. This may be used to fine-tune the appearance of the obj.
See also:
CDAxisMBS.setLabelStep(majorTickStep as Integer, minorTickStep as Integer = 0, majorTickOffset as Integer = 0, minorTickOffset as Integer = -2147483647)
| Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
| method | ChartDirector | MBS ChartDirector Plugin | 8.2 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | All |
This method is typically used in conjunction with
Axis.setLabels. These two methods define the full set of labels on the axis, one for each data point in a data set. In many cases, there may be too many labels and the axis may become overcrowded with labels. The setLabelStep method will cause the axis to show a regularly spaced subset of labels instead all labels.
| Parameter | Default | Description |
|---|---|---|
| majorTickStep | (Mandatory) | The spacing between visible labels (major ticks). For example, a value of 10 means displaying 1 label for every 10 labels. |
| minorTickStep | 0 | For labels that are not displayed, ChartDirector can optionally put a minor tick in its place. The argument specifies the spacing between minor ticks. For example, a value of 5 means displaying 1 minor tick for every 5 labels. The default value of 0 means no minor tick is used. |
| majorTickOffset | 0 | The offset used for selecting the labels. For example, if majorTickStep is set to 10, by default, ChartDirector will select the labels with index 0, 10, 20, 30 and so on. If the majorTickOffset argument is set to 3, then ChartDirector will select labels with index 3, 13, 23, 33 and so on. |
| minorTickOffset | -7fffffff | The offset used for selecting minor tick points. The usage is the same as the majorTickOffset argument, except it applies to minor tick points. The default is to use the same value as majorTickOffset. |
Some examples using this method:
CDAxisMBS.setLabelStyle(font as string = "", fontsize as Double = 8, fontcolor as Integer = &hffff0002, fontAngle as Double = 0) as CDTextBoxMBS
| Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
| method | ChartDirector | MBS ChartDirector Plugin | 8.2 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | All |
See Font Specification for details on various font attributes.
| Parameter | Default | Description |
|---|---|---|
| font | "" | The font used to draw the labels. |
| fontSize | 8 | The font size used to draw the labels in points. |
| fontColor | TextColor | The color used to draw the labels. |
| fontAngle | 0 | The rotation angle of the labels. |
Return Value
A TextBox object representing the prototype of the obj. This may be used to fine-tune the appearance of the obj.
See font specification here:
http://www.monkeybreadsoftware.net/faq-chartdirectorfontspecification.shtml
See also:
CDAxisMBS.setLabelStyle(font as string, fontsize as Double, fontcolor as color, fontAngle as Double = 0) as CDTextBoxMBS
| Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
| method | ChartDirector | MBS ChartDirector Plugin | 11.1 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | All |
See also:
CDAxisMBS.setLength(length as Integer)
| Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
| method | ChartDirector | MBS ChartDirector Plugin | 8.2 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | All |
CDAxisMBS.setLinearScale(formatString as string = "")
| Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
| method | ChartDirector | MBS ChartDirector Plugin | 8.2 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | All |
| Parameter | Default | Description |
|---|---|---|
| formatString | "" | The format used for the labels on the axis. Please refer to Axis.setLabelFormat for the syntax of the format string. An empty string means the format will be automatically determined. |
See also:
CDAxisMBS.setLinearScale(lowerLimit as Double, upperLimit as Double, labels() as string)
| Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
| method | ChartDirector | MBS ChartDirector Plugin | 8.2 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | All |
| Parameter | Default | Description |
|---|---|---|
| lowerLimit | (Mandatory) | The lower bound of the axis. |
| upperLimit | (Mandatory) | The upper bound of the axis. |
| labels | (Mandatory) | An array of text strings to be used as the labels on the axis. ChartDirector will distribute the labels evenly on the axis. By default, all labels are associated with major ticks. These can be modified by using '-' or '~' as the first character. Please refer to Axis.setLabels for details. |
See also:
CDAxisMBS.setLinearScale(lowerLimit as Double, upperLimit as Double, majorTickInc as Double = 0, minorTickInc as Double = 0)
| Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
| method | ChartDirector | MBS ChartDirector Plugin | 8.2 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | All |
| Parameter | Default | Description |
|---|---|---|
| lowerLimit | (Mandatory) | The lower bound of the axis. |
| upperLimit | (Mandatory) | The upper bound of the axis. |
| majorTickInc | 0 | Adds major ticks to the axis, where the major ticks are separated by majorTickInc in value. Each major tick will have an associated text label for the value if the axis at the tick. The default value of 0 means the major ticks will be automatically determined. In this case, the lowerLimit and upperLimit may be automatically adjusted to align with the ticks. Use kNoValue to disable major ticks. |
| minorTickInc | 0 | Adds minor ticks to the axis, where the minor ticks are separated by minorTickInc in value. The default value of 0 means no minor tick is used. |
See also:
CDAxisMBS.setLogScale(formatString as string = "")
| Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
| method | ChartDirector | MBS ChartDirector Plugin | 8.2 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | All |
| Parameter | Default | Description |
|---|---|---|
| formatString | "" | The format used for the labels on the axis. Please refer to Axis.setLabelFormat for the syntax of the format string. An empty string means the format will be automatically determined. |
See also:
CDAxisMBS.setLogScale(lowerLimit as Double, upperLimit as Double, labels() as string)
| Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
| method | ChartDirector | MBS ChartDirector Plugin | 8.2 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | All |
| Parameter | Default | Description |
|---|---|---|
| lowerLimit | (Mandatory) | The lower bound of the axis. |
| upperLimit | (Mandatory) | The upper bound of the axis. |
| labels | (Mandatory) | An array of text strings to be used as the labels on the axis. ChartDirector will distribute the labels evenly on the axis. By default, all labels are associated with major ticks. These can be modified by using '-' or '~' as the first character. Please refer to Axis.setLabels for details. |
See also:
CDAxisMBS.setLogScale(lowerLimit as Double, upperLimit as Double, majorTickInc as Double = 0, minorTickInc as Double = 0)
| Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
| method | ChartDirector | MBS ChartDirector Plugin | 8.2 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | All |
| Parameter | Default | Description |
|---|---|---|
| lowerLimit | (Mandatory) | The lower bound of the axis. |
| upperLimit | (Mandatory) | The upper bound of the axis. |
| majorTickInc | 0 | Adds major ticks to the axis, where the major ticks are separated by majorTickInc in ratio. For example, a value of 10 means each tick will be 10 times the value of the previous tick. Each major tick will have an associated text label for the value if the axis at the tick. The special predefined constant LogTick ( = 1.6e308) means the tick increment will be using the non-regular ratio 1, 2, 5, 10, 20, 50, 100, .... The default value of 0 means the major ticks will be automatically determined. In this case, the lowerLimit and upperLimit may be automatically adjusted to align with the ticks. Use kNoValue to disable major ticks. |
| minorTickInc | 0 | Adds minor ticks to the axis, where the minor ticks are separated by minorTickInc in ratio. |
The special constant LogTick means the tick increment will be using the non- regular ratio 1, 2, 5, 10, 20, 50, 100, ....
The default value of 0 means no minor tick is used.
See also:
CDAxisMBS.setMargin(topMargin as Integer, bottomMargin as Integer = 0)
| Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
| method | ChartDirector | MBS ChartDirector Plugin | 8.2 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | All |
This method is usually used to reserve space in the plot area. For example, if some margin is reserved at the top of the vertical y-axis, the top of the plot area will contain no data points. It is because this region would be outside the active range of the y-axis. If anything is put at the top of the plot area (such as a legend box or custom text), it will not overlap with the data points.
Note if auto-scaling is used, there is an alternative way to reserve space at the top and/or bottom of the plot area - the Axis.setAutoScale method.
| Parameter | Default | Description |
|---|---|---|
| topMargin | (Mandatory) | The margin reserved at the top end (or right end for horizontal axis) of the axis in pixels. |
| bottomMargin | 0 | The margin reserved at the bottom end (or left end for horizontal axis) of the axis in pixels. |
CDAxisMBS.setMinTickInc(value as Double)
| Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
| method | ChartDirector | MBS ChartDirector Plugin | 8.2 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | All |
The most common use of this method is to ensure the ticks are of integer values (the minimum distance set to 1).
ChartDirector auto-scaling will automatically determine the optimal number of ticks and labels on the axis. However, in some cases, the nature of the data may be such that the ticks should assume only certain discrete values (such as must be integers). This method will inform ChartDirector for this constraint when performing auto-scaling.
For a log scale axis, because the axis ticks are unevenly spaced, the minimum distance will be handled as the minimum value allowed for the axis scale.
| Parameter | Default | Description |
|---|---|---|
| inc | (Mandatory) | The minimum distance between two ticks on the axis as a data value. |
CDAxisMBS.setMultiFormat(filter as Integer, format as string, labelSpan as Integer = 1, promoteFirst as boolean=true)
| Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
| method | ChartDirector | MBS ChartDirector Plugin | 8.2 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | All |
Please refer to Axis.setMultiFormat on how to use this method.
| Parameter | Default | Description |
|---|---|---|
| filterId | (Mandatory) | The filter that defines a subset of labels. |
| formatString | (Mandatory) | The format string for formatting the subset defined by the above filter. |
| labelSpan | 1 | The number of label positions that are claimed by one label. If a label occupies more than 1 position, ChartDirector will not put labels on nearby positions, even if they meet the filter criteria. |
| promoteFirst | true | If set to true, the first label will be promoted to a higher filter category in the multi-format list. |
See also:
Some examples using this method:
CDAxisMBS.setMultiFormat(filter1 as Integer, format1 as string, filter2 as Integer, format2 as string, labelSpan as Integer = 1, promoteFirst as boolean=true)
| Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
| method | ChartDirector | MBS ChartDirector Plugin | 8.2 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | All |
This method is typically used to format date/time labels. For example, for an axis that spans 90 days, this method can be used to format the first labels of each month in bold as "mmm-dd", while other labels are shown in normal font as "dd".
The multiple formats are defined as a list of filters and format strings. If the label value satisfies the first filter, it will be formatted using the first format string. Otherwise if the label value satisfies the second filter, it will be formatted using the second format string, and so on. If a label value does not satisfy any filter, it will be discarded.
In the above example, the first filter can be a "start of month" filter (created using Chart::StartOfMonthFilter), and the first format string can be "{value|mmm-dd}". The second filter can be the "all pass" filter (created using Chart::AllPassFilter), and the format string can be "{value|dd}".
Supported filters in ChartDirector include:
| Filter | Description |
|---|---|
| Chart::StartOfHourFilter | Creates a data filter that matches date/times that represent the start of a new hour in a date/time series. |
| Chart::StartOfDayFilter | Creates a data filter that matches date/times that represent the start of a new day in a date/time series. |
| Chart::StartOfWeekFilter | Creates a data filter that matches date/times that represent the start of a new week in a date/time series. |
| Chart::StartOfMonthFilter | Creates a data filter that matches date/times that represent the start of a new month in a date/time series. |
| Chart::StartOfYearFilter | Creates a data filter that matches date/times that represent the start of a new year in a date/time series. |
| Chart::RegularSpacingFilter | Creates a data filter that matches 1 out of every N elements. |
| Chart::AllPassFilter | Creates a data filter that matches every element. |
| Chart::NonePassFilter | Creates a data filter that matches no element. |
| Chart::SelectItemFilter | Creates a data filter that matches one specified item. |
For the format strings, please refer to Parameter Substitution and Formatting on their syntax.
A single setMultiFormat method supports two filters and two format strings. You can use multiple setMultiFormat methods to add more filters and format strings.
One common issue in putting labels on the axis is that there may be too many labels on the axis. The setMultiFormat method supports a labelSpan argument that specifies how many label positions a single label will occupy. If a label occupies more than 1 position, ChartDirector will not put labels on nearby positions, even if they meet the filter criteria.
The setMultiFormat method supports special handling of the first label on the axis. For example, in the above example, we may want to show the the first label as "mmm-dd", even if it is not actually the "start of month". The promoteFirst argument, if set to true, will cause the first label to be promoted to a higher filter category in the multi-format list. For example, if the first label satisfies only the second filter, it will be formatted as if it satisfies the first filter.
| Parameter | Default | Description |
|---|---|---|
| filter1 | (Mandatory) | The filter that defines the first kind of labels. |
| format1 | (Mandatory) | The format string for the first kind of labels. |
| filter2 | (Mandatory) | The filter that defines the second kind of labels. |
| format2 | (Mandatory) | The format string for the second kind of labels. |
| labelSpan | 1 | The number of label positions that are claimed by one label. If a label occupies more than 1 position, ChartDirector will not put labels on nearby positions, even if they meet the filter criteria. |
| promoteFirst | true | If set to true, the first label will be promoted to a higher filter category in the multi-format list. |
See also:
CDAxisMBS.setOffset(x as Integer, y as Integer)
| Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
| method | ChartDirector | MBS ChartDirector Plugin | 9.2 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | All |
By default, ChartDirector draws horizontal axes at the top/bottom borders of the plot area, and vertical axes at the left/right borders of the plot area.
This method can be used to shift an axis from its standard position.
Arguments:
| Argument | Default | Description |
|---|---|---|
| x | (Mandatory) | The x offset in pixels. |
| y | (Mandatory) | The y offset in pixels. |
The items on this page are in the following plugins: MBS ChartDirector Plugin.