public class PieChartWidget extends ChartWidget
PieChartWidget A Dashboard Utility Widget that displays a pie chart where the data values all add up to 100%
Modifier and Type | Field and Description |
---|---|
BBjVector | Columns! A vector of columns indicating which fields in the BBjRecordSet will be used to provide data for the widget |
BBjString | ConnectString$ A JDBC connect string used to connect to the database |
BBjNumber | IsCircular A number indicating whether the pie chart is circular or stretched into an elliptical shape |
BBjNumber | NumSlices A number indicating the number of slices in the pie chart |
BBjRecordSet | RecordSet! A BBjRecordSet used to provide data for the widget |
BBjString | SQL$ A SQL query used to provide data for the widget |
BBjNumber | StartAngle A number indicating the starting angle of the pie chart. The initial default value is 90 degrees, which corresponds to 12 o'clock. A value of zero corresponds to 3 o'clock. |
BASIS_DASHBOARD_UTILITY_FILL_ERROR_ACTION_KEY_NAME$, CachedImage!, DashboardWidget!, FillErrorAction, ON_FILL_ERROR_IGNORE, ON_FILL_ERROR_STOP, ON_FILL_ERROR_WARN, UserData! Fields inherited from class BBjWidget
BASIS_UTILITY_DEVICE_PIXEL_RATIO_KEY_NAME$, DevicePixelRatio! Fields inherited from class ChartWidget
ColorThemeAgate, ColorThemeAntiquePewter, ColorThemeAntler, ColorThemeBamboo, ColorThemeBeachStrata, ColorThemeBerryPreserves, ColorThemeBerryTart, ColorThemeBiscayneBay, ColorThemeBlackberries, ColorThemeBloodOrange, ColorThemeBlue, ColorThemeBlueFrost, ColorThemeBlueJewel, ColorThemeBluesAndBrowns, ColorThemeBreezy, ColorThemeBreezyToo, ColorThemeBrown, ColorThemeBrownFur, ColorThemeCamo, ColorThemeCampsite, ColorThemeCanary, ColorThemeChocolateRaspberry, ColorThemeCitrus, ColorThemeCoastline, ColorThemeColorful1, ColorThemeColorful2, ColorThemeColorful3, ColorThemeColorful4, ColorThemeColorful5, ColorThemeColorful6, ColorThemeColorful7, ColorThemeCoral, ColorThemeCranberry, ColorThemeCranberryTart, ColorThemeDarkToLight, ColorThemeDeepBlueSea, ColorThemeDefault, ColorThemeDismal, ColorThemeDivergentBlueTanGreen, ColorThemeDivergentBlueTanRed, ColorThemeDivergentBlueWhiteRed, ColorThemeDivergentRedOrangeRed, ColorThemeDriedRoses, ColorThemeEarlyAmerican, ColorThemeEarthTones1, ColorThemeEarthTones2, ColorThemeEarthTones3, ColorThemeEscape, ColorThemeEveningThunder, ColorThemeFeathers, ColorThemeFlorida, ColorThemeGray, ColorThemeGrayscaleTransparent, ColorThemeGreen, ColorThemeHeirloom, ColorThemeHomestyle, ColorThemeIcyLeaves, ColorThemeIndex, ColorThemeLakeside, ColorThemeLavender, ColorThemeMargarita, ColorThemeMistyGarden, ColorThemeMountainMist, ColorThemeMountainSunset, ColorThemeOliveBranch, ColorThemeOrange, ColorThemePeacock, ColorThemePetals, ColorThemePomegranate, ColorThemePowderedCookie, ColorThemePurple, ColorThemePurpleBerry, ColorThemeRed, ColorThemeRetro, ColorThemeRooster, ColorThemeRope, ColorThemeRosemary, ColorThemeSandyBeach, ColorThemeSeaFoam, ColorThemeSepia, ColorThemeSky, ColorThemeTomorrowDark, ColorThemeTomorrowLight, ColorThemeTropicalSunset, ColorThemeWatermelon, ColorThemeWinterRobin, CustomChartColors!, DATA_ITEM_LABEL_POSITION_INSIDE_BOTTOM, DATA_ITEM_LABEL_POSITION_INSIDE_CENTER, DATA_ITEM_LABEL_POSITION_INSIDE_LEFT, DATA_ITEM_LABEL_POSITION_INSIDE_RIGHT, DATA_ITEM_LABEL_POSITION_INSIDE_TOP, DATA_ITEM_LABEL_POSITION_OUTSIDE_BOTTOM, DATA_ITEM_LABEL_POSITION_OUTSIDE_LEFT, DATA_ITEM_LABEL_POSITION_OUTSIDE_RIGHT, DATA_ITEM_LABEL_POSITION_OUTSIDE_TOP, HAlignCenter!, HAlignLeft!, HAlignRight!, LastRenderedImage!, LEGENDSHAPE_CAPSULE, LEGENDSHAPE_CIRCLE, LEGENDSHAPE_DIAMOND, LEGENDSHAPE_ELLIPSE, LEGENDSHAPE_RECTANGLE, LEGENDSHAPE_ROUNDEDRECTANGLE, LEGENDSHAPE_SQUARE, SideBottom!, SideLeft!, SideRight!, SideTop!, TipBackColor$, TipBackColorOpacity, TipDisplayTime, TipForeColor$, TipForeColorOpacity, VAlignBottom!, VAlignCenter!, VAlignTop!
Constructor Summary
Constructors Constructor and Description PieChartWidget(BBjString p_name$, BBjString p_title$, BBjString p_previewText$, BBjString p_previewImage$, BBjString p_chartTitle$, BBjNumber p_flat, BBjNumber p_legend)
Create an empty Pie Chart specifying all parameters to be filled after creation with setDataSetValue()
Note: As of BBj 23.00, the Dashboard Utility uses JFreeCharts 1.5.x which removes the pseudo-3D charts. Therefore,
the p_flat parameter will be ignored in version 23 and higher.
PieChartWidget(BBjString p_name$, BBjString p_title$, BBjString p_previewText$, BBjString p_previewImage$, BBjString p_chartTitle$, BBjNumber p_flat, BBjNumber p_legend, BBjNumber p_numSlices)
Create an empty Pie Chart specifying all parameters to be filled after creation with setDataSetValue()
Note: As of BBj 23.00, the Dashboard Utility uses JFreeCharts 1.5.x which removes the pseudo-3D charts. Therefore,
the p_flat parameter will be ignored in version 23 and higher.
PieChartWidget(BBjString p_name$, BBjString p_title$, BBjString p_previewText$, BBjString p_previewImage$, BBjString p_chartTitle$, BBjNumber p_flat, BBjNumber p_legend, BBjString p_connectString$, BBjString p_sql$)
Create an SQL-based Pie Chart specifying all parameters
Note: As of BBj 23.00, the Dashboard Utility uses JFreeCharts 1.5.x which removes the pseudo-3D charts. Therefore,
the p_flat parameter will be ignored in version 23 and higher.
PieChartWidget(BBjString p_name$, BBjString p_title$, BBjString p_previewText$, BBjString p_previewImage$, BBjString p_chartTitle$, BBjNumber p_flat, BBjNumber p_legend, BBjRecordSet p_rs!, BBjVector p_columns!)
Create a BBjRecordSet-based Pie Chart specifying all parameters
Note: As of BBj 23.00, the Dashboard Utility uses JFreeCharts 1.5.x which removes the pseudo-3D charts. Therefore,
the p_flat parameter will be ignored in version 23 and higher.
PieChartWidget(BBjString p_name$, BBjString p_title$, BBjString p_previewText$, BBjString p_previewImage$, BBjString p_chartTitle$, BBjNumber p_flat, BBjNumber p_legend, BBjString p_connectString$, BBjString p_sql$, BBjString p_mode$)
Create an SQL-based Pie Chart specifying all parameters
Note: As of BBj 23.00, the Dashboard Utility uses JFreeCharts 1.5.x which removes the pseudo-3D charts. Therefore,
the p_flat parameter will be ignored in version 23 and higher.
Method Summary
Methods Modifier and Type Method and Description void
clearDataSet()
Clears the pie chart's underlying dataset. This is typically done in response to a refresh
event, where the dataset is cleared and then repopulated with up-to-date data (via fill() or setDataSetValue().
PieChartWidget
clone()
An internal method used by the Dashboard class to clone a category widget so that it may be displayed in a popped out window
void
create(BBjChildWindow p_widgetControlWindow!)
Creates the PieChartWidget
void
destroy()
Destroys the PieChartWidget
void
fill(BBjString p_connectString$, BBjString p_sql$)
Fills the pie chart's underlying dataset with data from an SQL query
void
fill(BBjString p_connectString$, BBjString p_sql$, BBjString p_mode$)
Fills the pie chart's underlying dataset with data from an SQL query and a mode string
void
fill(BBjRecordSet p_rs!, BBjVector p_columns!)
Fills the pie chart's underlying dataset with data from a BBjRecordSet
Defaultorg.jfree.data.general.PieDataset
getDataset()
Returns the PieChart's underlying dataset, which is a JFreeChart DefaultPieDataset
Note that PieCharts return a DefaultPieDataset, BarCharts and LineCharts return a DefaultCategoryDataset, and XYCharts return an XYSeriesCollection
BBjString
getFormattedValue(BBjNumber p_value!)
Returns a formatted string representation of the value.
The formatting will be the same as specified in the setLabelFormat() method.
If the setLabelFormat() method was never called, then the value will simply be converted to a string.
BBjNumber
getNumRows()
Returns the number of rows in the pie chart's dataset (or slices in the pie)
HashMap
getResultSet()
Returns the pie chart's underlying dataset as a BBjRecordSet
BBjNumber
isDestroyed()
Returns if the PieChartWidget is destroyed
BBjNumber
isEmpty()
Indicates whether the widget's dataset is empty or not
BBjNumber
isRecordSetBased()
Indicates whether the widget's dataset was built from a BBjRecordSet
BBjNumber
isSQLBased()
Indicates whether the widget's dataset was built from an SQL query
void
refresh()
Refreshes the chart, which results in the widget showing an up-to-date version of the chart.
This is executed in response to a refresh event, and the chart is filled with curent data and all customizations are applied
void
set3dDepthFactor(BBjNumber p_depthFactor)
Sets the pie depth as a percentage of the height of the plot area. Values range from 0 to 1.
Note: As of BBj 23.00, the Dashboard Utility uses JFreeCharts 1.5.x which removes the pseudo-3D charts. Therefore,
this method is ignored in version 23 and higher.
Setting the value to 0 results in a flat, non-3D chart.
Setting the valute to 1 results in a 3D chart that is so extruded that you can only see the side, not the top.
Values in the 0 to 0.2 range are more reasonable.
void
setDataSetValue(BBjString p_key$, BBjNumber p_value)
Adds a new dataset entry to the chart's underlying dataset.
This method is typically used to fill a chart with data values one at a time programmatically,
instead of filling it with the resultset of an SQL query which is done via the fill() method.
void
setEmbeddedLabels(BBjString p_colorHexString$, BBjNumber p_opacity)
Turn on simple (embedded) labels. Calling this method will cause the pie plot
to be rendered with the labels inside each pie slice instead of outside of the plot.
void
setExplodeAllSlicesPercent(BBjNumber p_percentExplode)
Offset all pie slices by exploding them out from the center of the pie.
Due to a limitation in JFreeCharts (as of version 1.0.19), this does not work with a 3D pie chart
void
setExplodePercent(BBjString p_sliceName$, BBjNumber p_percentExplode)
Offset a pie slice by exploding it out from the center of the pie.
Due to a limitation in JFreeCharts (as of version 1.0.19), this does not work with a 3D pie chart
void
setIgnoreZeroValues(BBjNumber p_ignoreZeroValues)
Sets whether the pie chart should ignore entries in the dataset that have a zero value.
When set to 1, entries with a value of zero will not be displayed in the plot or legend. When set to 0, they will. The default is set to 1, which ignores entries with a zero value.
void
setLabelBackgroundColor(BBjString p_colorHexString$, BBjNumber p_opacity)
Sets the label's background color for the pie chart
void
setLabelFormat(BBjString p_customLabelFormat$)
Define a custom label format for the pie chart
void
setLabelFormat(BBjString p_customLabelFormat$, NumberFormat p_numberFormat!, NumberFormat p_percentageFormat!)
Define a custom label format for the pie chart by providing a label string and NumberFormatters for the number and percentage fields.
A sample use case would be:
widget!.setLegendLabelFormat("{0}: {1}", java.text.NumberFormat.getCurrencyInstance(), java.text.NumberFormat.getPercentInstance())
which would cause the label to display the key followed by the value formatted as currency. That way it would show up in a format similar to:
Current: $218.10
If the currency format is not specified, the value would display as "218.0" which does not include the pennies or currency unit.
void
setLabelsOff()
Turns off the pie chart's labels (the labels for the pie's slices, not the legend)
void
setPlotPadding(BBjNumber p_padding)
Sets the amount of padding, or space, between the pie plot and the edges of the chart itself.
This controls the space between the edges of the pie plot and the plot area itself (the region where the section labels appear). Increasing the padding will ensure that labels will not be accidentally truncated.
void
setShadowColor(BBjString p_shadowHexString$, BBjNumber p_opacity, BBjNumber p_xOffset, BBjNumber p_yOffset)
Sets the pie chart's shadow with sharp edges
Note that this only appears to work on a flat (non-3D PieChart) as of JFreeCharts 1.0.19
You may want to use setChartPlotShadow() instead as it provides a diffused shadow with more control over the parameters
void
setSliceOutlineColor(BBjString p_colorHexString$, BBjNumber p_opacity)
Sets the color and opacity for the outline of each pie slice and its corresponding legend item
void
setSliceOutlineWidth(BBjNumber p_width)
Sets the width of the outline for each pie slice and its corresponding legend with the default value set to 1.
Notes:
- The value does not have to be an integer, so 0.5 is an acceptible value
void
viewDataSet()
Creates a table representation of the chart's DefaultPieDataset and displays it in a message box.
This is primary aimed at debugging by providing a view into what a pie or ring chart's dataset looks like.
A sample use case would be:
myPieChartWidget!.viewDataSet()
When the code is executed, the dashboard utility will display a message box with a tabular view of the chart's dataset
Methods inherited from class BaseWidget
active, destroy, getClientSlash, getFillError, getFillErrorDesc, getImage, getImage, imageFileSaveDialog, isDestroyed, logError, name, previewImage, previewText, setActive, setFillErrorDisplayImage, setFillErrorDisplayText, setLastSaveDir, spacesValid, title
Methods inherited from class BBjWidget
create, destroy, display, getDevicePixelRatio, isDestroyed, logQueryPerformance, resize, setDevicePixelRatio
Methods inherited from class ChartWidget
addChartDomainMarker, addChartRangeMarker, adjustColorBrightness, adjustColorOpacity, adjustColorSaturation, adjustColorVectorBrightness, adjustColorVectorOpacity, adjustColorVectorOpacityToFixedAmount, adjustColorVectorSaturation, cloneCommonChartWidgetParameters, createCombinedImage, createCombinedImagesWithText, createCombinedImageWithText, createImageFromText, createImageFromText, createImageFromText, createImageFromText, createRadialGradientPaint, darkenColor, email, exportData, fillJDBCXYSeries, fillJDBCXYSeries, fillJDBCXYSeries, getBBjColor, getBBjColorWithAlphaFromHexString, getChartDataItemFromPoint, getChartDataItemsFromPoint, getChartDomainAxisFormat, getChartFontFile, getChartHeight, getChartRangeAxisFormat, getChartRangeAxisToCurrency, getChartRangeAxisToPercent, getChartWidth, getColorTheme, getColorThemeCount, getColorThemeDescription, getColorWithAlpha, getColorWithAlpha, getColorWithAlphaFromHexString, getDataset, getDefaultChartColors, getDevicePixelRatio, getFont, getFontScalingFactor, getHexStringFromColor, getHSBValuesFromRGBColor, getHSLValuesFromRGBColor, getJavaColor, getJavaColor, getJDBCCategoryDataset, getJDBCCategoryDataset, getJDBCCategoryDataset, getJDBCPieDataset, getJDBCPieDataset, getJDBCPieDataset, getLegendFontSize, getRGBColorFromHSLValues, getUserFontScalingFactor, getVectorOfJavaColorsFromDivergentHexColorStrings, getVectorOfJavaColorsFromHexColorStrings, hasLegend, is3D, isAreaChart, isBarChart, isDataSetEmpty, isFlat, isLineChart, isPieChart, isRingChart, isStackedAreaChart, isStackedBarChart, isStackedPercentageBarChart, isXYChart, lightenColor, makeColorVectorFromCommaDelimitedHexColorString, makeColorVectorFromCommaDelimitedHexColorString, makeLargerColorVectorByDarkening, makeLargerColorVectorByLightening, makeLargerColorVectorByReducingOpacity, OnClearTip, refresh, resize, restoreCustomColorTheme, reverseColorVector, rotateColorVector, saturateColor, save, saveColorThemePaletteImagesToDirectory, saveColorVectorAsPaletteImage, setChartBackground, setChartBackground, setChartBackground, setChartBackgroundGradient, setChartBackgroundImage, setChartBackgroundImage, setChartColors, setChartColors, setChartColors, setChartColors, setChartColors, setChartColors, setChartColors, setChartColorTheme, setChartDataItemLabelFormat, setChartDataItemLabelFormat, setChartDataItemLabels, setChartDataItemLabels, setChartDataItemLabels, setChartDomainAxisFontScaling, setChartDomainAxisFormat, setChartDomainAxisFormat, setChartDomainAxisMargins, setChartDomainAxisNumLines, setChartDomainAxisTitle, setChartDomainAxisVisible, setChartDomainMarker, setChartDomainMarker, setChartDomainMarker, setChartEmptyDisplayImage, setChartEmptyDisplayText, setChartFontColor, setChartFontColor, setChartFontColors, setChartFontFile, setChartFontFile, setChartFontSizes, setChartFontStyles, setChartLegendBackground, setChartLegendFrame, setChartLegendPadding, setChartLegendShape, setChartLegendShape, setChartLegendShapeRadius, setChartLegendShapeRadiusScalingFactor, setChartMaximumDomainLabelWidthRatio, setChartPadding, setChartPlotShadow, setChartRangeAxisFormat, setChartRangeAxisFormat, setChartRangeAxisMinimumSize, setChartRangeAxisTitle, setChartRangeAxisToCurrency, setChartRangeAxisToCurrencyWithFractionalDigits, setChartRangeAxisToPercent, setChartRangeAxisUseIntegers, setChartRangeAxisVisible, setChartRangeColors, setChartRangeColors, setChartRangeColors, setChartRangeColors, setChartRangeMarker, setChartRangeMarker, setChartTitle, setChartTitles, setDevicePixelRatio, setFontScalingFactor, setGradientShadingAmount, setLegendBackground, setLegendBackground, setLegendLabelFormat, setLegendLabelFormat, setLegendPosition, setPlotBackground, setPlotBackground, setPlotBackground, setPlotBackgroundImage, setPlotBackgroundImage, setRangeValues, setUserFontScalingFactor, showTip, shuffleColorVector, viewCategoryDataSet, viewData, viewPieDataSet, writePNGToServerOnCreation, writePNGToServerOnCreation
public BBjVector Columns!
A vector of columns indicating which fields in the BBjRecordSet will be used to provide data for the widget
public BBjString ConnectString$
A JDBC connect string used to connect to the database
public BBjNumber IsCircular
A number indicating whether the pie chart is circular or stretched into an elliptical shape
public BBjNumber NumSlices
A number indicating the number of slices in the pie chart
public BBjRecordSet RecordSet!
A BBjRecordSet used to provide data for the widget
public BBjString SQL$
A SQL query used to provide data for the widget
public BBjNumber StartAngle
A number indicating the starting angle of the pie chart. The initial default value is 90 degrees, which corresponds to 12 o'clock. A value of zero corresponds to 3 o'clock.
public PieChartWidget(BBjString p_name$, BBjString p_title$, BBjString p_previewText$, BBjString p_previewImage$, BBjString p_chartTitle$, BBjNumber p_flat, BBjNumber p_legend)
Create an empty Pie Chart specifying all parameters to be filled after creation with setDataSetValue()
Note: As of BBj 23.00, the Dashboard Utility uses JFreeCharts 1.5.x which removes the pseudo-3D charts. Therefore, the p_flat parameter will be ignored in version 23 and higher.
p_name$
The unique name of the chart widgetp_title$
Title which will display in the title barp_previewText$
A description of the widget used for the preview text in the Customize screen and as the tooltip text on the widget's titlep_previewImage$
A preview of the chart widget that is shown in the Add/Remove widgets Customize dialogp_chartTitle$
The title to be displayed above the pie chart (may be empty)p_flat
A number that indicates whether the chart will be flat or 3D. 0=3D, 1=Flat (2D), ignored in version 23 and higherp_legend
A number that indicates whether to show a legend for the chart. 0=Do not show legend, 1=Show legendpublic PieChartWidget(BBjString p_name$, BBjString p_title$, BBjString p_previewText$, BBjString p_previewImage$, BBjString p_chartTitle$, BBjNumber p_flat, BBjNumber p_legend, BBjNumber p_numSlices)
Create an empty Pie Chart specifying all parameters to be filled after creation with setDataSetValue()
Note: As of BBj 23.00, the Dashboard Utility uses JFreeCharts 1.5.x which removes the pseudo-3D charts. Therefore, the p_flat parameter will be ignored in version 23 and higher.
p_name$
The unique name of the chart widgetp_title$
Title which will display in the title barp_previewText$
A description of the widget used for the preview text in the Customize screen and as the tooltip text on the widget's titlep_previewImage$
A preview of the chart widget that is shown in the Add/Remove widgets Customize dialogp_chartTitle$
The title to be displayed above the pie chart (may be empty)p_flat
A number that indicates whether the chart will be flat or 3D. 0=3D, 1=Flat (2D), ignored in version 23 and higherp_legend
A number that indicates whether to show a legend for the chart. 0=Do not show legend, 1=Show legendp_numSlices
A number that indicates the total number of slices in the chart after it has been filled with datapublic PieChartWidget(BBjString p_name$, BBjString p_title$, BBjString p_previewText$, BBjString p_previewImage$, BBjString p_chartTitle$, BBjNumber p_flat, BBjNumber p_legend, BBjString p_connectString$, BBjString p_sql$)
Create an SQL-based Pie Chart specifying all parameters
Note: As of BBj 23.00, the Dashboard Utility uses JFreeCharts 1.5.x which removes the pseudo-3D charts. Therefore, the p_flat parameter will be ignored in version 23 and higher.
p_name$
The unique name of the chart widgetp_title$
Title which will display in the title barp_previewText$
A description of the widget used for the preview text in the Customize screen and as the tooltip text on the widget's titlep_previewImage$
A preview of the chart widget that is shown in the Add/Remove widgets Customize dialogp_chartTitle$
The title to be displayed above the pie chart (may be empty)p_flat
A number that indicates whether the chart will be flat or 3D. 0=3D, 1=Flat (2D), ignored in version 23 and higherp_legend
A number that indicates whether to show a legend for the chart. 0=Do not show legend, 1=Show legendp_connectString$
The connection string to the desired database. Example: "jdbc:basis:localhost?database=ChileCompany&user=admin&password=admin123"p_sql$
The sql query used to populate the chart. The two columns should be key, value. Example: select salesperson, count(salesperson) from customer group by salespersonpublic PieChartWidget(BBjString p_name$, BBjString p_title$, BBjString p_previewText$, BBjString p_previewImage$, BBjString p_chartTitle$, BBjNumber p_flat, BBjNumber p_legend, BBjRecordSet p_rs!, BBjVector p_columns!)
Create a BBjRecordSet-based Pie Chart specifying all parameters
Note: As of BBj 23.00, the Dashboard Utility uses JFreeCharts 1.5.x which removes the pseudo-3D charts. Therefore, the p_flat parameter will be ignored in version 23 and higher.
p_name$
The unique name of the chart widgetp_title$
Title which will display in the title barp_previewText$
A description of the widget used for the preview text in the Customize screen and as the tooltip text on the widget's titlep_previewImage$
A preview of the chart widget that is shown in the Add/Remove widgets Customize dialogp_chartTitle$
The title to be displayed above the pie chart (may be empty)p_flat
A number that indicates whether the chart will be flat or 3D. 0=3D, 1=Flat (2D), ignored in version 23 and higherp_legend
A number that indicates whether to show a legend for the chart. 0=Do not show legend, 1=Show legendp_rs!
The BBjRecordSet containing the data used to populate the chartp_columns!
A BBjVector that contains an ordered list of the columns to be used for the charts's data. The entries may be a string corresponding to a field name, or a 0-based index of the column number. If null() is passed in for the p_columns! vector then the first two columns of the BBjRecordSet will be used. BBjRecordSet
BBjVector
public PieChartWidget(BBjString p_name$, BBjString p_title$, BBjString p_previewText$, BBjString p_previewImage$, BBjString p_chartTitle$, BBjNumber p_flat, BBjNumber p_legend, BBjString p_connectString$, BBjString p_sql$, BBjString p_mode$)
Create an SQL-based Pie Chart specifying all parameters
Note: As of BBj 23.00, the Dashboard Utility uses JFreeCharts 1.5.x which removes the pseudo-3D charts. Therefore, the p_flat parameter will be ignored in version 23 and higher.
p_name$
The unique name of the chart widgetp_title$
Title which will display in the title barp_previewText$
A description of the widget used for the preview text in the Customize screen and as the tooltip text on the widget's titlep_previewImage$
A preview of the chart widget that is shown in the Add/Remove widgets Customize dialogp_chartTitle$
The title to be displayed above the pie chart (may be empty)p_flat
A number that indicates whether the chart will be flat or 3D. 0=3D, 1=Flat (2D), ignored in version 23 and higherp_legend
A number that indicates whether to show a legend for the chart. 0=Do not show legend, 1=Show legendp_connectString$
The connection string to the desired database. Example: "jdbc:basis:localhost?database=ChileCompany&user=admin&password=admin123"p_sql$
The sql query used to populate the chart. The two columns should be key, value. Example: select salesperson, count(salesperson) from customer group by salespersonp_mode$
A string comprised of a list of properties and values separated by commas that will be passed to the database or JDBC connection at connect time. For example: "USER=myusername, PWD=mypass, AUTOCOMMIT=N"
BBj 16.00
public void clearDataSet()
Clears the pie chart's underlying dataset. This is typically done in response to a refresh event, where the dataset is cleared and then repopulated with up-to-date data (via fill() or setDataSetValue().
public PieChartWidget clone()
An internal method used by the Dashboard class to clone a category widget so that it may be displayed in a popped out window
public void create(BBjChildWindow p_widgetControlWindow!)
Creates the PieChartWidget
p_widgetControlWindow!
The BBjChildWindow that will contain the widgetpublic void destroy()
Destroys the PieChartWidget
public void fill(BBjString p_connectString$, BBjString p_sql$)
Fills the pie chart's underlying dataset with data from an SQL query
p_connectString$
The connection string to the desired database. Example: "jdbc:basis:localhost?database=ChileCompany&user=admin&password=admin123"p_sql$
The sql query used to populate the chart. The two columns should be key, value.public void fill(BBjString p_connectString$, BBjString p_sql$, BBjString p_mode$)
Fills the pie chart's underlying dataset with data from an SQL query and a mode string
p_connectString$
The connection string to the desired database. Example: "jdbc:basis:localhost?database=ChileCompany&user=admin&password=admin123"p_sql$
The sql query used to populate the chart. The two columns should be key, value.p_mode$
A string comprised of a list of properties and values separated by commas that will be passed to the database or JDBC connection at connect time. For example: "USER=myusername, PWD=mypass, AUTOCOMMIT=N"
BBj 16.00
public void fill(BBjRecordSet p_rs!, BBjVector p_columns!)
Fills the pie chart's underlying dataset with data from a BBjRecordSet
p_rs!
The BBjRecordSet containing the data used to populate the chartp_columns!
A BBjVector that contains an ordered list of the columns to be used for the charts's data. The entries may be a string corresponding to a field name, or a 0-based index of the column number. If null() is passed in for the p_columns! vector then the first two columns of the BBjRecordSet will be used.public Defaultorg.jfree.data.general.PieDataset getDataset()
Returns the PieChart's underlying dataset, which is a JFreeChart DefaultPieDataset
Note that PieCharts return a DefaultPieDataset, BarCharts and LineCharts return a DefaultCategoryDataset, and XYCharts return an XYSeriesCollection
JFreeChart's DefaultPieDataset documentation for more information.
public BBjString getFormattedValue(BBjNumber p_value!)
Returns a formatted string representation of the value.
The formatting will be the same as specified in the setLabelFormat() method. If the setLabelFormat() method was never called, then the value will simply be converted to a string.
p_value
The chart's numeric value to be formattedpublic BBjNumber getNumRows()
Returns the number of rows in the pie chart's dataset (or slices in the pie)
public HashMap getResultSet()
Returns the pie chart's underlying dataset as a BBjRecordSet
public BBjNumber isDestroyed()
Returns if the PieChartWidget is destroyed
public BBjNumber isEmpty()
Indicates whether the widget's dataset is empty or not
BBj 16.00
public BBjNumber isRecordSetBased()
Indicates whether the widget's dataset was built from a BBjRecordSet
public BBjNumber isSQLBased()
Indicates whether the widget's dataset was built from an SQL query
public void refresh()
Refreshes the chart, which results in the widget showing an up-to-date version of the chart. This is executed in response to a refresh event, and the chart is filled with curent data and all customizations are applied
public void set3dDepthFactor(BBjNumber p_depthFactor)
Sets the pie depth as a percentage of the height of the plot area. Values range from 0 to 1.
Note: As of BBj 23.00, the Dashboard Utility uses JFreeCharts 1.5.x which removes the pseudo-3D charts. Therefore, this method is ignored in version 23 and higher.
Setting the value to 0 results in a flat, non-3D chart. Setting the valute to 1 results in a 3D chart that is so extruded that you can only see the side, not the top. Values in the 0 to 0.2 range are more reasonable.
public void setDataSetValue(BBjString p_key$, BBjNumber p_value)
Adds a new dataset entry to the chart's underlying dataset. This method is typically used to fill a chart with data values one at a time programmatically, instead of filling it with the resultset of an SQL query which is done via the fill() method.
p_key$
A string that describes the dataset's row, which is used for the pie slice namep_value
A number that denotes the data value for the specified row (or pie slice)public void setEmbeddedLabels(BBjString p_colorHexString$, BBjNumber p_opacity)
Turn on simple (embedded) labels. Calling this method will cause the pie plot to be rendered with the labels inside each pie slice instead of outside of the plot.
p_colorHexString$
A hex color string. An example would be "#ff00cc" or "#f0c"p_opacity
The desired opacity value (0-1). 0=Fully Transparent, 1=Fully Opaque.public void setExplodeAllSlicesPercent(BBjNumber p_percentExplode)
Offset all pie slices by exploding them out from the center of the pie. Due to a limitation in JFreeCharts (as of version 1.0.19), this does not work with a 3D pie chart
p_percentExplode
A number from 0-1 that determines the amount to be moved out. A value of 0.30 results in moving the slice outward 30% of the available plot space.public void setExplodePercent(BBjString p_sliceName$, BBjNumber p_percentExplode)
Offset a pie slice by exploding it out from the center of the pie. Due to a limitation in JFreeCharts (as of version 1.0.19), this does not work with a 3D pie chart
p_sliceName$
The name (or key) of the slice that should be moved outwardp_percentExplode
A number from 0-1 that determines the amount to be moved out. A value of 0.30 results in moving the slice outward 30% of the available plot space.public void setIgnoreZeroValues(BBjNumber p_ignoreZeroValues)
Sets whether the pie chart should ignore entries in the dataset that have a zero value.
When set to 1, entries with a value of zero will not be displayed in the plot or legend. When set to 0, they will. The default is set to 1, which ignores entries with a zero value.
p_ignoreZeroValues
A number (0 or 1) that indicates whether entries with a value of zero should be ignored by the pie chart.public void setLabelBackgroundColor(BBjString p_colorHexString$, BBjNumber p_opacity)
Sets the label's background color for the pie chart
p_colorHexString$
A string with a hex description of the color for marker. Example: "#ffccaa" or "#fca"p_opacity
A number from 0-1 that determines the starting opacity level (0=transparent, 1=opaque)public void setLabelFormat(BBjString p_customLabelFormat$)
Define a custom label format for the pie chart
p_customLabelFormat$
A string defining the desired label format An example label format would be "{0}: {1} ({2})" and would display as "Apple: 40 (40%)" {0} = The text portion of the dataset entry {1} = The numeric portion of the dataset entry {2} = The numeric portion of the dataset entry followed by a percent signpublic void setLabelFormat(BBjString p_customLabelFormat$, NumberFormat p_numberFormat!, NumberFormat p_percentageFormat!)
Define a custom label format for the pie chart by providing a label string and NumberFormatters for the number and percentage fields.
A sample use case would be:
which would cause the label to display the key followed by the value formatted as currency. That way it would show up in a format similar to:widget!.setLegendLabelFormat("{0}: {1}", java.text.NumberFormat.getCurrencyInstance(), java.text.NumberFormat.getPercentInstance())
If the currency format is not specified, the value would display as "218.0" which does not include the pennies or currency unit.Current: $218.10
p_customLabelFormat$
A string defining the desired label format An example label format would be "{0}: {1} ({2})" and would display as "Apple: 40 (40%)" p_numberFormat!
A NumberFormat object that formats the numeric portion {1} of the dataset entryp_percentageFormat!
A NumberFormat object that formats the percentage portion {2} of the dataset entry Oracle's NumberFormat documentation for more information.
public void setLabelsOff()
Turns off the pie chart's labels (the labels for the pie's slices, not the legend)
public void setPlotPadding(BBjNumber p_padding)
Sets the amount of padding, or space, between the pie plot and the edges of the chart itself.
This controls the space between the edges of the pie plot and the plot area itself (the region where the section labels appear). Increasing the padding will ensure that labels will not be accidentally truncated.
p_padding
The padding amount as a percentage of the plot as a whole, expressed as a number between 0 and 0.4. 0=NoPadding, 0.4=40% of the plot space will be allocated to padding. JFreeChart's setInteriorGap() method documentation for more information.
public void setShadowColor(BBjString p_shadowHexString$, BBjNumber p_opacity, BBjNumber p_xOffset, BBjNumber p_yOffset)
Sets the pie chart's shadow with sharp edges
Note that this only appears to work on a flat (non-3D PieChart) as of JFreeCharts 1.0.19 You may want to use setChartPlotShadow() instead as it provides a diffused shadow with more control over the parameters
p_shadowHexString$
A string with a hex description of the shadow color. Example: "#ffccaa" or "#fca"p_opacity
A number from 0-1 that determines the opacity level (0=transparent, 1=opaque)p_xOffset
The offset of the shadow in the X directionp_yOffset
The offset of the shadow in the Y directionpublic void setSliceOutlineColor(BBjString p_colorHexString$, BBjNumber p_opacity)
Sets the color and opacity for the outline of each pie slice and its corresponding legend item
p_colorHexString$
A string with a hex description of the outline color. Example: "#ffccaa" or "#fca"p_opacity
A number from 0-1 that determines the starting opacity level (0=transparent, 1=opaque)public void setSliceOutlineWidth(BBjNumber p_width)
Sets the width of the outline for each pie slice and its corresponding legend with the default value set to 1.
Notes:
p_width
The width of the outline in pixelspublic void viewDataSet()
Creates a table representation of the chart's DefaultPieDataset and displays it in a message box.
This is primary aimed at debugging by providing a view into what a pie or ring chart's dataset looks like.
A sample use case would be:
When the code is executed, the dashboard utility will display a message box with a tabular view of the chart's datasetmyPieChartWidget!.viewDataSet()