Class SVGScoreBar


  • public class SVGScoreBar
    extends java.lang.Object
    Draw a score bar. Essentially like a progress bar, left-to-right, displaying a relative score.
    Since:
    0.5.0
    Author:
    Sascha Goldhofer
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.text.NumberFormat format
      Number format, set to print the actual score
      protected java.lang.String label
      Label (on the right)
      protected double max
      Value, minimum and maximum values
      protected double min
      Value, minimum and maximum values
      protected boolean reversed
      Reversed flag.
      protected double val
      Value, minimum and maximum values
    • Constructor Summary

      Constructors 
      Constructor Description
      SVGScoreBar()
      Constructor.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addLabel​(java.lang.String text)
      Set label (right of the bar)
      org.w3c.dom.Element build​(SVGPlot svgp, double x, double y, double width, double height)
      Build the actual element
      void setFill​(double val, double min, double max)
      Set the fill of the score bar.
      void setReversed​(boolean reversed)
      Set the reversed flag.
      void showValues​(java.text.NumberFormat format)
      To show score values, set a number format
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • val

        protected double val
        Value, minimum and maximum values
      • min

        protected double min
        Value, minimum and maximum values
      • max

        protected double max
        Value, minimum and maximum values
      • reversed

        protected boolean reversed
        Reversed flag.
      • label

        protected java.lang.String label
        Label (on the right)
      • format

        private java.text.NumberFormat format
        Number format, set to print the actual score
    • Constructor Detail

      • SVGScoreBar

        public SVGScoreBar()
        Constructor.
    • Method Detail

      • setFill

        public void setFill​(double val,
                            double min,
                            double max)
        Set the fill of the score bar.
        Parameters:
        val - Value
        min - Minimum value
        max - Maximum value
      • setReversed

        public void setReversed​(boolean reversed)
        Set the reversed flag.
        Parameters:
        reversed - Reversed flag.
      • addLabel

        public void addLabel​(java.lang.String text)
        Set label (right of the bar)
        Parameters:
        text - Label text
      • showValues

        public void showValues​(java.text.NumberFormat format)
        To show score values, set a number format
        Parameters:
        format - Number format
      • build

        public org.w3c.dom.Element build​(SVGPlot svgp,
                                         double x,
                                         double y,
                                         double width,
                                         double height)
        Build the actual element
        Parameters:
        svgp - Plot to draw to
        x - X coordinate
        y - Y coordinate
        width - Width
        height - Height
        Returns:
        new element