Platforms to show: All Mac Windows Linux Cross-Platform

Back to CDPieChartMBS class.

CDPieChartMBS.Constructor(width as Integer = 640, height as Integer = 480, bgcolor as color, edgeColor as color, raisedEffect as Integer = 0)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method ChartDirector MBS ChartDirector Plugin 11.1 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Same as the other Constructor method, but uses color instead of integer data type for passing color values.

See also:

CDPieChartMBS.Constructor(width as Integer = 640, height as Integer = 480, bgcolor as Integer = &hFFFF0000, edgeColor as Integer = &hFF000000, raisedEffect as Integer = 0)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method ChartDirector MBS ChartDirector Plugin 8.2 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Creates a new PieChart object.

ArgumentDefaultDescription
width(Mandatory)The width of the chart in pixels.
height(Mandatory)The height of the chart in pixels.
bgColorBackgroundColorThe background color of the chart.
edgeColorTransparentThe edge color of the chart.
raisedEffect0The 3D border width. For positive values, the border will appear raised. For negative values, the border will appear depressed. A zero value means the border will appear flat.

See also:

CDPieChartMBS.sector(sectorNo as Integer) as CDSectorMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method ChartDirector MBS ChartDirector Plugin 8.2 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Retrieves the Sector object representing a single sector in the pie chart.

ArgumentDefaultDescription
sectorNo(Mandatory)The sector number of the sector to retrieve, starting from 0. The first sector is 0. The nth sector is (n-1).
Return Value
The requested Sector object.

CDPieChartMBS.set3D(depth as Integer = -1, angle as Double = -1, shadowMode as boolean=false)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method ChartDirector MBS ChartDirector Plugin 8.2 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Adds 3D effects to the pie.

ArgumentDefaultDescription
depth-1The 3D depth of the pie in pixels. -1 means the depth is automatically determined.
angle-1The 3D view angle in degrees. Must be 0 - 90 for standard 3D mode, and 0 - 360 in shadow 3D mode. -1 means the angle is automatically determined.
shadowModefalseFlag to indicate whether the pie is in standard 3D or shadow 3D mode. A true value means shadow 3D mode. A false value means standard 3D mode.

See also:

CDPieChartMBS.set3D(depths() as Double, angle as Double = 45, shadowMode as boolean=false)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method ChartDirector MBS ChartDirector Plugin 8.2 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Adds 3D effects to the pie, where each sector can have a different 3D depth.

ArgumentDefaultDescription
depths(Mandatory)An array of integers representing the 3D depths for the sectors.
angle45The 3D view angle in degrees. Must be 0 - 90 for standard 3D mode, and 0 - 360 in shadow 3D mode. -1 means the angle is automatically determined.
shadowModefalseFlag to indicate whether the pie is in standard 3D or shadow 3D mode. A true value means shadow 3D mode. A false value means standard 3D mode.

See also:

CDPieChartMBS.setData(data() as Double)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method ChartDirector MBS ChartDirector Plugin 9.2 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Sets the data used to draw the pie chart.

ArgumentDefaultDescription
data(Mandatory)An array of numbers representing the data points.
labels[Empty_Array]An array of text strings representing the labels of the sectors. An empty array means no sector label.

See also:

CDPieChartMBS.setData(data() as Double, label() as string)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method ChartDirector MBS ChartDirector Plugin 8.2 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Sets the data used to draw the pie chart.

ArgumentDefaultDescription
data(Mandatory)An array of numbers representing the data points.
labels[Empty_Array]An array of text strings representing the labels of the sectors. An empty array means no sector label.

See also:

CDPieChartMBS.setDonutSize(x as Integer, y as Integer, r as Integer, r2 as Integer)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method ChartDirector MBS ChartDirector Plugin 8.2 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Sets the position and size of the donut in the donut chart.

ArgumentDefaultDescription
x(Mandatory)The x coordinate of the donut center.
y(Mandatory)The y coordinate of the donut center.
r(Mandatory)The inner radius of the donut.
r2(Mandatory)The outer radius of the donut.

Some examples using this method:

