Class BarStyle

  • All Implemented Interfaces:
    javax.swing.Icon, Style

    public class BarStyle
    extends DefaultStyle
    implements javax.swing.Icon
    Defines a style for plotting a bar in a histogram.
    Since:
    16 Nov 2005
    Author:
    Mark Taylor
    • Field Detail

      • FORM_OPEN

        public static final BarStyle.Form FORM_OPEN
        Bar form using open rectangles.
      • FORM_FILLED

        public static final BarStyle.Form FORM_FILLED
        Bar form using filled rectangles.
      • FORM_FILLED3D

        public static final BarStyle.Form FORM_FILLED3D
        Bar form using filled 3d rectangles.
      • FORM_TOP

        public static final BarStyle.Form FORM_TOP
        Bar form drawing only the tops of the bars.
      • FORM_SPIKE

        public static final BarStyle.Form FORM_SPIKE
        Bar form using 1-d spikes.
      • FORM_SEMIFILLED

        public static final BarStyle.Form FORM_SEMIFILLED
        Bar form with an outline and a transparent inside.
      • FORM_SEMITOP

        public static final BarStyle.Form FORM_SEMITOP
        Bar form with steps and a transparent inside.
      • PLACE_ADJACENT

        public static final BarStyle.Placement PLACE_ADJACENT
        Placement which puts bars next to each other.
      • PLACE_OVER

        public static final BarStyle.Placement PLACE_OVER
        Placement which puts bars in the same X region.
    • Constructor Detail

      • BarStyle

        public BarStyle​(java.awt.Color color,
                        BarStyle.Form form,
                        BarStyle.Placement placement)
        Constructor.
        Parameters:
        color - initial colour
        form - bar form
        placement - bar placement
    • Method Detail

      • drawBar

        public void drawBar​(java.awt.Graphics g,
                            int xlo,
                            int xhi,
                            int ylo,
                            int yhi,
                            int iseq,
                            int nseq)
        Draws a bar for inclusion in a histogram.
        Parameters:
        g - graphics context
        xlo - lower bound in X direction
        xhi - upper bound in X direction
        ylo - lower bound in Y direction
        yhi - upper bound in Y direction
        iseq - index of the set being plotted
        nseq - number of sets being plotted for this bar
      • drawEdge

        public void drawEdge​(java.awt.Graphics g,
                             int x,
                             int y1,
                             int y2,
                             int iseq,
                             int nseq)
        Draws the edge of a bar. This can be invoked to draw the boundary between one bar and its immediate neighbour; the edge described by the call's parameters is not the edge of the block representing the bar's data, but the edge between the current bar and its neighbour on one side or the other, so it may go up or down from the Y value. For many bar styles this will be a no-op.
        Parameters:
        g - graphics context
        x - x position of the edge
        y1 - one y value for the edge
        y2 - other y value for the edge
        iseq - index of the set being plotted
        nseq - number of sets being plotted for this bar
      • getForm

        public BarStyle.Form getForm()
        Returns the form of this style.
        Returns:
        bar form
      • getPlacement

        public BarStyle.Placement getPlacement()
        Returns the placement of this style.
        Returns:
        bar placement
      • getLegendIcon

        public javax.swing.Icon getLegendIcon()
        Description copied from interface: Style
        Returns an icon suitable for displaying in a legend for this style.
        Specified by:
        getLegendIcon in interface Style
      • getIconHeight

        public int getIconHeight()
        Specified by:
        getIconHeight in interface javax.swing.Icon
      • getIconWidth

        public int getIconWidth()
        Specified by:
        getIconWidth in interface javax.swing.Icon
      • paintIcon

        public void paintIcon​(java.awt.Component c,
                              java.awt.Graphics g,
                              int x,
                              int y)
        Specified by:
        paintIcon in interface javax.swing.Icon