当前位置: 首页>>代码示例>>Java>>正文


Java LookupPaintScale.add方法代码示例

本文整理汇总了Java中org.jfree.chart.renderer.LookupPaintScale.add方法的典型用法代码示例。如果您正苦于以下问题:Java LookupPaintScale.add方法的具体用法?Java LookupPaintScale.add怎么用?Java LookupPaintScale.add使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.jfree.chart.renderer.LookupPaintScale的用法示例。


在下文中一共展示了LookupPaintScale.add方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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));
}
 
开发者ID:mdzio,项目名称:ccu-historian,代码行数:21,代码来源:XYBlockRendererTest.java

示例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));
}
 
开发者ID:jfree,项目名称:jfreechart,代码行数:21,代码来源:XYBlockRendererTest.java

示例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;
}
 
开发者ID:gama-platform,项目名称:gama,代码行数:23,代码来源:ChartJFreeChartOutputHeatmap.java

示例4: 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);
    }
}
 
开发者ID:dhmay,项目名称:msInspect,代码行数:30,代码来源:PanelWithHeatMap.java

示例5: testGeneral

import org.jfree.chart.renderer.LookupPaintScale; //导入方法依赖的package包/类
/**
 * Some general checks for the lookup table.
 */
public void testGeneral() {
    
    LookupPaintScale s = new LookupPaintScale(0.0, 100.0, Color.black);
    assertEquals(Color.black, s.getPaint(-1.0));
    assertEquals(Color.black, s.getPaint(0.0));
    assertEquals(Color.black, s.getPaint(50.0));
    assertEquals(Color.black, s.getPaint(100.0));
    assertEquals(Color.black, s.getPaint(101.0));
    
    s.add(new Double(50.0), Color.blue);
    assertEquals(Color.black, s.getPaint(-1.0));
    assertEquals(Color.black, s.getPaint(0.0));
    assertEquals(Color.blue, s.getPaint(50.0));
    assertEquals(Color.blue, s.getPaint(100.0));
    assertEquals(Color.black, s.getPaint(101.0));
    
    s.add(new Double(50.0), Color.red);
    assertEquals(Color.black, s.getPaint(-1.0));
    assertEquals(Color.black, s.getPaint(0.0));
    assertEquals(Color.red, s.getPaint(50.0));
    assertEquals(Color.red, s.getPaint(100.0));
    assertEquals(Color.black, s.getPaint(101.0));
    
    s.add(new Double(25.0), Color.green);
    assertEquals(Color.black, s.getPaint(-1.0));
    assertEquals(Color.black, s.getPaint(0.0));
    assertEquals(Color.green, s.getPaint(25.0));
    assertEquals(Color.red, s.getPaint(50.0));
    assertEquals(Color.red, s.getPaint(100.0));
    assertEquals(Color.black, s.getPaint(101.0));
    
    s.add(new Double(75.0), Color.yellow);
    assertEquals(Color.black, s.getPaint(-1.0));
    assertEquals(Color.black, s.getPaint(0.0));
    assertEquals(Color.green, s.getPaint(25.0));
    assertEquals(Color.red, s.getPaint(50.0));
    assertEquals(Color.yellow, s.getPaint(75.0));
    assertEquals(Color.yellow, s.getPaint(100.0));
    assertEquals(Color.black, s.getPaint(101.0));
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:44,代码来源:LookupPaintScaleTests.java

示例6: testGeneral

import org.jfree.chart.renderer.LookupPaintScale; //导入方法依赖的package包/类
/**
 * Some general checks for the lookup table.
 */
public void testGeneral() {

    LookupPaintScale s = new LookupPaintScale(0.0, 100.0, Color.black);
    assertEquals(Color.black, s.getPaint(-1.0));
    assertEquals(Color.black, s.getPaint(0.0));
    assertEquals(Color.black, s.getPaint(50.0));
    assertEquals(Color.black, s.getPaint(100.0));
    assertEquals(Color.black, s.getPaint(101.0));

    s.add(50.0, Color.blue);
    assertEquals(Color.black, s.getPaint(-1.0));
    assertEquals(Color.black, s.getPaint(0.0));
    assertEquals(Color.blue, s.getPaint(50.0));
    assertEquals(Color.blue, s.getPaint(100.0));
    assertEquals(Color.black, s.getPaint(101.0));

    s.add(50.0, Color.red);
    assertEquals(Color.black, s.getPaint(-1.0));
    assertEquals(Color.black, s.getPaint(0.0));
    assertEquals(Color.red, s.getPaint(50.0));
    assertEquals(Color.red, s.getPaint(100.0));
    assertEquals(Color.black, s.getPaint(101.0));

    s.add(25.0, Color.green);
    assertEquals(Color.black, s.getPaint(-1.0));
    assertEquals(Color.black, s.getPaint(0.0));
    assertEquals(Color.green, s.getPaint(25.0));
    assertEquals(Color.red, s.getPaint(50.0));
    assertEquals(Color.red, s.getPaint(100.0));
    assertEquals(Color.black, s.getPaint(101.0));

    s.add(75.0, Color.yellow);
    assertEquals(Color.black, s.getPaint(-1.0));
    assertEquals(Color.black, s.getPaint(0.0));
    assertEquals(Color.green, s.getPaint(25.0));
    assertEquals(Color.red, s.getPaint(50.0));
    assertEquals(Color.yellow, s.getPaint(75.0));
    assertEquals(Color.yellow, s.getPaint(100.0));
    assertEquals(Color.black, s.getPaint(101.0));
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:44,代码来源:LookupPaintScaleTests.java


注:本文中的org.jfree.chart.renderer.LookupPaintScale.add方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。