CDPieChartMBS.setExplode(sectorNo as Integer, distance as Integer = -1)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method ChartDirector MBS ChartDirector Plugin 8.2 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Explode a sector from the pie.

ArgumentDefaultDescription
sectorNo(Mandatory)The sector number of the sector to be exploded from the pie, starting from 0. The first sector is 0. The nth sector is (n - 1).
distance-1The explosion distance in pixels. -1 means the distance is automatically determined.

CDPieChartMBS.setExplodeGroup(startSector as Integer, endSector as Integer, distance as Integer = -1)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method ChartDirector MBS ChartDirector Plugin 8.2 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Explode a group of sectors from the pie.

ArgumentDefaultDescription
startSector(Mandatory)The sector number of the first sector in the sector group to be exploded. The first sector is 0. The nth sector is (n - 1).
endSector(Mandatory)The sector number of the last sector in the sector group to be exploded. The first sector is 0. The nth sector is (n - 1).
distance-1The explosion distance in pixels. -1 means the distance is automatically determined.

Some examples using this method:

CDPieChartMBS.setJoinLine(joinLineColor as color, joinLineWidth as Integer = -1)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method ChartDirector MBS ChartDirector Plugin 11.1 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Same as the other setJoinLine method, but uses color instead of integer data type for passing color values.

See also:

CDPieChartMBS.setJoinLine(joinLineColor as Integer, joinLineWidth as Integer = -1)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method ChartDirector MBS ChartDirector Plugin 8.2 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Sets the color and width of the join lines used to connect the sector labels to the sector perimeter.

This method affects all sectors. To set the color and width of the join line for one particular sector only, use Sector.setJoinLine.

By default, for circular label layout, the join line color is Transparent. For side label layout, the join line color is SameAsMainColor.
ArgumentDefaultDescription
joinLineColor(Mandatory)The color of the line that joins the sector perimeter with the sector label.
joinLineWidth1The line width of the join line.

See also:

CDPieChartMBS.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
Sets the format of the all sector labels.
Example
dim c as CDPieChartMBS

// you can use label formats like this:

c.setLabelFormat("<*block,halign=left*><*font=timesbi.ttf,size=12,underline=1*>{label}<*/font*><*br*>US$ {value}K ({percent}%)")

// we can reduce that to this:

c.setLabelFormat("{label} {value} {percent}%")

// and it shows 3 numbers. With |1 after the variable name, we define the decimals after dot:

c.setLabelFormat("{label} {value|1} {percent|1}%")

// and

c.setLabelFormat("{label} {value|1.,} {percent|1.,}%")

// uses dot for thousands and comma for decimal separator.

This method affects all sectors. To set the label format for one particular sector only, use Sector.setLabelFormat.

The default sector label format depends on the label layout method used (see PieChart.setLabelLayout).

Label Layout MethodDefault Label Format
Circular Layout{label}&lt;*br*&gt;{percent}%
(The "&lt;*br*&gt;" above is the CDML syntax for a line break.)
Side Layout{label} ({percent}%)


Please refer to Parameter Substitution and Formatting on all available parameters and how to format them.
ArgumentDefaultDescription
formatString(Mandatory)The format string.

CDPieChartMBS.setLabelLayout(layoutMethod as Integer, pos as Integer = -1, topBound as Integer = -1, bottomBound as Integer = -1)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method ChartDirector MBS ChartDirector Plugin 8.2 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Sets the layout method and location of the sector labels.

This method affects all sectors. To set the sector label layout method and location for one particular sector only, use Sector.setLabelLayout.

ChartDirector supports two sector label layout methods - circular layout and side layout. The layout method is determined using the layoutMethod argument, which must be one of the following predefined constants.

ConstantValueDescription
SideLayout0Side Label Layout
CircleLayout1Circular Label Layout

In the circular layout method, the sector labels are positioned around the perimeter of the pie.

In the side layout method, there is an invisible rectangle containing the pie, where the rectangle can be wider than the diameter of the pie.The sector labels are positioned on the left and right sides outside the rectangle. Because the labels can be quite far away from the sectors, join lines are typically used to connect the labels to the sectors.

