public class BarChartWidget extends ChartWidget implements RefreshableWidget
BarChartWidget A Dashboard Utility Widget that displays a bar chart that can display multiple groups of bars by providing a rowKey, colKey, and value for each dataset entry
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 |
static BBjNumber | LABEL_POSITION_DOWN_45 |
static BBjNumber | LABEL_POSITION_DOWN_90 |
static BBjNumber | LABEL_POSITION_STANDARD |
static BBjNumber | LABEL_POSITION_UP_45 |
static BBjNumber | LABEL_POSITION_UP_90 |
BBjNumber | MaximumBarWidth A number that specifies the maximum width of a single bar in the barchart as a percentage of the available plot space. The default value is 0.33, meaning that a bar chart with a single bar will only take up 1/3 of the plot space to avoid filling the plot with a single huge bar. |
static BBjNumber | ORIENTATION_HORIZONTAL=1 |
static BBjNumber | ORIENTATION_VERTICAL=0 |
BBjNumber | PaintGlossOnFlatChart A number that indicates whether to paint a glossy layer on a flat bar chart |
BBjRecordSet | RecordSet! A BBjRecordSet used to provide data for the widget |
BBjString | SQL$ A SQL query used to provide data for the widget |
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 BarChartWidget(BBjString p_name$, BBjString p_title$, BBjString p_previewText$, BBjString p_previewImage$, BBjString p_chartTitle$, BBjString p_domainTitle$, BBjString p_rangeTitle$, BBjNumber p_rectangular, BBjNumber p_orientation, BBjNumber p_legend)
Create an empty Bar Chart specifying all parameters to be filled after creation with setDataSetValue()
BarChartWidget(BBjString p_name$, BBjString p_title$, BBjString p_previewText$, BBjString p_previewImage$, BBjString p_chartTitle$, BBjString p_domainTitle$, BBjString p_rangeTitle$, BBjNumber p_rectangular, BBjNumber p_orientation, BBjNumber p_legend, BBjString p_connectString$, BBjString p_sql$)
Create an SQL-based Bar Chart specifying all parameters
BarChartWidget(BBjString p_name$, BBjString p_title$, BBjString p_previewText$, BBjString p_previewImage$, BBjString p_chartTitle$, BBjString p_domainTitle$, BBjString p_rangeTitle$, BBjNumber p_rectangular, BBjNumber p_orientation, BBjNumber p_legend, BBjRecordSet p_rs!, BBjVector p_columns!)
Create a BBjRecordSet-based Bar Chart specifying all parameters
BarChartWidget(BBjString p_name$, BBjString p_title$, BBjString p_previewText$, BBjString p_previewImage$, BBjString p_chartTitle$, BBjString p_domainTitle$, BBjString p_rangeTitle$, BBjNumber p_rectangular, BBjNumber p_orientation, BBjNumber p_legend, BBjString p_connectString$, BBjString p_sql$, BBjString p_mode$)
Create an SQL-based Bar Chart specifying all parameters
Method Summary
Methods Modifier and Type Method and Description void
clearDataSet()
Clears the bar 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().
BarChartWidget
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 BarChartWidget
void
destroy()
Destroys the BarChartWidget
void
fill(BBjString p_connectString$, BBjString p_sql$)
Fills the bar chart's underlying dataset with data from an SQL query
void
fill(BBjString p_connectString$, BBjString p_sql$, BBjString p_mode$)
Fills the bar chart's underlying dataset with data from an SQL query and a mode string
void
fill(BBjRecordSet p_rs!, BBjVector p_columns!)
Fills the bar chart's underlying dataset with data from a BBjRecordSet
org.jfree.data.category.Defaultorg.jfree.data.category.CategoryDataset
getDataset()
Returns the BarChart's underlying dataset, which is a JFreeChart DefaultCategoryDataset
Note that PieCharts return a DefaultPieDataset, BarCharts and LineCharts return a DefaultCategoryDataset, and XYCharts return an XYSeriesCollection
BBjNumber
getNumCols()
Returns the number of columns in the bar chart's dataset
BBjNumber
getNumRows()
Returns the number of rows in the bar chart's dataset
BBjNumber
isDestroyed()
Returns if the BarChartWidget 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 chart'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
setBarOutlineColor(BBjString p_colorHexString$, BBjNumber p_opacity)
Sets the color and opacity for the outline of each bar
void
setBarOutlineWidth(BBjNumber p_width)
Sets the width of the outline for each bar in pixels with the default value set to 1.
Notes:
- The outline will be multiplied by the device's pixel ratio
- The value does not have to be an integer, so 0.5 is an acceptible value
void
setChartDomainAxisTitle(BBjString p_title$)
Sets the title for the domain axis
This can be used to dynamically change the axis title, such as in response to a refresh event. Even if the
chart was originally created without this axis title, calling this method will add the title to the chart.
Note that for an XYChartWidget, setting the domain title via setDomainAxisLabels() will override this method.
void
setChartRangeAxisTitle(BBjString p_title$)
Sets the title for the range axis
This can be used to dynamically change the axis title, such as in response to a refresh event. Even if the
chart was originally created without this axis title, calling this method will add the title to the chart.
void
setChartTitles(BBjString p_chartTitle$, BBjString p_chartDomainTitle$, BBjString p_chartRangeTitle$)
void
setCustom3DAxisColor(BBjString p_colorHexString$, BBjNumber p_opacity)
Sets the color for the 3D axis (the left and bottom walls in the plot background) on a Bar Chart
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 23 and higher.
void
setDataSetValue(BBjString p_rowKey$, BBjString p_colKey$, 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
setDomainLabelAngle(BBjNumber p_labelPosition)
Sets the angle of the labels on the domain axis
An example would be:
widget!.setDomainLabelAngle(widget!.getLABEL_POSITION_DOWN_45())
This code causes the domain labels to display in a downward 45 degree angle
void
setLabelsInBarChartColor(BBjString p_colorHexString$)
Turns on embedded labels with default positioning in the bar chart (so the bar's range value is displayed) and sets the label's text color
Note that this method uses default positioning for the labels and only works with BarCharts. The ChartWidget::setChartDataItemLabels() methods
work with all category-based charts (BarCharts, LineCharts, AreaCharts) and XYCharts and some of those method signatures allow you to specify
the label position relative to the data item.
void
setLayeredBars(BBjNumber p_layeredBars)
Sets the bar chart to layer all bars in each series over one another. Turning this on will force the chart to be flat, as the layered style overrides settings like 3D and PaintGlossOnFlatChart.
void
setShadowColor(BBjString p_shadowHexString$, BBjNumber p_opacity, BBjNumber p_xOffset, BBjNumber p_yOffset)
Sets the bar chart's shadow with sharp edges
You may want to use setChartPlotShadow() instead as it provides a diffused shadow with more control over the parameters
void
viewDataSet()
Creates a table representation of the chart's DefaultCategoryDataset and displays it in a message box.
This is primary aimed at debugging by providing a view into what a bar or line chart's dataset looks like.
A sample use case would be:
myBarChartWidget!.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 static BBjNumber LABEL_POSITION_DOWN_45
public static BBjNumber LABEL_POSITION_DOWN_90
public static BBjNumber LABEL_POSITION_STANDARD
public static BBjNumber LABEL_POSITION_UP_45
public static BBjNumber LABEL_POSITION_UP_90
public BBjNumber MaximumBarWidth
A number that specifies the maximum width of a single bar in the barchart as a percentage of the available plot space.
The default value is 0.33, meaning that a bar chart with a single bar will only take up 1/3 of the plot space to avoid filling the plot with a single huge bar.
BBj 15.11
public static BBjNumber ORIENTATION_HORIZONTAL=1
public static BBjNumber ORIENTATION_VERTICAL=0
public BBjNumber PaintGlossOnFlatChart
A number that indicates whether to paint a glossy layer on a flat bar 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 BarChartWidget(BBjString p_name$, BBjString p_title$, BBjString p_previewText$, BBjString p_previewImage$, BBjString p_chartTitle$, BBjString p_domainTitle$, BBjString p_rangeTitle$, BBjNumber p_rectangular, BBjNumber p_orientation, BBjNumber p_legend)
Create an empty Bar Chart specifying all parameters to be filled after creation with setDataSetValue()
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_domainTitle$
The title for the domain axis (may be empty)p_rangeTitle$
The title for the range axis (may be empty)p_rectangular
A number that indicates whether the chart's bar will be rectangular or cylindrical. 0=Cylindrical, 1=Rectangularp_orientation
A number that indicates whether the chart will be in portrait or landscape orientation. Example: orientation=BarChartWidget.getORIENTATION_VERTICAL()p_legend
A number that indicates whether to show a legend for the chart. 0=Do not show legend, 1=Show legendpublic BarChartWidget(BBjString p_name$, BBjString p_title$, BBjString p_previewText$, BBjString p_previewImage$, BBjString p_chartTitle$, BBjString p_domainTitle$, BBjString p_rangeTitle$, BBjNumber p_rectangular, BBjNumber p_orientation, BBjNumber p_legend, BBjString p_connectString$, BBjString p_sql$)
Create an SQL-based Bar Chart specifying all parameters
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_domainTitle$
The title for the domain axis (may be empty)p_rangeTitle$
The title for the range axis (may be empty)p_rectangular
A number that indicates whether the chart's bar will be rectangular or cylindrical. 0=Cylindrical, 1=Rectangularp_orientation
A number that indicates whether the chart will be in portrait or landscape orientation. Example: orientation=BarChartWidget.getORIENTATION_VERTICAL()p_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 three columns should be rowKey, colKey, value.public BarChartWidget(BBjString p_name$, BBjString p_title$, BBjString p_previewText$, BBjString p_previewImage$, BBjString p_chartTitle$, BBjString p_domainTitle$, BBjString p_rangeTitle$, BBjNumber p_rectangular, BBjNumber p_orientation, BBjNumber p_legend, BBjRecordSet p_rs!, BBjVector p_columns!)
Create a BBjRecordSet-based Bar Chart specifying all parameters
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_domainTitle$
The title for the domain axis (may be empty)p_rangeTitle$
The title for the range axis (may be empty)p_rectangular
A number that indicates whether the chart's bar will be rectangular or cylindrical. 0=Cylindrical, 1=Rectangularp_orientation
A number that indicates whether the chart will be in portrait or landscape orientation. Example: orientation=BarChartWidget.getORIENTATION_VERTICAL()p_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 three columns of the BBjRecordSet will be used. BBjRecordSet
BBjVector
public BarChartWidget(BBjString p_name$, BBjString p_title$, BBjString p_previewText$, BBjString p_previewImage$, BBjString p_chartTitle$, BBjString p_domainTitle$, BBjString p_rangeTitle$, BBjNumber p_rectangular, BBjNumber p_orientation, BBjNumber p_legend, BBjString p_connectString$, BBjString p_sql$, BBjString p_mode$)
Create an SQL-based Bar Chart specifying all parameters
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_domainTitle$
The title for the domain axis (may be empty)p_rangeTitle$
The title for the range axis (may be empty)p_rectangular
A number that indicates whether the chart's bar will be rectangular or cylindrical. 0=Cylindrical, 1=Rectangularp_orientation
A number that indicates whether the chart will be in portrait or landscape orientation. Example: orientation=BarChartWidget.getORIENTATION_VERTICAL()p_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 three columns should be rowKey, colKey, 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 clearDataSet()
Clears the bar 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 BarChartWidget 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 BarChartWidget
p_widgetControlWindow!
The BBjChildWindow that will contain the widgetpublic void destroy()
Destroys the BarChartWidget
public void fill(BBjString p_connectString$, BBjString p_sql$)
Fills the bar 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 thee columns should be rowKey, colKey, value.public void fill(BBjString p_connectString$, BBjString p_sql$, BBjString p_mode$)
Fills the bar 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 thee columns should be rowKey, colKey, 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 bar 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 three columns of the BBjRecordSet will be used.public org.jfree.data.category.Defaultorg.jfree.data.category.CategoryDataset getDataset()
Returns the BarChart's underlying dataset, which is a JFreeChart DefaultCategoryDataset
Note that PieCharts return a DefaultPieDataset, BarCharts and LineCharts return a DefaultCategoryDataset, and XYCharts return an XYSeriesCollection
JFreeChart's DefaultCategoryDataset documentation for more information.
public BBjNumber getNumCols()
Returns the number of columns in the bar chart's dataset
public BBjNumber getNumRows()
Returns the number of rows in the bar chart's dataset
public BBjNumber isDestroyed()
Returns if the BarChartWidget 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 chart'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 setBarOutlineColor(BBjString p_colorHexString$, BBjNumber p_opacity)
Sets the color and opacity for the outline of each bar
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 setBarOutlineWidth(BBjNumber p_width)
Sets the width of the outline for each bar in pixels with the default value set to 1. Notes:
p_width
The width of the outline in pixelspublic void setChartDomainAxisTitle(BBjString p_title$)
Sets the title for the domain axis
This can be used to dynamically change the axis title, such as in response to a refresh event. Even if the chart was originally created without this axis title, calling this method will add the title to the chart.
Note that for an XYChartWidget, setting the domain title via setDomainAxisLabels() will override this method.
p_title$
The new title for the domain axis BBj 17.00
public void setChartRangeAxisTitle(BBjString p_title$)
Sets the title for the range axis
This can be used to dynamically change the axis title, such as in response to a refresh event. Even if the chart was originally created without this axis title, calling this method will add the title to the chart.
p_title$
The new title for the range axis BBj 17.00
public void setChartTitles(BBjString p_chartTitle$, BBjString p_chartDomainTitle$, BBjString p_chartRangeTitle$)
public void setCustom3DAxisColor(BBjString p_colorHexString$, BBjNumber p_opacity)
Sets the color for the 3D axis (the left and bottom walls in the plot background) on a Bar Chart
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 23 and higher.
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 setDataSetValue(BBjString p_rowKey$, BBjString p_colKey$, 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_rowKey$
A string that describes the dataset's rowp_colKey$
A string that describes the dataset's columnp_value
A number that denotes the data value for the specified row and columnpublic void setDomainLabelAngle(BBjNumber p_labelPosition)
Sets the angle of the labels on the domain axis
An example would be:
widget!.setDomainLabelAngle(widget!.getLABEL_POSITION_DOWN_45())
This code causes the domain labels to display in a downward 45 degree angle
p_labelPosition
The label position, which is a constant (public field variable) in this classpublic void setLabelsInBarChartColor(BBjString p_colorHexString$)
Turns on embedded labels with default positioning in the bar chart (so the bar's range value is displayed) and sets the label's text color
Note that this method uses default positioning for the labels and only works with BarCharts. The ChartWidget::setChartDataItemLabels() methods work with all category-based charts (BarCharts, LineCharts, AreaCharts) and XYCharts and some of those method signatures allow you to specify the label position relative to the data item.
p_colorHexString$
A string with a hex description of the color for the labels. Example: "#ffccaa" or "#fca"public void setLayeredBars(BBjNumber p_layeredBars)
Sets the bar chart to layer all bars in each series over one another. Turning this on will force the chart to be flat, as the layered style overrides settings like 3D and PaintGlossOnFlatChart.
p_layeredBars
A number that indicates whether the chart will be layered or not. The default is 0. 0=NotLayered, 1=Layeredpublic void setShadowColor(BBjString p_shadowHexString$, BBjNumber p_opacity, BBjNumber p_xOffset, BBjNumber p_yOffset)
Sets the bar chart's shadow with sharp edges
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 shadow's opacity level (0=transparent, 1=opaque)p_xOffset
The X offset of the shadow in pixelsp_yOffset
The Y offset of the shadow in pixelspublic void viewDataSet()
Creates a table representation of the chart's DefaultCategoryDataset and displays it in a message box.
This is primary aimed at debugging by providing a view into what a bar or line 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 datasetmyBarChartWidget!.viewDataSet()