Inherits javax::swing::JPanel.
Public Member Functions | |
| ColorGradient (double max, String caption, int numLabels, String labelFormat) | |
| Constructor. | |
| void | updateGradient (double max, String caption, int numLabels, String labelFormat) |
| Update the gradient with new values. | |
| Dimension | getMinimumSize () |
| Dimension | getMaximumSize () |
| Dimension | getPreferredSize () |
| void | paintComponent (Graphics g) |
| Override painter to draw gradient. | |
Static Public Member Functions | |
| static Color | getColor (float pct) |
| Gets a color for a percentage. | |
Package Attributes | |
| int | numLabels |
| double | maxVal |
| String | sLabel |
| String | sFormat |
| Dimension | minDim |
| Dimension | maxDim |
| DecimalFormat | formatter |
Static Package Attributes | |
| static final int | STEPSIZE = 10 |
| To speed rendering, we draw the gradient this many pixels at a time. | |
| static final int | PADDING = 5 |
| Padding between gradient and edge of panel, in pixels. | |
| static final int | WIDTH = 125 |
| Width. | |
| static final int | BARWIDTH = 25 |
| Width of color bars. | |
| static final int | LABELHEIGHT = 50 |
| Height of label. | |
| edu.ufl.hcs.ppw.vis.ColorGradient.ColorGradient | ( | double | max, | |
| String | caption, | |||
| int | numLabels, | |||
| String | labelFormat | |||
| ) |
Constructor.
See updateGradient() for an explanation of the parameters.
References edu.ufl.hcs.ppw.vis.ColorGradient.updateGradient(), and edu.ufl.hcs.ppw.vis.ColorGradient.WIDTH.
| static Color edu.ufl.hcs.ppw.vis.ColorGradient.getColor | ( | float | pct | ) | [static] |
Gets a color for a percentage.
Useful for other visualizations so that the colors displayed match the. Note that since the parameter is expressed in terms of a fraction, the color returned is independent of the current scale.
Additionally, depending on how getHSBColor() is implemented, we might be able to save a little bit on memory consumption by preloading a table of 100 or so colors and rounding all percentages to entries in that table. Since this function doesn't seem to be contributing much to overall execution time, it's probably worth it to keep this the way it is so we get more accurate colors.
Referenced by edu.ufl.hcs.ppw.vis.ColorGradient.paintComponent().
| void edu.ufl.hcs.ppw.vis.ColorGradient.updateGradient | ( | double | max, | |
| String | caption, | |||
| int | numLabels, | |||
| String | labelFormat | |||
| ) |
Update the gradient with new values.
| max | Maximum value to show | |
| caption | Label (centered) to show underneath the gradient | |
| numLabels | Number of labels to show next to the gradient | |
| labelFormat | Formatting to use for each label |
Referenced by edu.ufl.hcs.ppw.vis.ColorGradient.ColorGradient(), and edu.ufl.hcs.ppw.vis.comm.CommunicationPanel.update().
1.5.8