Documentation of 'jhplot.HKey' Java class.
HKey
jhplot

Class HKey

  • All Implemented Interfaces:
    java.io.Serializable


    public class HKey
    extends java.lang.Object
    implements java.io.Serializable
    Create an interactive key label on the HPlot canvas. The label can be defined in the NDC (normalized coordinate system) or the USER coordinates. Only one line of the text can be shown. The key is not related to any data set, so you can plot this key even if no data are shown.
    See Also:
    Serialized Form
    • Constructor Summary

      Constructors 
      Constructor and Description
      HKey(java.lang.String s)
      Make a key label with default attributes
      HKey(java.lang.String s, double x, double y)
      Make a key label with specific coordinated in the data system
      HKey(java.lang.String text, double x, double y, java.awt.Font font, java.awt.Color color, java.lang.String howToSet, java.lang.Object obj)
      Make a key for a function, data points or histograms (F1D, H1D, P1D).
      HKey(java.lang.String text, double x, double y, java.awt.Font font, java.lang.String howToSet, java.lang.Object obj)
      Make a key for a function, data points or histograms (F1D, H1D, P1D).
      HKey(java.lang.String text, double x, double y, java.lang.Object obj)
      Make a key for a function, data points or histograms (F1D, H1D, P1D).
      HKey(java.lang.String s, double x, double y, java.lang.String howToSet)
      Make a label with specific coordinates.
      HKey(java.lang.String text, double x, double y, java.lang.String howToSet, java.lang.Object obj)
      Make a key for a function, data points or histograms (F1D, H1D, P1D).
      HKey(java.lang.String s, java.awt.Font f)
      Make a key label (color- black)
      HKey(java.lang.String s, java.awt.Font f, java.awt.Color c)
      Create a key label.
      HKey(java.lang.String text, java.lang.Object obj)
      Make a key for a function, data points or histograms (F1D, H1D, P1D) at the default position.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      java.awt.Color getColor()
      Get color of a label.
      java.awt.Font getFont()
      Get the font of the label text.
      jplot.GraphLabel getGraphLabel()
      Get a label with default attributes
      java.awt.Color getKeyColor()
      Get key color
      float getKeySize()
      Get key size
      double getKeySpace()
      Get a space between the key and the text describing the key
      int getKeyType()
      Get key type
      double getLineWidth()
      Get a key line width
      int getPositionCoordinate()
      Is the position set?
      double getRotation()
      Returns the rotation angle.
      float getSeparation()
      Return vertical separation between different keys.
      java.lang.String getText()
      Get the text of the label.
      double getX()
      Returns the X position of the text.
      double getY()
      Returns the Y position of the text.
      boolean isDefaultPosition()
      Is this key should be set at a default position?
      void setColor(java.awt.Color c)
      Sets the color to a specific value
      void setDefaultPosition(boolean isdefault)
      Is this key should be set at a default position?
      void setFont(java.awt.Font f)
      Sets the font to a specific value
      void setKey(int key_type, float key_size, java.awt.Color key_color)
      Sets a key
      void setKeySpace(float key_space)
      Sets a space between the key and the text describing the key
      void setLineWidth(int key_line_width)
      Sets key line width
      void setLocation(double x, double y)
      Sets the location of the label in data coordinates.
      void setLocation(double x, double y, java.lang.String howToSet)
      Sets the location of the label in data coordinates.
      void setRotation(double r)
      Sets the rotation angle.
      void setSeparation(float y)
      Set Y-separation of the keys in the default location mode
      void setText(java.lang.String s)
      Sets a text of the label.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • HKey

        public HKey(java.lang.String s,
                    java.awt.Font f,
                    java.awt.Color c)
        Create a key label.
        Parameters:
        s - Text
        f - Font
        c - Color
      • HKey

        public HKey(java.lang.String text,
                    double x,
                    double y,
                    java.awt.Font font,
                    java.awt.Color color,
                    java.lang.String howToSet,
                    java.lang.Object obj)
        Make a key for a function, data points or histograms (F1D, H1D, P1D). All objects should inherent DrawOptions class. All drawing attributes will be copied to the key.
        Parameters:
        text - key text
        x - position X
        y - position Y
        font - font of the key text
        color - color of the key text
        howToSet - use either USER or NDC coordinators
        obj - input objects, such as F1D, H1D, P1D
      • HKey

        public HKey(java.lang.String text,
                    double x,
                    double y,
                    java.awt.Font font,
                    java.lang.String howToSet,
                    java.lang.Object obj)
        Make a key for a function, data points or histograms (F1D, H1D, P1D). All objects should inherent DrawOptions class. All drawing attributes will be copied to the key.
        Parameters:
        text - key text
        x - position X
        y - position Y
        font - font of the key text
        howToSet - use either USER or NDC coordinators
        obj - input objects, such as F1D, H1D, P1D
      • HKey

        public HKey(java.lang.String text,
                    double x,
                    double y,
                    java.lang.String howToSet,
                    java.lang.Object obj)
        Make a key for a function, data points or histograms (F1D, H1D, P1D). All objects should inherent DrawOptions class. All drawing attributes will be copied to the key.
        Parameters:
        text - key text
        x - position X
        y - position Y
        howToSet - use either USER or NDC coordinators
        obj - input objects, such as F1D, H1D, P1D
      • HKey

        public HKey(java.lang.String text,
                    double x,
                    double y,
                    java.lang.Object obj)
        Make a key for a function, data points or histograms (F1D, H1D, P1D). The default position is NDC All objects should inherent DrawOptions class. All drawing attributes will be copied to the key.
        Parameters:
        text - key text
        x - position X
        y - position Y
        obj - input objects, such as F1D, H1D, P1D
      • HKey

        public HKey(java.lang.String text,
                    java.lang.Object obj)
        Make a key for a function, data points or histograms (F1D, H1D, P1D) at the default position. 0.25,0.85 All objects should inherent DrawOptions class. All drawing attributes will be copied to the key.
        Parameters:
        text - key text
        x - position X
        y - position Y
        obj - input objects, such as F1D, H1D, P1D
      • HKey

        public HKey(java.lang.String s,
                    java.awt.Font f)
        Make a key label (color- black)
        Parameters:
        s - Text
        f - Font
      • HKey

        public HKey(java.lang.String s)
        Make a key label with default attributes
        Parameters:
        s - text
      • HKey

        public HKey(java.lang.String s,
                    double x,
                    double y)
        Make a key label with specific coordinated in the data system
        Parameters:
        s - Text
        x - Position in X
        y - Position in Y
      • HKey

        public HKey(java.lang.String s,
                    double x,
                    double y,
                    java.lang.String howToSet)
        Make a label with specific coordinates.
        Parameters:
        s - Text
        x - position in X
        y - position in Y
        howToSet - set it to "NDC" for normalized coordinates (in the range 0-1). This is a data independent position set it to "USER" for the user coordinates
    • Method Detail

      • setText

        public void setText(java.lang.String s)
        Sets a text of the label.
        Parameters:
        s - new text for the label
      • getText

        public java.lang.String getText()
        Get the text of the label.
        Returns:
        the current text of the label
      • setColor

        public void setColor(java.awt.Color c)
        Sets the color to a specific value
        Parameters:
        c - color used to draw the label
      • getColor

        public java.awt.Color getColor()
        Get color of a label.
        Returns:
        the color used to draw the label
      • setFont

        public void setFont(java.awt.Font f)
        Sets the font to a specific value
        Parameters:
        f - font used to draw the label
      • getFont

        public java.awt.Font getFont()
        Get the font of the label text.
        Returns:
        the font used to draw the label
      • setRotation

        public void setRotation(double r)
        Sets the rotation angle. Although all kind of angles (in PI-units) are allowed, internally we only use the interval 0-2pi hence we take care of all other cases.
        Parameters:
        r - angle for this label
      • getRotation

        public double getRotation()
        Returns the rotation angle.
        Returns:
        angle for this label
      • setLocation

        public void setLocation(double x,
                                double y)
        Sets the location of the label in data coordinates. Ones set this way, you cannot plot the label, it must first define the location in pixel-coordinates (setLocation(x,y));
        Parameters:
        x - x-position of the lower-left corner of the text
        y - y-position of the lower-left corner of the text
      • setKey

        public void setKey(int key_type,
                           float key_size,
                           java.awt.Color key_color)
        Sets a key
        Parameters:
        key_type - type of the key. 0 means a box
        key_size - size (i.e. length) a key in terms of character width
        key_color - color of the key
      • setLineWidth

        public void setLineWidth(int key_line_width)
        Sets key line width
        Parameters:
        key_line_width - line width of the key
      • setKeySpace

        public void setKeySpace(float key_space)
        Sets a space between the key and the text describing the key
        Parameters:
        key_space - key space in terms of character width
      • getKeySpace

        public double getKeySpace()
        Get a space between the key and the text describing the key
        Returns:
        key space in terms of character width
      • getLineWidth

        public double getLineWidth()
        Get a key line width
        Returns:
        key line width
      • getKeyType

        public int getKeyType()
        Get key type
        Returns:
        key type
      • getKeyColor

        public java.awt.Color getKeyColor()
        Get key color
        Returns:
        key color
      • getKeySize

        public float getKeySize()
        Get key size
        Returns:
        key size
      • setLocation

        public void setLocation(double x,
                                double y,
                                java.lang.String howToSet)
        Sets the location of the label in data coordinates. Ones set this way, you cannot plot the label, it must first define the location in pixel-coordinates (setLocation(x,y));
        Parameters:
        x - x-position of the lower-left corner of the text
        y - y-position of the lower-left corner of the text
        howToSet - set it to "NDC" for normalized coordinates (in the range 0-1). This is a data independent position set it to "USER" for the user coordinates
      • getPositionCoordinate

        public int getPositionCoordinate()
        Is the position set?
        Returns:
        zero if location is not defined of unity if the position is defined in the NDC system 2 if the location is defined in the user coordinates
      • getX

        public double getX()
        Returns the X position of the text.
        Returns:
        the x-position of the text
      • getY

        public double getY()
        Returns the Y position of the text.
        Returns:
        the y-position of the text
      • getGraphLabel

        public jplot.GraphLabel getGraphLabel()
        Get a label with default attributes
        Returns:
        get GraphLabel
      • setSeparation

        public void setSeparation(float y)
        Set Y-separation of the keys in the default location mode
        Parameters:
        y - separation between 0 and 1. NDC system is used.
      • getSeparation

        public float getSeparation()
        Return vertical separation between different keys.
        Parameters:
        separation - between keys
      • isDefaultPosition

        public boolean isDefaultPosition()
        Is this key should be set at a default position?
        Returns:
      • setDefaultPosition

        public void setDefaultPosition(boolean isdefault)
        Is this key should be set at a default position?
        Parameters:
        isdefault - true if the key are set at default location

DMelt 3.0 © DataMelt by jWork.ORG