Class BarPlot

  • All Implemented Interfaces:
    ChartPlot, java.io.Serializable

    public class BarPlot
    extends StandardPlot
    A general class for plotting data of groups of values. This plot can use data from any class that implements the BaseDataset interface.
    Since:
    8.0
    See Also:
    Serialized Form
    • Field Detail

      • DEFAULT_STYLE

        public static final BarStyle DEFAULT_STYLE
        Default chart style with this plot.
      • ITEM_LABEL_ALIGNMENT_AUTO

        public static final int ITEM_LABEL_ALIGNMENT_AUTO
        A auto label alignment, is default.
        See Also:
        Constant Field Values
      • ITEM_LABEL_ALIGNMENT_VERTICAL

        public static final int ITEM_LABEL_ALIGNMENT_VERTICAL
        A vertical label alignment.
        See Also:
        Constant Field Values
      • ITEM_LABEL_ALIGNMENT_HORIZONTAL

        public static final int ITEM_LABEL_ALIGNMENT_HORIZONTAL
        A horizontal label alignment.
        See Also:
        Constant Field Values
      • DEFAULT_BAR_MARGIN_PERCENT

        public static final double DEFAULT_BAR_MARGIN_PERCENT
        The default bar margin percentage.
        See Also:
        Constant Field Values
      • DEFAULT_BAR_WIDTH

        public static final double DEFAULT_BAR_WIDTH
        The default bar width.
        See Also:
        Constant Field Values
    • Constructor Detail

      • BarPlot

        public BarPlot()
        Creates a bar plot with default properties.
        Since:
        8.0
      • BarPlot

        public BarPlot​(BarStyle style)
        Creates a bar plot with defined chart style. Initializes all properties with default values.
        Parameters:
        style - the chart style (null not permitted)
        Since:
        8.0
        See Also:
        BarStyle
    • Method Detail

      • setCategoryAxis

        public void setCategoryAxis​(GroupAxis categoryAxis)
        Sets the axis for categories of this plot. The category axis shows the values of the first group field.
        Parameters:
        categoryAxis - the category axis (null not permitted)
        Since:
        8.0
        See Also:
        StandardPlot.getCategoryAxis(), GroupAxis
      • setStyle

        public void setStyle​(BarStyle style)
        Sets a chart style of this bar plot.
        Parameters:
        style - the bar style (null not permitted)
        Since:
        8.0
        See Also:
        getStyle(), BarStyle
      • isShowTotal

        public boolean isShowTotal()
        Returns the flag that controls whether or not the totals will be showed for each bar.
        Returns:
        the flag.
        Since:
        8.0
        See Also:
        setShowTotal(boolean)
      • getBarMarginPercent

        public double getBarMarginPercent()
        Returns the bar margin in percent where 0.10 is 10 percent.
        Returns:
        the margin
        Since:
        14.1
        See Also:
        setBarMarginPercent(double)
      • setBarMarginPercent

        public void setBarMarginPercent​(double barMarginPercent)
        Sets the bar margin (space between the bars). The value is expressed as a percentage of the available plot width.
        Parameters:
        barMarginPercent - the margin (where 0.10 is ten percent)
        Since:
        14.1
      • getBarWidth

        public double getBarWidth()
        Returns the maximum bar width in percent where 0.10 is 10 percent.
        Returns:
        the bar width
        Since:
        11.0
        See Also:
        setBarWidth(double)
      • setBarWidth

        public void setBarWidth​(double barWidth)
        Sets the maximum bar width, which is specified as a percentage of the available space for all bars,
        Parameters:
        barWidth - the width (where 0.10 is ten percent)
        Since:
        11.0
        See Also:
        getBarWidth()
      • getSubProperties

        protected java.lang.StringBuilder getSubProperties​(int depth)
        Returns the serialized simple properties of subclasses.
        Overrides:
        getSubProperties in class StandardPlot
        Parameters:
        depth - the depth of XML indent
        Returns:
        the properties.
      • readProperties

        public void readProperties​(org.w3c.dom.Element element,
                                   Chart2 chart)
        Reads the chart properties from the DOMParser Element.
        Specified by:
        readProperties in interface ChartPlot
        Overrides:
        readProperties in class StandardPlot
        Parameters:
        element - the DOMParser Element
        chart - the chart