The circular layout method usually uses less space and is the default layout method. However, if the pie chart contains a lot of small sectors, the labels may overlap with each others, due to insufficient space on the pie perimeter to position the labels.

The side layout method has the advantages that it can avoid label overlapping. In the side layout method, labels will automatically shift up and down to avoid overlapping.

One common issue in pie charts is the data contain a lot of small sectors. If the data are sorted, the small sectors will be crowded together instead of distributed evenly. Although the side layout method can avoid label overlapping by shifting the labels up and down, some labels may need to be shifted great distances.

Label layout can often be improved if the small sectors are near the horizontal axis. It is because the amount of vertical label space for a sector is greatest at the horizontal axis. This can be achieved by choosing an appropriate start angle (using PieChart.setStartAngle).

If the data is in ascending order (small sectors crowded at the beginning), a start angle of 45 degrees with clockwise sector layout is recommended. With this setting, the first few sectors (the smallest sectors) will be at around 45 - 135 degrees, so is near the horizontal axis (90 degrees). Similarly, if the data is in descending order (small sectors crowded at the end), a start angle of 135 degrees with clockwise sector layout can be used.
ArgumentDefaultDescription
layoutMethod(Mandatory)Specify the layout method. Must be one of the predefined constants CircleLayout or SideLayout.
pos-1For circular layout, it is the distance between the sector perimeter and the sector label. A negative value (but not -1) means the sector label will be drawn in the interior of the sector.

For side layout, it is the distance between the pie perimeter and the left or right edges of the invisible containing rectangle (equal to the width of the rectangle minus the pie diameter and then divided by 2).

In either case, -1 means the distance is automatically determined.
topBound-1This parameter applies only to side label layout. It controls the top bound of the labels (the minimum y coordinate), thereby limiting the extent that the labels can be shifted up to avoid overlapping. This parameter is typically used avoid the labels from moving up too much and overlap with other chart objects (such as the chart title).
bottomBound-1This parameter applies only to side label layout. It controls the bottom bound of the labels (the maximum y coordinate), thereby limiting the extent which the labels can be shifted down to avoid overlapping. This parameter is typically used to avoid the labels from moving down too much and overlap with other chart objects.

CDPieChartMBS.setLabelPos(pos as Integer, joinLineColor as color)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method ChartDirector MBS ChartDirector Plugin 11.1 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Same as the other setLabelPos method, but uses color instead of integer data type for passing color values.

See also:

CDPieChartMBS.setLabelPos(pos as Integer, joinLineColor as Integer = -1)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method ChartDirector MBS ChartDirector Plugin 8.2 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Sets the circular label layout method, and configure the join lines used to connect the sector labels to the sector perimeter.

This method affects all sectors. To set the sector label position or join line color for one particular sector only, use Sector.setLabelPos.
ArgumentDefaultDescription
pos(Mandatory)The distance between the sector perimeter and the sector label. A negative value means the sector label will be drawn in the interior of the sector.
joinLineColor-1The color of the line that joins the sector perimeter with the sector label. The default is Transparent. The join line is ignored if the sector label is inside the sector.

See also:

CDPieChartMBS.setLabelStyle(font as string = "", fontsize as Double = 8, fontColor as Integer = &hffff0002) as CDTextBoxMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method ChartDirector MBS ChartDirector Plugin 8.2 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Sets the style used to draw all sector labels.

This method affects all sectors. To set the label style for one particular sector only, use Sector.setLabelStyle.

See Font Specification for details on various font attributes.
ArgumentDefaultDescription
font""The font used to draw the sector labels.
fontSize8The font size in points.
fontColorTextColorThe text color for the sector 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:

CDPieChartMBS.setLabelStyle(font as string, fontsize as Double, fontColor as color) as CDTextBoxMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method ChartDirector MBS ChartDirector Plugin 11.1 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Same as the other setLabelStyle method, but uses color instead of integer data type for passing color values.

See also:

CDPieChartMBS.setLineColor(edgeColor as color, joinLineColor as color)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method ChartDirector MBS ChartDirector Plugin 11.1 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Same as the other setLineColor method, but uses color instead of integer data type for passing color values.

See also:

