本文整理汇总了Java中org.jfree.chart.renderer.LookupPaintScale类的典型用法代码示例。如果您正苦于以下问题:Java LookupPaintScale类的具体用法?Java LookupPaintScale怎么用?Java LookupPaintScale使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
LookupPaintScale类属于org.jfree.chart.renderer包,在下文中一共展示了LookupPaintScale类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testCloning
import org.jfree.chart.renderer.LookupPaintScale; //导入依赖的package包/类
/**
* Confirm that cloning works.
*/
@Test
public void testCloning() throws CloneNotSupportedException {
XYBlockRenderer r1 = new XYBlockRenderer();
LookupPaintScale scale1 = new LookupPaintScale();
r1.setPaintScale(scale1);
XYBlockRenderer r2 = (XYBlockRenderer) r1.clone();
assertTrue(r1 != r2);
assertTrue(r1.getClass() == r2.getClass());
assertTrue(r1.equals(r2));
// check independence
scale1.add(0.5, Color.red);
assertFalse(r1.equals(r2));
LookupPaintScale scale2 = (LookupPaintScale) r2.getPaintScale();
scale2.add(0.5, Color.red);
assertTrue(r1.equals(r2));
}
示例2: testCloning
import org.jfree.chart.renderer.LookupPaintScale; //导入依赖的package包/类
/**
* Confirm that cloning works.
*/
@Test
public void testCloning() throws CloneNotSupportedException {
XYBlockRenderer r1 = new XYBlockRenderer();
LookupPaintScale scale1 = new LookupPaintScale();
r1.setPaintScale(scale1);
XYBlockRenderer r2 = (XYBlockRenderer) r1.clone();
assertTrue(r1 != r2);
assertTrue(r1.getClass() == r2.getClass());
assertTrue(r1.equals(r2));
// check independence
scale1.add(0.5, Color.RED);
assertFalse(r1.equals(r2));
LookupPaintScale scale2 = (LookupPaintScale) r2.getPaintScale();
scale2.add(0.5, Color.RED);
assertTrue(r1.equals(r2));
}
示例3: createLUT
import org.jfree.chart.renderer.LookupPaintScale; //导入依赖的package包/类
protected static final LookupPaintScale createLUT(final int ncol, final float vmin, final float vmax,
final Color start, final Color end) {
final float[][] colors =
new float[][] {
{ start.getRed() / 255f, start.getGreen() / 255f, start.getBlue() / 255f,
start.getAlpha() / 255f },
{ end.getRed() / 255f, end.getGreen() / 255f, end.getBlue() / 255f, end.getAlpha() / 255f } };
final float[] limits = new float[] { 0, 1 };
final LookupPaintScale lut = new LookupPaintScale(vmin, vmax, start);
float val;
float r, g, b, a;
for (int j = 0; j < ncol; j++) {
val = j / (ncol - 0.99f);
final int i = 0;
r = colors[i][0] + (val - limits[i]) / (limits[i + 1] - limits[i]) * (colors[i + 1][0] - colors[i][0]);
g = colors[i][1] + (val - limits[i]) / (limits[i + 1] - limits[i]) * (colors[i + 1][1] - colors[i][1]);
b = colors[i][2] + (val - limits[i]) / (limits[i + 1] - limits[i]) * (colors[i + 1][2] - colors[i][2]);
a = colors[i][3] + (val - limits[i]) / (limits[i + 1] - limits[i]) * (colors[i + 1][3] - colors[i][3]);
lut.add(val * (vmax - vmin) + vmin, new Color(r, g, b, a));
}
return lut;
}
示例4: testConstructor2
import org.jfree.chart.renderer.LookupPaintScale; //导入依赖的package包/类
/**
* Some checks for the other constructor.
*/
public void testConstructor2() {
LookupPaintScale s = new LookupPaintScale(1.0, 2.0, Color.red);
assertEquals(1.0, s.getLowerBound(), EPSILON);
assertEquals(2.0, s.getUpperBound(), EPSILON);
assertEquals(Color.red, s.getDefaultPaint());
}
示例5: testEquals
import org.jfree.chart.renderer.LookupPaintScale; //导入依赖的package包/类
/**
* Some checks for the equals() method.
*/
@Test
public void testEquals() {
XYShapeRenderer r1 = new XYShapeRenderer();
XYShapeRenderer r2 = new XYShapeRenderer();
assertTrue(r1.equals(r2));
assertTrue(r2.equals(r1));
r1.setPaintScale(new LookupPaintScale(1.0, 2.0, Color.white));
assertFalse(r1.equals(r2));
r2.setPaintScale(new LookupPaintScale(1.0, 2.0, Color.white));
assertTrue(r1.equals(r2));
r1.setDrawOutlines(true);
assertFalse(r1.equals(r2));
r2.setDrawOutlines(true);
assertTrue(r1.equals(r2));
r1.setUseOutlinePaint(false);
assertFalse(r1.equals(r2));
r2.setUseOutlinePaint(false);
assertTrue(r1.equals(r2));
r1.setUseFillPaint(true);
assertFalse(r1.equals(r2));
r2.setUseFillPaint(true);
assertTrue(r1.equals(r2));
r1.setGuideLinesVisible(true);
assertFalse(r1.equals(r2));
r2.setGuideLinesVisible(true);
assertTrue(r1.equals(r2));
r1.setGuideLinePaint(Color.red);
assertFalse(r1.equals(r2));
r2.setGuideLinePaint(Color.red);
assertTrue(r1.equals(r2));
}
示例6: XYShapeRenderer
import org.jfree.chart.renderer.LookupPaintScale; //导入依赖的package包/类
/**
* Creates a new <code>XYShapeRenderer</code> instance with default
* attributes.
*/
public XYShapeRenderer() {
this.paintScale = new LookupPaintScale();
this.useFillPaint = false;
this.drawOutlines = false;
this.useOutlinePaint = true;
this.guideLinesVisible = false;
this.guideLinePaint = Color.darkGray;
this.guideLineStroke = new BasicStroke();
setBaseShape(new Ellipse2D.Double(-5.0, -5.0, 10.0, 10.0));
setAutoPopulateSeriesShape(false);
}
示例7: XYShapeRenderer
import org.jfree.chart.renderer.LookupPaintScale; //导入依赖的package包/类
/**
* Creates a new {@code XYShapeRenderer} instance with default
* attributes.
*/
public XYShapeRenderer() {
this.paintScale = new LookupPaintScale();
this.useFillPaint = false;
this.drawOutlines = false;
this.useOutlinePaint = true;
this.guideLinesVisible = false;
this.guideLinePaint = Color.darkGray;
this.guideLineStroke = new BasicStroke();
setDefaultShape(new Ellipse2D.Double(-5.0, -5.0, 10.0, 10.0));
setAutoPopulateSeriesShape(false);
}
示例8: testEquals
import org.jfree.chart.renderer.LookupPaintScale; //导入依赖的package包/类
/**
* Some checks for the equals() method.
*/
@Test
public void testEquals() {
XYShapeRenderer r1 = new XYShapeRenderer();
XYShapeRenderer r2 = new XYShapeRenderer();
assertTrue(r1.equals(r2));
assertTrue(r2.equals(r1));
r1.setPaintScale(new LookupPaintScale(1.0, 2.0, Color.WHITE));
assertFalse(r1.equals(r2));
r2.setPaintScale(new LookupPaintScale(1.0, 2.0, Color.WHITE));
assertTrue(r1.equals(r2));
r1.setDrawOutlines(true);
assertFalse(r1.equals(r2));
r2.setDrawOutlines(true);
assertTrue(r1.equals(r2));
r1.setUseOutlinePaint(false);
assertFalse(r1.equals(r2));
r2.setUseOutlinePaint(false);
assertTrue(r1.equals(r2));
r1.setUseFillPaint(true);
assertFalse(r1.equals(r2));
r2.setUseFillPaint(true);
assertTrue(r1.equals(r2));
r1.setGuideLinesVisible(true);
assertFalse(r1.equals(r2));
r2.setGuideLinesVisible(true);
assertTrue(r1.equals(r2));
r1.setGuideLinePaint(Color.RED);
assertFalse(r1.equals(r2));
r2.setGuideLinePaint(Color.RED);
assertTrue(r1.equals(r2));
}
示例9: testEquals
import org.jfree.chart.renderer.LookupPaintScale; //导入依赖的package包/类
/**
* Some checks for the equals() method.
*/
public void testEquals() {
XYShapeRenderer r1 = new XYShapeRenderer();
XYShapeRenderer r2 = new XYShapeRenderer();
assertTrue(r1.equals(r2));
assertTrue(r2.equals(r1));
r1.setPaintScale(new LookupPaintScale(1.0, 2.0, Color.white));
assertFalse(r1.equals(r2));
r2.setPaintScale(new LookupPaintScale(1.0, 2.0, Color.white));
assertTrue(r1.equals(r2));
r1.setDrawOutlines(true);
assertFalse(r1.equals(r2));
r2.setDrawOutlines(true);
assertTrue(r1.equals(r2));
r1.setUseOutlinePaint(false);
assertFalse(r1.equals(r2));
r2.setUseOutlinePaint(false);
assertTrue(r1.equals(r2));
r1.setUseFillPaint(true);
assertFalse(r1.equals(r2));
r2.setUseFillPaint(true);
assertTrue(r1.equals(r2));
r1.setGuideLinesVisible(true);
assertFalse(r1.equals(r2));
r2.setGuideLinesVisible(true);
assertTrue(r1.equals(r2));
r1.setGuideLinePaint(Color.red);
assertFalse(r1.equals(r2));
r2.setGuideLinePaint(Color.red);
assertTrue(r1.equals(r2));
}
示例10: addValuesToPaintScale
import org.jfree.chart.renderer.LookupPaintScale; //导入依赖的package包/类
protected static void addValuesToPaintScale(LookupPaintScale paintScale, double lowerBound, double upperBound,
Color lowColor, Color highColor)
{
int distinctValues = DISTINCT_PALETTE_VALUES;
if (upperBound <= lowerBound)
upperBound = lowerBound + .0001;
double increment = (upperBound - lowerBound) / distinctValues;
int redDiff = highColor.getRed() - lowColor.getRed();
int greenDiff = highColor.getGreen() - lowColor.getGreen();
int blueDiff = highColor.getBlue() - lowColor.getBlue();
double redIncrement = (redDiff / distinctValues);
double greenIncrement = (greenDiff / distinctValues);
double blueIncrement = (blueDiff / distinctValues);
_log.debug("Palette: ");
for (int i=0; i<distinctValues; i++)
{
int r = (int) (lowColor.getRed() + (i * redIncrement));
int g = (int) (lowColor.getGreen() + (i * greenIncrement));
int b = (int) (lowColor.getBlue() + (i * blueIncrement));
Color incrementColor = new Color(r,g,b);
double incrementStart = lowerBound + (i * increment);
paintScale.add(incrementStart, incrementColor);
_log.debug("\t" + incrementStart + "-" + (incrementStart + increment) + ": " + incrementColor);
}
}
示例11: createPaintScale
import org.jfree.chart.renderer.LookupPaintScale; //导入依赖的package包/类
/**
* Creates a paintscale that has _distinctValues_ even increments between
* lowColor and highColor, starting with value lowerBound and ending with upperBound
* @param lowerBound
* @param upperBound
* @param lowColor
* @param highColor
* @return
*/
public static LookupPaintScale createPaintScale(double lowerBound,
double upperBound,
Color lowColor, Color highColor)
{
//prevent rounding errors that make highest value undefine
LookupPaintScale result = new LookupPaintScale(lowerBound, upperBound+0.01, lowColor);
addValuesToPaintScale(result, lowerBound, upperBound, lowColor, highColor);
return result;
}
示例12: createHeatMapPaintScale
import org.jfree.chart.renderer.LookupPaintScale; //导入依赖的package包/类
/**
* Create a paint scale that cycles from white to blue in the positive range, defines a shade value at 1.0, and
* defaults to RED for everything else
* @return
*/
protected LookupPaintScale createHeatMapPaintScale()
{
LookupPaintScale result = new LookupPaintScale(-1, upperZBound*=1.04, Color.RED);
addValuesToPaintScale(result, 0, upperZBound, Color.WHITE, Color.BLUE);
//-1 is special value for background level
Color shadeColor = new Color(245, 245, 245);
addValuesToPaintScale(result, -1.1, -0.9, shadeColor, shadeColor);
return result;
}
示例13: testEquals
import org.jfree.chart.renderer.LookupPaintScale; //导入依赖的package包/类
/**
* Test that the equals() method distinguishes all fields.
*/
public void testEquals() {
// default instances
PaintScaleLegend l1 = new PaintScaleLegend(new GrayPaintScale(),
new NumberAxis("X"));
PaintScaleLegend l2 = new PaintScaleLegend(new GrayPaintScale(),
new NumberAxis("X"));
assertTrue(l1.equals(l2));
assertTrue(l2.equals(l1));
// paintScale
l1.setScale(new LookupPaintScale());
assertFalse(l1.equals(l2));
l2.setScale(new LookupPaintScale());
assertTrue(l1.equals(l2));
// axis
l1.setAxis(new NumberAxis("Axis 2"));
assertFalse(l1.equals(l2));
l2.setAxis(new NumberAxis("Axis 2"));
assertTrue(l1.equals(l2));
// axisLocation
l1.setAxisLocation(AxisLocation.BOTTOM_OR_RIGHT);
assertFalse(l1.equals(l2));
l2.setAxisLocation(AxisLocation.BOTTOM_OR_RIGHT);
assertTrue(l1.equals(l2));
// axisOffset
l1.setAxisOffset(99.0);
assertFalse(l1.equals(l2));
l2.setAxisOffset(99.0);
assertTrue(l1.equals(l2));
// stripWidth
l1.setStripWidth(99.0);
assertFalse(l1.equals(l2));
l2.setStripWidth(99.0);
assertTrue(l1.equals(l2));
// stripOutlineVisible
l1.setStripOutlineVisible(!l1.isStripOutlineVisible());
assertFalse(l1.equals(l2));
l2.setStripOutlineVisible(l1.isStripOutlineVisible());
assertTrue(l1.equals(l2));
// stripOutlinePaint
l1.setStripOutlinePaint(new GradientPaint(1.0f, 2.0f, Color.red,
3.0f, 4.0f, Color.blue));
assertFalse(l1.equals(l2));
l2.setStripOutlinePaint(new GradientPaint(1.0f, 2.0f, Color.red,
3.0f, 4.0f, Color.blue));
assertTrue(l1.equals(l2));
// stripOutlineStroke
l1.setStripOutlineStroke(new BasicStroke(1.1f));
assertFalse(l1.equals(l2));
l2.setStripOutlineStroke(new BasicStroke(1.1f));
assertTrue(l1.equals(l2));
// backgroundPaint
l1.setBackgroundPaint(new GradientPaint(1.0f, 2.0f, Color.red,
3.0f, 4.0f, Color.blue));
assertFalse(l1.equals(l2));
l2.setBackgroundPaint(new GradientPaint(1.0f, 2.0f, Color.red,
3.0f, 4.0f, Color.blue));
assertTrue(l1.equals(l2));
}