jhplot
Class HLabelEq
- java.lang.Object
- jhplot.HLabelEq
- All Implemented Interfaces:
- Serializable
public class HLabelEqextends Objectimplements Serializable
Create an equation using the LaTex syntax onHPlot
canvas. The equation position can be defined in the NDC (normalized coordinate system) or the user coordinate.- See Also:
- Serialized Form
Constructor Summary
Constructors Constructor and Description HLabelEq(String s)
Make a label with default attributesHLabelEq(String s, double x, double y)
Make a equation label with specific coordinated in the data systemHLabelEq(String s, double x, double y, String howToSet)
Make a label with specific coordinates.HLabelEq(String s, int f)
Make a equation label (color- black)HLabelEq(String s, int f, Color c)
Make a label with equation using the LaTeX syntax
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description void
doc()
Show online documentation.Color
getColor()
Get color of the label.Color
getColorBackground()
Get color of background.int
getFontSize()
Get the font size of the equation.BufferedImage
getImage()
Return image of this equationboolean
getImageFile(String fileName)
Return image of this equation as a file.int
getPositionCoordinate()
Is the position set?String
getText()
Get the equation text of the label.double
getX()
Returns the X position of the text.double
getY()
Returns the Y position of the text.void
setColor(Color c)
Sets the color to a specific valuevoid
setColorBackgroud(Color c)
Set background colorvoid
setFontSize(int f)
Sets the font to a specific valuevoid
setLocation(double x, double y)
Sets the location of the label in data coordinates.void
setLocation(double x, double y, String howToSet)
Sets the location of the label in data coordinates.void
setText(String s)
Sets a equation text of the label.String
toString()
Constructor Detail
HLabelEq
public HLabelEq(String s, int f, Color c)
Make a label with equation using the LaTeX syntax- Parameters:
s
- Textf
- Font sizec
- Color
HLabelEq
public HLabelEq(String s, int f)
Make a equation label (color- black)- Parameters:
s
- Textf
- Font size
HLabelEq
public HLabelEq(String s)
Make a label with default attributes- Parameters:
s
- text
HLabelEq
public HLabelEq(String s, double x, double y)
Make a equation label with specific coordinated in the data system- Parameters:
s
- Textx
- Position in Xy
- Position in Y
HLabelEq
public HLabelEq(String s, double x, double y, String howToSet)
Make a label with specific coordinates.- Parameters:
s
- Textx
- position in Xy
- position in YhowToSet
- 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(String s)
Sets a equation text of the label.- Parameters:
s
- new text for the label
getText
public String getText()
Get the equation text of the label.- Returns:
- the current text of the label
setColor
public void setColor(Color c)
Sets the color to a specific value- Parameters:
c
- color used to draw the label
setColorBackgroud
public void setColorBackgroud(Color c)
Set background color- Parameters:
c
-
getColor
public Color getColor()
Get color of the label.- Returns:
- the color used to draw the label
getColorBackground
public Color getColorBackground()
Get color of background.- Returns:
- the color used to draw the label
setFontSize
public void setFontSize(int f)
Sets the font to a specific value- Parameters:
f
- font size used to draw the label
getFontSize
public int getFontSize()
Get the font size of the equation.- Returns:
- the font used to draw the label
getImage
public BufferedImage getImage()
Return image of this equation- Returns:
getImageFile
public boolean getImageFile(String fileName)
Return image of this equation as a file. Example of the extension is ".png" or ".jpg".- Returns:
- success
toString
public String toString()
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 texty
- y-position of the lower-left corner of the text
setLocation
public void setLocation(double x, double y, 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 texty
- y-position of the lower-left corner of the texthowToSet
- 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
doc
public void doc()
Show online documentation.
DMelt 2.7 © DataMelt by jWork.ORG