Some examples using this method:

CDPieChartMBS.setLineColor(edgeColor as Integer, joinLineColor as Integer = -1)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method ChartDirector MBS ChartDirector Plugin 8.2 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Sets the sector edge color and join line color.

This method affects all sectors. To set the sector label position and join line color for one particular sector, use Sector.setColor.
ArgumentDefaultDescription
edgeColor(Mandatory)The colors for the edges of the sectors. By default, the edge color is SameAsMainColor, which means the edge color is the same as the fill color of the sector, and the sector will appear borderless.
joinLineColor-1The color of the line that join the sector perimeter with the sector label. By default, for circular label layout, the join line color is Transparent. For side label layout, the join line color is SameAsMainColor.

See also:

CDPieChartMBS.setPieSize(x as Integer, y as Integer, r as Integer)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method ChartDirector MBS ChartDirector Plugin 8.2 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Sets the position and size of the pie in the pie chart.

ArgumentDefaultDescription
x(Mandatory)The x coordinate of the pie center.
y(Mandatory)The y coordinate of the pie center.
r(Mandatory)The radius of the pie.

Some examples using this method:

CDPieChartMBS.setSectorStyle(shadingMethod as Integer, edgeColor as Integer = -1, edgeWidth as Integer = -1)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method ChartDirector MBS ChartDirector Plugin 9.2 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Sets the sector shading style, edge color and edge width.

This method affects all sectors. To set the sector shading style, edge color and edge width for one particular sector, use CDSectorMBS.setStyle.

ChartDirector supports various shading effects, which are best illustrated using examples.

The followings are textual descriptions of the shading effects.

ConstantValueDescription
DefaultShading0This is the default shading method. The top surfaces are shaded with flat colors. For 3D sectors, the cylindrical surfaces are shaded with cylindrical lighting effects.
FlatShading1All surfaces are shaded with flat colors.
LocalGradientShading2The top surfaces are shaded with linear gradient colors. For each sector, the gradient is from the bottom of the sector bounding box to the top of the sector bounding box, with the bottom side brighter and the top side darker. For 3D sectors, the cylindrical surfaces are shaded with cylindrical lighting effects.
GlobalGradientShading3The top surfaces are shaded with linear gradient colors. The gradient is from the bottom the pie bounding box to the top of the pie bounding box, with the bottom side brighter and the top side darker. For 3D sectors, the cylindrical surfaces are shaded with cylindrical lighting effects.
ConcaveShading4The top surfaces are shaded with a special effect so that they look concave, with the pie center appears to be depressed relative to the perimeter. For 3D sectors, the cylindrical surfaces are shaded with cylindrical lighting effects.
RoundedEdgeShading6The top surfaces are shaded with a special effect so that the pie looks raised with a rounded raised edge at the perimeter.
RadialShading7The top surfaces are shaded with radial gradient colors, with the pie center brighter and the perimeter darker. For 3D sectors, the cylindrical surfaces are shaded with cylindrical lighting effects.
RingShading8This effect is intended to be used with 2D donut charts only. The top surfaces are shaded with a special effect so that a 2D donut will look like a torus.

Arguments:
ArgumentDefaultDescription
shadingMethod(Mandatory)The sector shading style to use, which must be one of the constants in the table above. -1 means to keep the existing value unchanged.
edgeColor-1The edge color of the sectors. -1 means to keep the existing value unchanged.
edgeWidth-1The edge width of the sectors. -1 means to keep the existing value unchanged.

See also:

CDPieChartMBS.setStartAngle(startAngle as Double, clockWise as boolean=true)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method ChartDirector MBS ChartDirector Plugin 8.2 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Sets the angle of the first sector in the pie and the layout direction for the sectors.

By default, the start angle is 0 degree (the upward pointing direction), and subsequent sectors are drawn clockwise.
ArgumentDefaultDescription
startAngle(Mandatory)The angle to start drawing the first sector in degrees. The angle is measured from the upward pointing direction in the clockwise direction.
clockWisetrueFlag to control the layout direction of the sectors. A true value means clockwise. A false value means anti-clockwise.

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


The biggest plugin in space...