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


Java MeterInterval类代码示例

本文整理汇总了Java中org.jfree.chart.plot.MeterInterval的典型用法代码示例。如果您正苦于以下问题:Java MeterInterval类的具体用法?Java MeterInterval怎么用?Java MeterInterval使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


MeterInterval类属于org.jfree.chart.plot包,在下文中一共展示了MeterInterval类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testDrawWithNullInfo

import org.jfree.chart.plot.MeterInterval; //导入依赖的package包/类
/**
 * Draws the chart with a single range.  At one point, this caused a null
 * pointer exception (fixed now).
 */
public void testDrawWithNullInfo() {
    boolean success = false;
    MeterPlot plot = new MeterPlot(new DefaultValueDataset(60.0));
    plot.addInterval(new MeterInterval("Normal", new Range(0.0, 80.0)));
    JFreeChart chart = new JFreeChart(plot);
    try {
        BufferedImage image = new BufferedImage(200, 100, 
                BufferedImage.TYPE_INT_RGB);
        Graphics2D g2 = image.createGraphics();
        chart.draw(g2, new Rectangle2D.Double(0, 0, 200, 100), null, null);
        g2.dispose();
        success = true;
    }
    catch (Exception e) {
        success = false;   
    }
    assertTrue(success);
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:23,代码来源:MeterChartTests.java

示例2: convertInterval

import org.jfree.chart.plot.MeterInterval; //导入依赖的package包/类
/**
 * Converts a JasperReports meter interval to one that JFreeChart understands.
 *
 * @param interval the JasperReports definition of an interval
 * @param evaluation current evaluation time
 * @return the JFreeChart version of the same interval
 * @throws JRException thrown when the interval contains an invalid range
 */
protected MeterInterval convertInterval(JRMeterInterval interval) throws JRException
{
	String label = interval.getLabel();
	if (label == null)
		label = "";

	Range range = convertRange(interval.getDataRange());

	Color color = interval.getBackgroundColor() != null ? interval.getBackgroundColor() : (Color)ChartThemesConstants.TRANSPARENT_PAINT;
	float[] components = color.getRGBColorComponents(null);

	float alpha = interval.getAlphaDouble() == null ? (float)JRMeterInterval.DEFAULT_TRANSPARENCY : interval.getAlphaDouble().floatValue();
	Color alphaColor = new Color(components[0], components[1], components[2], alpha);

	return new MeterInterval(label, range, alphaColor, null, alphaColor);
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:25,代码来源:GenericChartTheme.java

示例3: convertInterval

import org.jfree.chart.plot.MeterInterval; //导入依赖的package包/类
/**
 * Converts a JasperReports meter interval to one that JFreeChart understands.
 *
 * @param interval the JasperReports definition of an interval
 * @param evaluation current evaluation time
 * @return the JFreeChart version of the same interval
 * @throws JRException thrown when the interval contains an invalid range
 */
protected MeterInterval convertInterval(JRMeterInterval interval, byte evaluation) throws JRException
{
	String label = interval.getLabel();
	if (label == null)
	{
		label = "";
	}

	Range range = convertRange(interval.getDataRange(), evaluation);

	Color color = interval.getBackgroundColor();
	float[] components = color.getRGBColorComponents(null);
	float alpha = interval.getAlphaDouble() == null ? (float)JRMeterInterval.DEFAULT_TRANSPARENCY : interval.getAlphaDouble().floatValue();

	Color alphaColor = new Color(components[0], components[1], components[2], alpha);

	return new MeterInterval(label, range, alphaColor, null, alphaColor);
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:27,代码来源:JRFillChart.java

示例4: convertInterval

import org.jfree.chart.plot.MeterInterval; //导入依赖的package包/类
/**
 * Converts a JasperReports meter interval to one that JFreeChart understands.
 *
 * @param interval the JasperReports definition of an interval
 * @return the JFreeChart version of the same interval
 * @throws JRException thrown when the interval contains an invalid range
 */
protected MeterInterval convertInterval(JRMeterInterval interval) throws JRException
{
	String label = interval.getLabel();
	if (label == null)
	{
		label = "";
	}

	Range range = convertRange(interval.getDataRange());

	Color color = interval.getBackgroundColor() == null ? getChart().getBackcolor() : interval.getBackgroundColor();//FIXMETHEME check this null protection
	float[] components = color.getRGBColorComponents(null);

	float alpha = interval.getAlphaDouble() == null ? (float)JRMeterInterval.DEFAULT_TRANSPARENCY : interval.getAlphaDouble().floatValue();
	Color alphaColor = new Color(components[0], components[1], components[2], alpha);

	return new MeterInterval(label, range, alphaColor, null, alphaColor);
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:26,代码来源:DefaultChartTheme.java

示例5: testDrawWithNullInfo

import org.jfree.chart.plot.MeterInterval; //导入依赖的package包/类
/**
 * Draws the chart with a single range.  At one point, this caused a null
 * pointer exception (fixed now).
 */
public void testDrawWithNullInfo() {
    boolean success = false;
    MeterPlot plot = new MeterPlot(new DefaultValueDataset(60.0));
    plot.addInterval(new MeterInterval("Normal", new Range(0.0, 80.0)));
    JFreeChart chart = new JFreeChart(plot);
    try {
        BufferedImage image = new BufferedImage(200, 100,
                BufferedImage.TYPE_INT_RGB);
        Graphics2D g2 = image.createGraphics();
        chart.draw(g2, new Rectangle2D.Double(0, 0, 200, 100), null, null);
        g2.dispose();
        success = true;
    }
    catch (Exception e) {
        success = false;
    }
    assertTrue(success);
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:23,代码来源:MeterChartTests.java

示例6: createChart

import org.jfree.chart.plot.MeterInterval; //导入依赖的package包/类
/** {@inheritDoc} */
@Override
protected JFreeChart createChart() {
	MeterPlot plot = createMeterPlot();

	plot.addInterval(new MeterInterval("Green", new Range(0,
			greenThreshold), null, null, ECCSMColor.GREEN.getColor()));
	plot.addInterval(new MeterInterval("Yellow", new Range(greenThreshold,
			yellowThreshold), null, null, ECCSMColor.YELLOW.getColor()));
	plot.addInterval(new MeterInterval("Red", new Range(yellowThreshold,
			redThreshold), null, null, ECCSMColor.RED.getColor()));

	JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT,
			plot, drawLegend);

	return chart;
}
 
开发者ID:vimaier,项目名称:conqat,代码行数:18,代码来源:MeterChartCreator.java

示例7: testDrawWithNullInfo

import org.jfree.chart.plot.MeterInterval; //导入依赖的package包/类
/**
 * Draws the chart with a single range.  At one point, this caused a null
 * pointer exception (fixed now).
 */
@Test
public void testDrawWithNullInfo() {
    MeterPlot plot = new MeterPlot(new DefaultValueDataset(60.0));
    plot.addInterval(new MeterInterval("Normal", new Range(0.0, 80.0)));
    JFreeChart chart = new JFreeChart(plot);
    BufferedImage image = new BufferedImage(200, 100,
            BufferedImage.TYPE_INT_RGB);
    Graphics2D g2 = image.createGraphics();
    chart.draw(g2, new Rectangle2D.Double(0, 0, 200, 100), null, null);
    g2.dispose();
    //FIXME we should really assert a value here
}
 
开发者ID:mdzio,项目名称:ccu-historian,代码行数:17,代码来源:MeterChartTest.java

示例8: createDialChart

import org.jfree.chart.plot.MeterInterval; //导入依赖的package包/类
private JFreeChart createDialChart(ReportChart reportChart,
        ChartValue[] values, boolean displayInline)
{
    DefaultValueDataset dataset = createDefaultValueDataset(values);

    MeterPlot plot = new MeterPlot(dataset);
    plot.setRange(new Range(0, 60));
    plot.addInterval(new MeterInterval("Normal", new Range(0.0, 35.0),
            Color.lightGray, new BasicStroke(2.0f), new Color(0, 255, 0, 64)));
    plot.addInterval(new MeterInterval("Warning", new Range(35.0, 50.0),
            Color.lightGray, new BasicStroke(2.0f), new Color(255, 255, 0, 64)));
    plot.addInterval(new MeterInterval("Critical", new Range(50.0, 60.0),
            Color.lightGray, new BasicStroke(2.0f), new Color(255, 0, 0, 128)));
    plot.setNeedlePaint(Color.darkGray);
    plot.setDialBackgroundPaint(Color.white);
    plot.setDialOutlinePaint(Color.gray);
    plot.setDialShape(DialShape.CHORD);
    plot.setMeterAngle(260);
    plot.setTickLabelsVisible(true);
    plot.setTickLabelFont(new Font("Dialog", Font.BOLD, 10));
    plot.setTickLabelPaint(Color.darkGray);
    plot.setTickSize(5.0);
    plot.setTickPaint(Color.lightGray);
    plot.setValuePaint(Color.black);
    plot.setValueFont(new Font("Dialog", Font.BOLD, 14));

    JFreeChart chart = new JFreeChart(reportChart.getTitle(),
            JFreeChart.DEFAULT_TITLE_FONT, plot, reportChart.isShowLegend());

    return chart;
}
 
开发者ID:mtpettyp,项目名称:openreports,代码行数:32,代码来源:ChartReportEngine.java

示例9: getGaugeChart

import org.jfree.chart.plot.MeterInterval; //导入依赖的package包/类
private JFreeChart getGaugeChart( BaseChart chart, ValueDataset dataSet )
{
    MeterPlot meterPlot = new MeterPlot( dataSet );

    meterPlot.setUnits( "" );
    meterPlot.setRange( new Range( 0.0d, 100d ) );
            
    for ( int i = 0; i < 10; i++ )
    {
        double start = i * 10;
        double end = start + 10;
        String label = String.valueOf( start );
        
        meterPlot.addInterval( new MeterInterval( label, new Range( start, end ), COLOR_LIGHT_GRAY, null, COLOR_LIGHT_GRAY ) );
    }
    
    meterPlot.setMeterAngle(180);
    meterPlot.setDialBackgroundPaint( COLOR_LIGHT_GRAY );
    meterPlot.setDialShape( DialShape.CHORD );
    meterPlot.setNeedlePaint( COLORS[0] );
    meterPlot.setTickLabelsVisible( true );
    meterPlot.setTickLabelFont( LABEL_FONT );
    meterPlot.setTickLabelPaint( Color.BLACK );
    meterPlot.setTickPaint( COLOR_LIGHTER_GRAY );
    meterPlot.setValueFont( TITLE_FONT );
    meterPlot.setValuePaint( Color.BLACK );
    
    JFreeChart meterChart = new JFreeChart( chart.getName(), meterPlot );
    setBasicConfig( meterChart, chart );
    meterChart.removeLegend();
    
    return meterChart;
}
 
开发者ID:ehatle,项目名称:AgileAlligators,代码行数:34,代码来源:DefaultChartService.java

示例10: createDialChart

import org.jfree.chart.plot.MeterInterval; //导入依赖的package包/类
private JFreeChart createDialChart(ReportChart reportChart,
		ChartValue[] values, boolean displayInline)
{
	DefaultValueDataset dataset = createDefaultValueDataset(values);

	MeterPlot plot = new MeterPlot(dataset);
	plot.setRange(new Range(0, 60));
	plot.addInterval(new MeterInterval("Normal", new Range(0.0, 35.0),
			Color.lightGray, new BasicStroke(2.0f), new Color(0, 255, 0, 64)));
	plot.addInterval(new MeterInterval("Warning", new Range(35.0, 50.0),
			Color.lightGray, new BasicStroke(2.0f), new Color(255, 255, 0, 64)));
	plot.addInterval(new MeterInterval("Critical", new Range(50.0, 60.0),
			Color.lightGray, new BasicStroke(2.0f), new Color(255, 0, 0, 128)));
	plot.setNeedlePaint(Color.darkGray);
	plot.setDialBackgroundPaint(Color.white);
	plot.setDialOutlinePaint(Color.gray);
	plot.setDialShape(DialShape.CHORD);
	plot.setMeterAngle(260);
	plot.setTickLabelsVisible(true);
	plot.setTickLabelFont(new Font("Dialog", Font.BOLD, 10));
	plot.setTickLabelPaint(Color.darkGray);
	plot.setTickSize(5.0);
	plot.setTickPaint(Color.lightGray);
	plot.setValuePaint(Color.black);
	plot.setValueFont(new Font("Dialog", Font.BOLD, 14));

	JFreeChart chart = new JFreeChart(reportChart.getTitle(),
			JFreeChart.DEFAULT_TITLE_FONT, plot, reportChart.isShowLegend());

	return chart;
}
 
开发者ID:caherrerapa,项目名称:openreportsv2,代码行数:32,代码来源:ChartReportEngine.java

示例11: test

import org.jfree.chart.plot.MeterInterval; //导入依赖的package包/类
@Override
public void test() {
	super.test();

	numberOfPagesTest(1);

	JFreeChart chart = getChart("summary.chart1", 0);
	Plot plot = chart.getPlot();
	Assert.assertEquals("renderer", MeterPlot.class, plot.getClass());
	MeterPlot meterPlot = (MeterPlot) plot;
	Assert.assertEquals("value", 15, meterPlot.getDataset().getValue());
	Assert.assertEquals("data range low", 3d, meterPlot.getRange().getLowerBound());
	Assert.assertEquals("data range high", 30d, meterPlot.getRange().getUpperBound());
	Assert.assertEquals("value color", Color.BLUE, meterPlot.getValuePaint());
	Assert.assertEquals("value mask", "15.0", meterPlot.getTickLabelFormat().format(15));
	Assert.assertEquals("value font", new Font("Arial", Font.PLAIN, 10), meterPlot.getValueFont());
	Assert.assertEquals("shape", DialShape.CIRCLE, meterPlot.getDialShape());
	Assert.assertEquals("meter angle", 270, meterPlot.getMeterAngle());
	Assert.assertEquals("units", "units", meterPlot.getUnits());
	Assert.assertEquals("tick interval", 3d, meterPlot.getTickSize());
	Assert.assertEquals("background color", Color.LIGHT_GRAY, meterPlot.getDialBackgroundPaint());
	Assert.assertEquals("needle color", Color.CYAN, meterPlot.getNeedlePaint());
	Assert.assertEquals("tick color", Color.MAGENTA, meterPlot.getTickPaint());
	Assert.assertEquals("tick label font", new Font("Courier New", Font.PLAIN, 10), meterPlot.getTickLabelFont());
	Assert.assertEquals("intervals size", 2, meterPlot.getIntervals().size());
	intervalTest((MeterInterval) meterPlot.getIntervals().get(0), "red", new Color(1f, 0f, 0f, 0.8f), 25d, 30d);
	intervalTest((MeterInterval) meterPlot.getIntervals().get(1), "yellow", new Color(1f, 1f, 0f, 0.5f), 20d, 25d);
}
 
开发者ID:svn2github,项目名称:dynamicreports-jasper,代码行数:29,代码来源:MeterChartTest.java

示例12: testCloning

import org.jfree.chart.plot.MeterInterval; //导入依赖的package包/类
/**
 * This class is immutable so cloning isn't required.
 */
public void testCloning() {
    MeterInterval m1 = new MeterInterval("X", new Range(1.0, 2.0));
    assertFalse(m1 instanceof Cloneable);
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:8,代码来源:MeterIntervalTests.java

示例13: createChart

import org.jfree.chart.plot.MeterInterval; //导入依赖的package包/类
private  JFreeChart createChart(){
	JFreeChart chart = null;
	
	//	Set Text
	StringBuffer text = new StringBuffer(m_goal.getName());
	if (m_goal.isTarget())
		text.append(": ").append(m_goal.getPercent()).append("%");
	else
		text.append(": ").append(s_format.format(m_goal.getMeasureActual()));
	
	m_text = text.toString();

	//	ToolTip
	text = new StringBuffer();
	if (m_goal.getDescription() != null)
		text.append(m_goal.getDescription()).append(": ");
	text.append(s_format.format(m_goal.getMeasureActual()));
	if (m_goal.isTarget())
		text.append(" ").append(Msg.getMsg(Env.getCtx(), "of")).append(" ")
			.append(s_format.format(m_goal.getMeasureTarget()));
	setToolTipText(text.toString());
	//
	//setBackground(m_goal.getColor());
	setForeground(GraphUtil.getForeground(getBackground()));
	//	Performance Line
	int percent = m_goal.getPercent();
	if (percent > 100)			//	draw 100% line
		m_line = s_width100;
	else						//	draw Performance Line
		m_line = s_width100 * m_goal.getGoalPerformanceDouble();
	

       String title = m_text;        
       DefaultValueDataset data = new DefaultValueDataset(m_goal.getPercent());
       MeterPlot plot = new MeterPlot(data);

       MColorSchema colorSchema = m_goal.getColorSchema();		
       int rangeLo = 0; int rangeHi=0;
       for (int i=1; i<=4; i++){
           switch (i) {
            case 1: rangeHi = colorSchema.getMark1Percent(); break;
            case 2: rangeHi = colorSchema.getMark2Percent(); break;
            case 3: rangeHi = colorSchema.getMark3Percent(); break;
            case 4: rangeHi = colorSchema.getMark4Percent(); break;
           }
           if (rangeHi==9999)
           	rangeHi = (int) Math.floor(rangeLo*1.5);
           if (rangeLo < rangeHi) {
           	plot.addInterval(new MeterInterval("Normal", //label
                	  new Range(rangeLo, rangeHi), //range
                	  colorSchema.getColor(rangeHi),
                	  new BasicStroke(7.0f),
                	  //Color.lightGray
                	  new Color(-13091716)
                	  //Color.gray 
               ));
           	rangeLo = rangeHi;
           }
       }
       plot.setRange(new Range(0,rangeLo));
       
       plot.setDialBackgroundPaint(new Color(-13091716));//Color.GRAY);
       plot.setUnits(m_goal.getName());
       plot.setDialShape(DialShape.CHORD);//CIRCLE);        
       //plot.setDialBackgroundPaint(new GradientPaint(0, 0, m_goal.getColor(), 0, 1000, Color.black));
       plot.setNeedlePaint(Color.white);  
       plot.setTickSize(2000);
       plot.setTickLabelFont(new Font("SansSerif", Font.BOLD, 12));
       plot.setTickLabelPaint(Color.white);
       plot.setInsets(new RectangleInsets(1.0, 2.0, 3.0, 4.0)); 

       chart = new JFreeChart( m_text, new Font("SansSerif", Font.BOLD, 15), plot,false);
       
	return chart;
}
 
开发者ID:metasfresh,项目名称:metasfresh,代码行数:76,代码来源:PerformanceIndicator.java

示例14: intervalTest

import org.jfree.chart.plot.MeterInterval; //导入依赖的package包/类
private void intervalTest(MeterInterval interval, String label, Color backgroundColor, double rangeLow, double rangeHigh) {
	Assert.assertEquals("interval label", label, interval.getLabel());
	Assert.assertEquals("interval background color", backgroundColor, interval.getBackgroundPaint());
	Assert.assertEquals("interval data range low", rangeLow, interval.getRange().getLowerBound());
	Assert.assertEquals("interval data range high", rangeHigh, interval.getRange().getUpperBound());
}
 
开发者ID:svn2github,项目名称:dynamicreports-jasper,代码行数:7,代码来源:MeterChartTest.java


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