Skip navigation links
Dashboard

Class BarChartWidget

Inheritance:
  • Field Detail

    • Columns!

      public BBjVector Columns!

      A vector of columns indicating which fields in the BBjRecordSet will be used to provide data for the widget

    • ConnectString$

      public BBjString ConnectString$

      A JDBC connect string used to connect to the database

    • LABEL_POSITION_DOWN_45

      public static BBjNumber LABEL_POSITION_DOWN_45
    • LABEL_POSITION_DOWN_90

      public static BBjNumber LABEL_POSITION_DOWN_90
    • LABEL_POSITION_STANDARD

      public static BBjNumber LABEL_POSITION_STANDARD
    • LABEL_POSITION_UP_45

      public static BBjNumber LABEL_POSITION_UP_45
    • LABEL_POSITION_UP_90

      public static BBjNumber LABEL_POSITION_UP_90
    • MaximumBarWidth

      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.

      Since:
      BBj 15.11
    • ORIENTATION_HORIZONTAL=1

      public static BBjNumber ORIENTATION_HORIZONTAL=1
    • ORIENTATION_VERTICAL=0

      public static BBjNumber ORIENTATION_VERTICAL=0
    • PaintGlossOnFlatChart

      public BBjNumber PaintGlossOnFlatChart

      A number that indicates whether to paint a glossy layer on a flat bar chart

    • RecordSet!

      public BBjRecordSet RecordSet!

      A BBjRecordSet used to provide data for the widget

    • SQL$

      public BBjString SQL$

      A SQL query used to provide data for the widget

  • Constructor Detail

    • BarChartWidget

      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()

      Parameters:
      p_name$ The unique name of the chart widget
      p_title$ Title which will display in the title bar
      p_previewText$ A description of the widget used for the preview text in the Customize screen and as the tooltip text on the widget's title
      p_previewImage$ A preview of the chart widget that is shown in the Add/Remove widgets Customize dialog
      p_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=Rectangular
      p_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 legend
    • BarChartWidget

      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$)

      Create an SQL-based Bar Chart specifying all parameters

      Parameters:
      p_name$ The unique name of the chart widget
      p_title$ Title which will display in the title bar
      p_previewText$ A description of the widget used for the preview text in the Customize screen and as the tooltip text on the widget's title
      p_previewImage$ A preview of the chart widget that is shown in the Add/Remove widgets Customize dialog
      p_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=Rectangular
      p_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 legend
      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 three columns should be rowKey, colKey, value.
    • BarChartWidget

      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

      Parameters:
      p_name$ The unique name of the chart widget
      p_title$ Title which will display in the title bar
      p_previewText$ A description of the widget used for the preview text in the Customize screen and as the tooltip text on the widget's title
      p_previewImage$ A preview of the chart widget that is shown in the Add/Remove widgets Customize dialog
      p_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=Rectangular
      p_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 legend
      p_rs! The BBjRecordSet containing the data used to populate the chart
      p_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.
      See Also:
      BBjRecordSet
      BBjVector
    • BarChartWidget

      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

      Parameters:
      p_name$ The unique name of the chart widget
      p_title$ Title which will display in the title bar
      p_previewText$ A description of the widget used for the preview text in the Customize screen and as the tooltip text on the widget's title
      p_previewImage$ A preview of the chart widget that is shown in the Add/Remove widgets Customize dialog
      p_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=Rectangular
      p_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 legend
      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 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"
      Since:
      BBj 16.00
    • Method Detail

      • clearDataSet

        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().

      • clone

        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

        Returns:
        A cloned version of the original widget
      • create

        public void create(BBjChildWindow p_widgetControlWindow!)

        Creates the BarChartWidget

        Parameters:
        p_widgetControlWindow! The BBjChildWindow that will contain the widget
      • destroy

        public void destroy()

        Destroys the BarChartWidget

      • fill

        public void fill(BBjString p_connectString$, BBjString p_sql$)

        Fills the bar chart's underlying dataset with data from an SQL query

        Parameters:
        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.
      • fill

        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

        Parameters:
        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"
        Since:
        BBj 16.00
      • fill

        public void fill(BBjRecordSet p_rs!, BBjVector p_columns!)

        Fills the bar chart's underlying dataset with data from a BBjRecordSet

        Parameters:
        p_rs! The BBjRecordSet containing the data used to populate the chart
        p_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.
      • getDataset

        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

        Returns:
        The chart's underlying dataset as a JFreeChart DefaultCategoryDataset
        See Also:
        JFreeChart's DefaultCategoryDataset documentation for more information.
      • getNumCols

        public BBjNumber getNumCols()

        Returns the number of columns in the bar chart's dataset

        Returns:
        The number of columns in the bar chart
      • getNumRows

        public BBjNumber getNumRows()

        Returns the number of rows in the bar chart's dataset

        Returns:
        The number of rows in the bar chart
      • isDestroyed

        public BBjNumber isDestroyed()

        Returns if the BarChartWidget is destroyed

        Returns:
        Returns 1 if destroyed, otherwise 0 is returned
      • isEmpty

        public BBjNumber isEmpty()

        Indicates whether the widget's dataset is empty or not

        Returns:
        0=Not empty, 1=empty
        Since:
        BBj 16.00
      • isRecordSetBased

        public BBjNumber isRecordSetBased()

        Indicates whether the widget's dataset was built from a BBjRecordSet

        Returns:
        0=Not based on a BBjRecordSet, 1=Based on a BBjRecordSet
      • isSQLBased

        public BBjNumber isSQLBased()

        Indicates whether the chart's dataset was built from an SQL query

        Returns:
        0=Not SQL Based, 1=SQL Based
      • refresh

        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

      • setBarOutlineColor

        public void setBarOutlineColor(BBjString p_colorHexString$, BBjNumber p_opacity)

        Sets the color and opacity for the outline of each bar

        Parameters:
        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)
      • setBarOutlineWidth

        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:

        • 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
        Parameters:
        p_width The width of the outline in pixels
      • setChartDomainAxisTitle

        public 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.

        Parameters:
        p_title$ The new title for the domain axis
        Since:
        BBj 17.00
      • setChartRangeAxisTitle

        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.

        Parameters:
        p_title$ The new title for the range axis
        Since:
        BBj 17.00
      • setChartTitles

        public void setChartTitles(BBjString p_chartTitle$, BBjString p_chartDomainTitle$, BBjString p_chartRangeTitle$)
      • setCustom3DAxisColor

        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.

        Parameters:
        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)
      • setDataSetValue

        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.

        Parameters:
        p_rowKey$ A string that describes the dataset's row
        p_colKey$ A string that describes the dataset's column
        p_value A number that denotes the data value for the specified row and column
      • setDomainLabelAngle

        public 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

        Parameters:
        p_labelPosition The label position, which is a constant (public field variable) in this class
      • setLabelsInBarChartColor

        public 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.

        Parameters:
        p_colorHexString$ A string with a hex description of the color for the labels. Example: "#ffccaa" or "#fca"
      • setLayeredBars

        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.

        Parameters:
        p_layeredBars A number that indicates whether the chart will be layered or not. The default is 0. 0=NotLayered, 1=Layered
      • setShadowColor

        public 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

        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 pixels
        p_yOffset The Y offset of the shadow in pixels
      • viewDataSet

        public 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