|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.moxieapps.gwt.highcharts.client.Configurable<Color> org.moxieapps.gwt.highcharts.client.Color
public class Color
Represents a color as either a solid RGB color, an RBG color with an alpha channel,
or a gradient of colors. Many of the configurable chart objects support setting various
color options (backgrounds, borders, etc). They all support a simply mechanism for
setting the color to a standard RGB hex value (such as BaseChart.setBackgroundColor(String)
.
However, if they also support alpha channels or gradients an overloaded method will be
provided that takes a Color instance instead (e.g. BaseChart.setBackgroundColor(Color)
.
chart.setBackgroundColor(new Color(255, 0, 0, .1));
Example which sets the background color to a linear gradient from white to
a 50% opaque blue:
chart.setBackgroundColor(new Color()
.setLinearGradient(0.0, 0.0, 1.0, 1.0)
.addColorStop(0, "#FFFFFF")
.addColorStop(0, 200, 200, 255, 0.5)
);
Constructor Summary | |
---|---|
Color()
An empty constructor that can be used when creating a color as a gradient. |
|
Color(int r,
int g,
int b)
Create a color instance specifying the three components of the RGB color separately (will result in a color that looks like "rgb(200, 255, 10)". |
|
Color(int r,
int g,
int b,
double a)
Create a color instance specifying the three components of the RGB color separately as we as the alpha channel (will result in a color that looks like "rgb(200, 255, 10, 0.5)". |
|
Color(String rgbHexColor)
Create a color instance specifying the color in standard RGB hex notation (include the "#") |
Method Summary | |
---|---|
Color |
addColorStop(double offset,
int r,
int g,
int b)
Adds the specified color at some position within the gradient (to be used in conjunction with the setLinearGradient(double, double, double, double) method
or another one of its overloaded variants.)
Example which sets the background color to a linear gradient from white to blue: |
Color |
addColorStop(double offset,
int r,
int g,
int b,
double a)
Adds the specified color at some position within the gradient allowing for the color to be specified with an alpha channel (to be used in conjunction with the setLinearGradient(double, double, double, double) method or another one of its overloaded variants.)
Example which sets the background color to a linear gradient from solid white to
a 50% opaque blue: |
Color |
addColorStop(double offset,
String rgbHexColor)
Adds the specified color at some position within the gradient (to be used in conjunction with the setLinearGradient(double, double, double, double) method
or another one of its overloaded variants.)
Example which sets the background color to a linear gradient from white to blue: |
com.google.gwt.json.client.JSONValue |
getOptionValue()
This method will return the value of the object as a single value if it is represented as just a solid color or as a JSONObject if it represents a gradient. |
Color |
setLinearGradient(double x1,
double x2,
double y1,
double y2)
Sets up this color as a linear gradient from one location in space to another, specifying the coordinates in percentages of the space the gradient will fill. |
Color |
setLinearGradient(int x1,
int x2,
int y1,
int y2)
Sets up this color as a linear gradient from one location in space to another, specifying the coordinates in pixels. |
Color |
setLinearGradient(String x1,
String x2,
String y1,
String y2)
Sets up this color as a linear gradient from one location in space to another. |
Methods inherited from class org.moxieapps.gwt.highcharts.client.Configurable |
---|
getOptions, setOption |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Color()
setLinearGradient(double, double, double, double)
and addColorStop(double, String)
methods (and their overloaded variants.)
public Color(String rgbHexColor)
rgbHexColor
- The RGB hex of the color (include the "#").public Color(int r, int g, int b)
r
- The red component of the color in the RGB color space (0 to 255)g
- The green component of the color in the RGB color space (0 to 255)b
- The blue component of the color in the RGB color space (0 to 255)public Color(int r, int g, int b, double a)
r
- The red component of the color in the RGB color space (0 to 255)g
- The green component of the color in the RGB color space (0 to 255)b
- The blue component of the color in the RGB color space (0 to 255)a
- The alpha channel of the color (0.0 to 1.0)Method Detail |
---|
public Color setLinearGradient(String x1, String x2, String y1, String y2)
color.setLinearGradient("0", "0", "500", "500");
Or:
color.setLinearGradient("20%", "20%", "80%", "80%");
Note that you can also use the setLinearGradient(int, int, int, int)
version if you know you're only going to be operating in pixels, or the
setLinearGradient(double, double, double, double)
if you're only operating
in percentages.
x1
- The x-coordinate of the start point of the gradient.x2
- The x-coordinate of the end point of the gradient.y1
- The y-coordinate of the start point of the gradient.y2
- The y-coordinate of the end point of the gradient.
Color
instance for convenient method chaining.public Color setLinearGradient(int x1, int x2, int y1, int y2)
setLinearGradient(double, double, double, double)
version if you know you instead want to operate in percentages, or the
setLinearGradient(String, String, String, String)
version if you need to
operate in both percentages and pixels concurrently.
x1
- The x-coordinate of the start point of the gradient (in pixels).x2
- The x-coordinate of the end point of the gradient (in pixels).y1
- The y-coordinate of the start point of the gradient (in pixels).y2
- The y-coordinate of the end point of the gradient (in pixels).
Color
instance for convenient method chaining.public Color setLinearGradient(double x1, double x2, double y1, double y2)
setLinearGradient(int, int, int, int)
version if you know you instead want to operate in pixels, or the
setLinearGradient(String, String, String, String)
version if you need to
operate in both percentages and pixels concurrently.
x1
- The x-percentage of the start point of the gradient (0.0 to 1.0)x2
- The x-percentage of the end point of the gradient (0.0 to 1.0)y1
- The y-percentage of the start point of the gradient (0.0 to 1.0)y2
- The y-percentage of the end point of the gradient (0.0 to 1.0)
Color
instance for convenient method chaining.public Color addColorStop(double offset, String rgbHexColor)
setLinearGradient(double, double, double, double)
method
or another one of its overloaded variants.)
Example which sets the background color to a linear gradient from white to blue:
chart.setBackgroundColor(new Color()
.setLinearGradient(0.0, 0.0, 1.0, 1.0)
.addColorStop(0.0, "#FFFFFF")
.addColorStop(0.0, "#0000FF")
);
Note that this method is intended to be used when you simply want to set the gradient
stop color to a standard RGB hex value. If you need more control use the
addColorStop(double, int, int, int)
or addColorStop(double, int, int, int, double)
method instead.
offset
- A floating point value between 0.0 and 1.0 that represents the position
between the start and end points in a gradient.rgbHexColor
- The RGB hex color that the gradient should display at the given offset (include the "#").
Color
instance for convenient method chaining.public Color addColorStop(double offset, int r, int g, int b)
setLinearGradient(double, double, double, double)
method
or another one of its overloaded variants.)
Example which sets the background color to a linear gradient from white to blue:
chart.setBackgroundColor(new Color()
.setLinearGradient(0.0, 0.0, 1.0, 1.0)
.addColorStop(0.0, 255, 255, 255)
.addColorStop(0.0, 0, 0, 255)
);
Note that this method is intended to be used when you simply want to set the gradient
stop color to a standard RGB hex value. If you need more control use the
addColorStop(double, int, int, int, double)
method instead.
offset
- A floating point value between 0.0 and 1.0 that represents the position
between the start and end points in a gradient.r
- The red component of the color in the RGB color space (0 to 255)g
- The green component of the color in the RGB color space (0 to 255)b
- The blue component of the color in the RGB color space (0 to 255)
Color
instance for convenient method chaining.public Color addColorStop(double offset, int r, int g, int b, double a)
setLinearGradient(double, double, double, double)
method or another one of its overloaded variants.)
Example which sets the background color to a linear gradient from solid white to
a 50% opaque blue:
chart.setBackgroundColor(new Color()
.setLinearGradient(0.0, 0.0, 1.0, 1.0)
.addColorStop(0.0, 255, 255, 255)
.addColorStop(0.0, 0, 0, 255, 0.5)
);
offset
- A floating point value between 0.0 and 1.0 that represents the position
between the start and end points in a gradient.r
- The red component of the color in the RGB color space (0 to 255)g
- The green component of the color in the RGB color space (0 to 255)b
- The blue component of the color in the RGB color space (0 to 255)a
- The alpha channel of the color (0.0 to 1.0)
Color
instance for convenient method chaining.public com.google.gwt.json.client.JSONValue getOptionValue()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |