Platforms to show: All Mac Windows Linux Cross-Platform

Back to CDBaseChartMBS class.

CDBaseChartMBS.getAbsOffsetX as Integer

Type Topic Plugin Version macOS Windows Linux iOS Targets
method ChartDirector MBS ChartDirector Plugin 12.3 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Gets the x offset of the chart relative to the outermost MultiChart container.

Returns an integer representing the x offset in pixels relative to the outermost MultiChart container, or 0 if the chart is not within a MultiChart container.

Some examples using this method:

CDBaseChartMBS.getAbsOffsetY as Integer

Type Topic Plugin Version macOS Windows Linux iOS Targets
method ChartDirector MBS ChartDirector Plugin 12.3 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Gets the y offset of the chart relative to the outermost MultiChart container.

Returns an integer representing the y offset in pixels relative to the outermost MultiChart container, or 0 if the chart is not within a MultiChart container.

Some examples using this method:

CDBaseChartMBS.getChartMetrics as string

Type Topic Plugin Version macOS Windows Linux iOS Targets
method ChartDirector MBS ChartDirector Plugin 8.2 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Gets the chart metrics for passing to CChartViewer to support view ports.

The format of the chart metrics is not published.
Return Value
A text string representing the chart metrics.

Some examples using this method:

CDBaseChartMBS.getColor(index as Integer) as Integer

Type Topic Plugin Version macOS Windows Linux iOS Targets
method ChartDirector MBS ChartDirector Plugin 8.2 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Gets the color at the specified position of the palette.

See Color Specification on how colors are represented in ChartDirector.
ArgumentDefaultDescription
paletteEntry(Mandatory)An index to the palette.
Return Value
The requested color.

CDBaseChartMBS.getDrawArea as CDDrawAreaMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method ChartDirector MBS ChartDirector Plugin 8.2 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Retrieves the internal DrawArea object that is used to draw the chart.

The most common reason of accessing the internal DrawArea object is to add custom drawings (lines, texts, shapes, etc) to the chart.

If the custom drawings are drawn before drawing the chart image (eg. using BaseChart.makeChart, BaseChart.makeChart or BaseChart.makeChart3), the custom drawings will be at the background of the chart.
Return Value
A DrawArea object that can be used to add custom text and shapes to the chart.

Some examples using this method:

CDBaseChartMBS.getHeight as Integer

Type Topic Plugin Version macOS Windows Linux iOS Targets
method ChartDirector MBS ChartDirector Plugin 9.2 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Gets the height of the chart.

CDBaseChartMBS.getHTMLImageMap(url as string, queryFormat as string = "", extraAttr as string = "", offsetX as Integer = 0, offsetY as Integer = 0) as string

Type Topic Plugin Version macOS Windows Linux iOS Targets
method ChartDirector MBS ChartDirector Plugin 8.2 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Generates an HTML image map for the chart.

This method generates an image map to represent all data points on the chart. It does not include legend box, title box or custom text box. Please use LegendBox.getHTMLImageMap or Box.getImageCoor to produce image maps for these objects.

This method should be called only after creating the chart image (eg. using BaseChart.makeChart, BaseChart.makeChart or BaseChart.makeChart3). The image map cannot be determined without creating the chart image first.

This method accepts a URL as its argument. When generating an image map, it appends query parameters to the URL to indicate which data point the user has clicked.

The following is an example image map generated for a bar chart with 3 bars.

<area shape="rect" coords="34,219,63,139" href="myurl.cpp?x=0&xLabel=Mon&dataSet=0&dataSetName=Revenue&value=100">
<area shape="rect" coords="74,219,103,119" href="myurl.cpp?x=1&xLabel=Tue&dataSet=0&dataSetName=Revenue&value=125">
<area shape="rect" coords="114,219,143,22" href="myurl.cpp?x=2&xLabel=Wed&dataSet=0&dataSetName=Revenue&value=245.78">

The image map consists of multiple <area> tags, one for each bar in the chart. In the "href" attributes, query parameters are appended to the URL to provide information on the bar clicked.

The image map produces by ChartDirector does not include the <map> and </map> tag. This is intentional so that you can add additional custom <area> tags to the image map, or append multiple image maps together.

The type of query parameters to append to the URL depends on the chart type and layer type. The default query parameters are as follows.

Chart/Layer TypeDefault Query Format
Pie chartsector={sector}&label={label}&value={value}&percent={percent}
Bar, Line, Spline, Step Line, Area and Scatter layersx={x}&xLabel={xLabel}&dataSet={dataSet}&dataSetName={dataSetName}&value={value}
Percentage Bar and Percentage Area layersx={x}&xLabel={xLabel}&dataSet={dataSet}&dataSetName={dataSetName}&value={value}&percent={percent}
HLOC and CandleStick layersx={x}&xLabel={xLabel}&high={high}&low={low}&open={open}&close={close}
Box-Whisker layerx={x}&xLabel={xLabel}&top={top}&bottom={bottom}&max={max}&min={min}&med={med}
Trend layerdataSetName={dataSetName}
Vector layer and Polar Vector layerx={x}&xLabel={xLabel}&dataSetName={dataSetName}&value={value}&dir={dir}&len={len}
Polar Line, Area, Spline Line and Spline Area layers"x={x}&label={label}&name={name}&value={value}"

