Class SeriesLabel

  • All Implemented Interfaces:
    ISeriesLabel

    public class SeriesLabel
    extends java.lang.Object
    implements ISeriesLabel
    A series label.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected org.eclipse.swt.graphics.Color color
      the series label color
      protected org.eclipse.swt.graphics.Font font
      the series label font
    • Constructor Summary

      Constructors 
      Constructor Description
      SeriesLabel()
      Constructor.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected void draw​(org.eclipse.swt.graphics.GC gc, int h, int v, double ySeriesValue, int seriesIndex, int alignment)
      Draws series label.
      org.eclipse.swt.graphics.Font getFont()
      Gets the label font.
      org.eclipse.swt.graphics.Color getForeground()
      Gets the label color.
      java.lang.String getFormat()
      Gets the format for label.
      java.lang.String[] getFormats()
      Gets the formats for all data points.
      boolean isVisible()
      Gets the label visibility state.
      void setFont​(org.eclipse.swt.graphics.Font font)
      Sets the label font.
      void setForeground​(org.eclipse.swt.graphics.Color color)
      Sets the label color.
      void setFormat​(java.lang.String format)
      Sets the decimal format DecimalFormat or/plus plain string.
      void setFormats​(java.lang.String[] formats)
      Sets the formats for all data points.
      void setVisible​(boolean visible)
      Sets the label visibility state.
      • Methods inherited from class java.lang.Object

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

      • font

        protected org.eclipse.swt.graphics.Font font
        the series label font
      • color

        protected org.eclipse.swt.graphics.Color color
        the series label color
    • Constructor Detail

      • SeriesLabel

        public SeriesLabel()
        Constructor.
    • Method Detail

      • getFormat

        public java.lang.String getFormat()
        Description copied from interface: ISeriesLabel
        Gets the format for label.
        Specified by:
        getFormat in interface ISeriesLabel
        Returns:
        the format
      • setFormat

        public void setFormat​(java.lang.String format)
        Description copied from interface: ISeriesLabel
        Sets the decimal format DecimalFormat or/plus plain string.

        If formats have been set with setFormats(String[]), the format set with this method will be ignored.

        If null is given, default format "#.###########" will be set.

        Specified by:
        setFormat in interface ISeriesLabel
        Parameters:
        format - the format
      • getFormats

        public java.lang.String[] getFormats()
        Description copied from interface: ISeriesLabel
        Gets the formats for all data points.
        Specified by:
        getFormats in interface ISeriesLabel
        Returns:
        the formats, or empty array if not set
      • setFormats

        public void setFormats​(java.lang.String[] formats)
        Description copied from interface: ISeriesLabel
        Sets the formats for all data points. If null or empty array is given, formats will be cleared, and the format set with setFormat(String) will be used instead.
        Specified by:
        setFormats in interface ISeriesLabel
        Parameters:
        formats - the formats
      • getForeground

        public org.eclipse.swt.graphics.Color getForeground()
        Description copied from interface: ISeriesLabel
        Gets the label color.
        Specified by:
        getForeground in interface ISeriesLabel
        Returns:
        the label color
      • setForeground

        public void setForeground​(org.eclipse.swt.graphics.Color color)
        Description copied from interface: ISeriesLabel
        Sets the label color. If null is given, default color will be set.
        Specified by:
        setForeground in interface ISeriesLabel
        Parameters:
        color - the label color
      • getFont

        public org.eclipse.swt.graphics.Font getFont()
        Description copied from interface: ISeriesLabel
        Gets the label font.
        Specified by:
        getFont in interface ISeriesLabel
        Returns:
        the label font
      • setFont

        public void setFont​(org.eclipse.swt.graphics.Font font)
        Description copied from interface: ISeriesLabel
        Sets the label font.
        Specified by:
        setFont in interface ISeriesLabel
        Parameters:
        font - the label font
      • isVisible

        public boolean isVisible()
        Description copied from interface: ISeriesLabel
        Gets the label visibility state.
        Specified by:
        isVisible in interface ISeriesLabel
        Returns:
        true if label is visible
      • setVisible

        public void setVisible​(boolean visible)
        Description copied from interface: ISeriesLabel
        Sets the label visibility state.
        Specified by:
        setVisible in interface ISeriesLabel
        Parameters:
        visible - the label visibility state
      • draw

        protected void draw​(org.eclipse.swt.graphics.GC gc,
                            int h,
                            int v,
                            double ySeriesValue,
                            int seriesIndex,
                            int alignment)
        Draws series label.
        Parameters:
        gc - the GC object
        h - the horizontal coordinate to draw label
        v - the vertical coordinate to draw label
        ySeriesValue - the Y series value
        seriesIndex - the series index
        alignment - the alignment of label position (SWT.CENTER or SWT.BOTTOM)