The texts in curly brackets (e.g. {sector}, {dataSet}, etc.) will be replaced by the actual values when generating the image map. For example, {sector} will be replaced by the sector number of the sector.

ChartDirector allows developers to modify the query parameters by using the queryFormat argument. For example, if "x={x}&v={value}" is used as the queryFormat for a XYChart, only the x position and the value of the data point will be included in query parameters.

Please refer to Parameter Substitution and Formatting on all available parameters and their meanings.

In addition to customizing the query parameters, ChartDirector supports additional HTML attributes in the <area> tags by using the extraAttr argument.

For example, the following extraAttr will add an "title" HTML attribute to every <area> tag. The attribute which will contain the x-axis label and the value of the data point. The "title" attribute will be displayed as "tool tip" when the mouse moves over the image map.

title='{xlabel}:{value}'
Another common usage of the extraAttr argument is to add "onmouseover" and "onmouseout" HTML attributes to handle user interaction using Javascript on the browser.
ArgumentDefaultDescription
url(Mandatory)The URL to be used in the "href" attribute of the image map. Parameter Substitution and Formatting is supported. Use an empty string if no href attribute is needed.
queryFormat""A text string representing the template of the query parameters to be appended to the URL. Parameter Substitution and Formatting is supported.

The special keyword "{default}" represents the default query parameters. This is useful for specifying appending to the default.

Note that an empty string means to use the default query query parameters. To specify no query parameter, use a space character.
extraAttr""A text string to specify additional attributes to add to the <area> tag. Parameter Substitution and Formatting is supported.
offsetX0An offset to be added to all x coordinates in the image map. This is useful if the current image will be shifted and inserted into another image. In this case, the image map will need to be shifted by the same offset.
offsetY0An offset to be added to all y coordinates in the image map. See offsetX above for description.
Return Value
A text string containing the image map generated.

CDBaseChartMBS.getLegend as CDLegendBoxMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method ChartDirector MBS ChartDirector Plugin 8.2 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Gets the LegendBox object representing the legend box in the chart.

The LegendBox obtains using this method is not fixed. This allows you to add more keys to the legend box, and change the legend box fonts, etc. However, this also means that the legend box size (Box.getWidth and Box.getHeight) is undefined.

To obtain the width and height of the legend box, use BaseChart.layoutLegend.
Return Value
The LegendBox object representing the legend box in the chart.

Some examples using this method:

CDBaseChartMBS.getWidth as Integer

Type Topic Plugin Version macOS Windows Linux iOS Targets
method ChartDirector MBS ChartDirector Plugin 9.2 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Gets the width of the chart.

CDBaseChartMBS.gradientColor(colors() as Integer, angle as Double = 90, scale as Double = 1.0, startX as Integer = 0, startY as Integer = 0) as Integer

Type Topic Plugin Version macOS Windows Linux iOS Targets
method ChartDirector MBS ChartDirector Plugin 8.2 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Creates a multi-point linear gradient color.

This method is for backward compatibility. Use BaseChart.linearGradientColor2 instead.
ArgumentDefaultDescription
colorArray(Mandatory)An array defining the positions and colors of the pixels along the reference gradient line segment.
angle90The direction of the reference gradient line segment in degrees, measured clockwise, with 0 degree as the upward pointing direction. The default direction is horizontal from left to right (90 degrees).
scale1.0The scaling factor for the reference gradient line segment. By default, the reference gradient line segment is 256 pixels in length. The scaling factor can be use to stretch or compress the gradient line segment.
startX0The x coordinate of the starting point of the reference gradient line segment.
startY0The y coordinate of the starting point of the reference gradient line segment.
Return Value
A 32-bit integer representing the linear gradient color.

See also:

CDBaseChartMBS.gradientColor(startX as Integer, startY as Integer, endX as Integer, endY as Integer, startColor as Integer, endColor as Integer) as Integer

Type Topic Plugin Version macOS Windows Linux iOS Targets
method ChartDirector MBS ChartDirector Plugin 8.2 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Creates a two-point linear gradient color.

This method is for backward compatibility. Use BaseChart.linearGradientColor instead.
ArgumentDefaultDescription
startX(Mandatory)The x coordinate of the starting point of the reference gradient line segment.
startY(Mandatory)The y coordinate of the starting point of the reference gradient line segment.
endX(Mandatory)The x coordinate of the ending point of the reference gradient line segment.
endY(Mandatory)The y coordinate of the ending point of the reference gradient line segment.
startColor(Mandatory)The color at the starting point of the reference gradient line segment.
endColor(Mandatory)The color at the ending point of the reference gradient line segment.
Return Value
A 32-bit integer representing the linear gradient color.

See also:

The items on this page are in the following plugins: MBS ChartDirector Plugin.


The biggest plugin in space...