Java 类org.jfree.chart.plot.MeterPlot 实例源码

项目:parabuild-ci    文件:MeterChartTests.java   
/**
 * 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);
}
项目:nabs    文件:MeterChartTests.java   
/**
 * 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);
}
项目:astor    文件:MeterChartTests.java   
/**
 * 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);
}
项目:conqat    文件:MeterChartCreator.java   
/** {@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;
}
项目:conqat    文件:MeterChartCreator.java   
/** Creates a meter plot and sets color values */
private MeterPlot createMeterPlot() {
    MeterPlot plot = new MeterPlot(new DefaultValueDataset(value));

    plot.setUnits(unit);
    plot.setDialShape(DialShape.CHORD);
    plot.setDialBackgroundPaint(Color.WHITE);
    plot.setRange(new Range(0, redThreshold));
    plot.setDialOutlinePaint(Color.GRAY);
    plot.setNeedlePaint(Color.BLACK);
    plot.setTickLabelsVisible(true);
    plot.setTickLabelPaint(Color.BLACK);
    plot.setTickPaint(Color.GRAY);
    plot.setTickLabelFormat(NumberFormat.getNumberInstance());
    plot.setTickSize(10);
    plot.setValuePaint(Color.BLACK);

    return plot;
}
项目:parabuild-ci    文件:DefaultMeterDataset.java   
/**
 * Creates a new dataset.
 *
 * @param min  the minimum value.
 * @param max  the maximum value.
 * @param value  the current value.
 * @param units  the unit description.
 */
public DefaultMeterDataset(final Number min, 
                           final Number max, 
                           final Number value, 
                           final String units) {
    this(
        min, max, value, units, null, null, null, null, null, null, MeterPlot.FULL_DATA_RANGE
    );
}
项目:ccu-historian    文件:MeterChartTest.java   
/**
 * 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
}
项目:ccu-historian    文件:StandardChartTheme.java   
/**
 * Applies the attributes of this theme to a {@link MeterPlot}.
 *
 * @param plot  the plot (<code>null</code> not permitted).
 */
protected void applyToMeterPlot(MeterPlot plot) {
    plot.setDialBackgroundPaint(this.plotBackgroundPaint);
    plot.setValueFont(this.largeFont);
    plot.setValuePaint(this.axisLabelPaint);
    plot.setDialOutlinePaint(this.plotOutlinePaint);
    plot.setNeedlePaint(this.thermometerPaint);
    plot.setTickLabelFont(this.regularFont);
    plot.setTickLabelPaint(this.tickLabelPaint);
}
项目:jfreechart    文件:StandardChartTheme.java   
/**
 * Applies the attributes of this theme to a {@link MeterPlot}.
 *
 * @param plot  the plot ({@code null} not permitted).
 */
protected void applyToMeterPlot(MeterPlot plot) {
    plot.setDialBackgroundPaint(this.plotBackgroundPaint);
    plot.setValueFont(this.largeFont);
    plot.setValuePaint(this.axisLabelPaint);
    plot.setDialOutlinePaint(this.plotOutlinePaint);
    plot.setNeedlePaint(this.thermometerPaint);
    plot.setTickLabelFont(this.regularFont);
    plot.setTickLabelPaint(this.tickLabelPaint);
}
项目:jfreechart    文件:MeterChartTest.java   
/**
 * 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
}
项目:aya-lang    文件:MeterChartTest.java   
/**
 * 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
}
项目:aya-lang    文件:StandardChartTheme.java   
/**
 * Applies the attributes of this theme to a {@link MeterPlot}.
 *
 * @param plot  the plot (<code>null</code> not permitted).
 */
protected void applyToMeterPlot(MeterPlot plot) {
    plot.setDialBackgroundPaint(this.plotBackgroundPaint);
    plot.setValueFont(this.largeFont);
    plot.setValuePaint(this.axisLabelPaint);
    plot.setDialOutlinePaint(this.plotOutlinePaint);
    plot.setNeedlePaint(this.thermometerPaint);
    plot.setTickLabelFont(this.regularFont);
    plot.setTickLabelPaint(this.tickLabelPaint);
}
项目:HTML5_WebSite    文件:StandardChartTheme.java   
/**
 * Applies the attributes of this theme to a {@link MeterPlot}.
 *
 * @param plot  the plot (<code>null</code> not permitted).
 */
protected void applyToMeterPlot(MeterPlot plot) {
    plot.setDialBackgroundPaint(this.plotBackgroundPaint);
    plot.setValueFont(this.largeFont);
    plot.setValuePaint(this.axisLabelPaint);
    plot.setDialOutlinePaint(this.plotOutlinePaint);
    plot.setNeedlePaint(this.thermometerPaint);
    plot.setTickLabelFont(this.regularFont);
    plot.setTickLabelPaint(this.tickLabelPaint);
}
项目:populus    文件:StandardChartTheme.java   
/**
 * Applies the attributes of this theme to a {@link MeterPlot}.
 *
 * @param plot  the plot (<code>null</code> not permitted).
 */
protected void applyToMeterPlot(MeterPlot plot) {
    plot.setDialBackgroundPaint(this.plotBackgroundPaint);
    plot.setValueFont(this.largeFont);
    plot.setValuePaint(this.axisLabelPaint);
    plot.setDialOutlinePaint(this.plotOutlinePaint);
    plot.setNeedlePaint(this.thermometerPaint);
    plot.setTickLabelFont(this.regularFont);
    plot.setTickLabelPaint(this.tickLabelPaint);
}
项目:openreports    文件:ChartReportEngine.java   
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;
}
项目:AgileAlligators    文件:DefaultChartService.java   
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;
}
项目:PI    文件:StandardChartTheme.java   
/**
 * Applies the attributes of this theme to a {@link MeterPlot}.
 *
 * @param plot  the plot (<code>null</code> not permitted).
 */
protected void applyToMeterPlot(MeterPlot plot) {
    plot.setDialBackgroundPaint(this.plotBackgroundPaint);
    plot.setValueFont(this.largeFont);
    plot.setValuePaint(this.axisLabelPaint);
    plot.setDialOutlinePaint(this.plotOutlinePaint);
    plot.setNeedlePaint(this.thermometerPaint);
    plot.setTickLabelFont(this.regularFont);
    plot.setTickLabelPaint(this.tickLabelPaint);
}
项目:ECG-Viewer    文件:MeterChartTest.java   
/**
 * 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
}
项目:ECG-Viewer    文件:StandardChartTheme.java   
/**
 * Applies the attributes of this theme to a {@link MeterPlot}.
 *
 * @param plot  the plot (<code>null</code> not permitted).
 */
protected void applyToMeterPlot(MeterPlot plot) {
    plot.setDialBackgroundPaint(this.plotBackgroundPaint);
    plot.setValueFont(this.largeFont);
    plot.setValuePaint(this.axisLabelPaint);
    plot.setDialOutlinePaint(this.plotOutlinePaint);
    plot.setNeedlePaint(this.thermometerPaint);
    plot.setTickLabelFont(this.regularFont);
    plot.setTickLabelPaint(this.tickLabelPaint);
}
项目:astor    文件:StandardChartTheme.java   
/**
 * Applies the attributes of this theme to a {@link MeterPlot}.
 *
 * @param plot  the plot (<code>null</code> not permitted).
 */
protected void applyToMeterPlot(MeterPlot plot) {
    plot.setDialBackgroundPaint(this.plotBackgroundPaint);
    plot.setValueFont(this.largeFont);
    plot.setValuePaint(this.axisLabelPaint);
    plot.setDialOutlinePaint(this.plotOutlinePaint);
    plot.setNeedlePaint(this.thermometerPaint);
    plot.setTickLabelFont(this.regularFont);
    plot.setTickLabelPaint(this.tickLabelPaint);
}
项目:group-five    文件:MeterChartTest.java   
/**
 * 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
}
项目:group-five    文件:StandardChartTheme.java   
/**
 * Applies the attributes of this theme to a {@link MeterPlot}.
 *
 * @param plot  the plot (<code>null</code> not permitted).
 */
protected void applyToMeterPlot(MeterPlot plot) {
    plot.setDialBackgroundPaint(this.plotBackgroundPaint);
    plot.setValueFont(this.largeFont);
    plot.setValuePaint(this.axisLabelPaint);
    plot.setDialOutlinePaint(this.plotOutlinePaint);
    plot.setNeedlePaint(this.thermometerPaint);
    plot.setTickLabelFont(this.regularFont);
    plot.setTickLabelPaint(this.tickLabelPaint);
}
项目:manydesigns.cn    文件:StandardChartTheme.java   
/**
 * Applies the attributes of this theme to a {@link MeterPlot}.
 *
 * @param plot  the plot (<code>null</code> not permitted).
 */
protected void applyToMeterPlot(MeterPlot plot) {
    plot.setDialBackgroundPaint(this.plotBackgroundPaint);
    plot.setValueFont(this.largeFont);
    plot.setValuePaint(this.axisLabelPaint);
    plot.setDialOutlinePaint(this.plotOutlinePaint);
    plot.setNeedlePaint(this.thermometerPaint);
    plot.setTickLabelFont(this.regularFont);
    plot.setTickLabelPaint(this.tickLabelPaint);
}
项目:buffer_bci    文件:MeterChartTest.java   
/**
 * 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
}
项目:buffer_bci    文件:StandardChartTheme.java   
/**
 * Applies the attributes of this theme to a {@link MeterPlot}.
 *
 * @param plot  the plot (<code>null</code> not permitted).
 */
protected void applyToMeterPlot(MeterPlot plot) {
    plot.setDialBackgroundPaint(this.plotBackgroundPaint);
    plot.setValueFont(this.largeFont);
    plot.setValuePaint(this.axisLabelPaint);
    plot.setDialOutlinePaint(this.plotOutlinePaint);
    plot.setNeedlePaint(this.thermometerPaint);
    plot.setTickLabelFont(this.regularFont);
    plot.setTickLabelPaint(this.tickLabelPaint);
}
项目:buffer_bci    文件:StandardChartTheme.java   
/**
 * Applies the attributes of this theme to a {@link MeterPlot}.
 *
 * @param plot  the plot (<code>null</code> not permitted).
 */
protected void applyToMeterPlot(MeterPlot plot) {
    plot.setDialBackgroundPaint(this.plotBackgroundPaint);
    plot.setValueFont(this.largeFont);
    plot.setValuePaint(this.axisLabelPaint);
    plot.setDialOutlinePaint(this.plotOutlinePaint);
    plot.setNeedlePaint(this.thermometerPaint);
    plot.setTickLabelFont(this.regularFont);
    plot.setTickLabelPaint(this.tickLabelPaint);
}
项目:openreportsv2    文件:ChartReportEngine.java   
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;
}
项目:proyecto-teoria-control-utn-frro    文件:MeterChartTest.java   
/**
 * 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
}
项目:proyecto-teoria-control-utn-frro    文件:StandardChartTheme.java   
/**
 * Applies the attributes of this theme to a {@link MeterPlot}.
 *
 * @param plot  the plot (<code>null</code> not permitted).
 */
protected void applyToMeterPlot(MeterPlot plot) {
    plot.setDialBackgroundPaint(this.plotBackgroundPaint);
    plot.setValueFont(this.largeFont);
    plot.setValuePaint(this.axisLabelPaint);
    plot.setDialOutlinePaint(this.plotOutlinePaint);
    plot.setNeedlePaint(this.thermometerPaint);
    plot.setTickLabelFont(this.regularFont);
    plot.setTickLabelPaint(this.tickLabelPaint);
}
项目:dynamicreports-jasper    文件:MeterChartTest.java   
@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);
}
项目:Memetic-Algorithm-for-TSP    文件:MeterChartTest.java   
/**
 * 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
}
项目:Memetic-Algorithm-for-TSP    文件:StandardChartTheme.java   
/**
 * Applies the attributes of this theme to a {@link MeterPlot}.
 *
 * @param plot  the plot (<code>null</code> not permitted).
 */
protected void applyToMeterPlot(MeterPlot plot) {
    plot.setDialBackgroundPaint(this.plotBackgroundPaint);
    plot.setValueFont(this.largeFont);
    plot.setValuePaint(this.axisLabelPaint);
    plot.setDialOutlinePaint(this.plotOutlinePaint);
    plot.setNeedlePaint(this.thermometerPaint);
    plot.setTickLabelFont(this.regularFont);
    plot.setTickLabelPaint(this.tickLabelPaint);
}
项目:parabuild-ci    文件:MeterLegend.java   
/**
     * Updates the legend information.
     *
     * @param plot  the plot.
     * @param data  the dataset.
     * @param type  the type.
     * @param index  the index.
     * @param legendItems  the legend items.
     * @param legendItemColors  the colors.
     *
     * @return boolean.
     */
    private boolean updateInformation(MeterPlot plot, ValueDataset data, int type, int index,
                                      LegendItem[] legendItems, Paint[] legendItemColors) {

        boolean ret = false;
        String label = null;
//        double minValue = 0.0;
//        double maxValue = 0.0;
        Paint paint = null;

        switch(type) {
            case MeterPlot.NORMAL_DATA_RANGE:
//                minValue = plot.getNormalRange().getLowerBound();
//                maxValue = plot.getNormalRange().getUpperBound();
                paint = plot.getNormalPaint();
                label = MeterPlot.NORMAL_TEXT;
                break;
            case MeterPlot.WARNING_DATA_RANGE:
//                minValue = plot.getWarningRange().getLowerBound();
//                maxValue = plot.getWarningRange().getUpperBound();
                paint = plot.getWarningPaint();
                label = MeterPlot.WARNING_TEXT;
                break;
            case MeterPlot.CRITICAL_DATA_RANGE:
//                minValue = plot.getCriticalRange().getLowerBound();
//                maxValue = plot.getCriticalRange().getUpperBound();
                paint = plot.getCriticalPaint();
                label = MeterPlot.CRITICAL_TEXT;
                break;
            case MeterPlot.FULL_DATA_RANGE:
//                minValue = plot.getRange().getLowerBound();
//                maxValue = plot.getRange().getUpperBound();
                paint = MeterPlot.DEFAULT_BACKGROUND_PAINT;
                label = "Meter Graph";
                break;
            default:
                return false;
        }

//        if (minValue != null && maxValue != null) {
//            if (data.getBorderType() == type) {
                label += "  Range: ";
//                      + data.getMinimumValue().toString() + " to "
//                      + minValue.toString()
//                      + "  and  "
//                      + maxValue.toString() + " to "
//                      + data.getMaximumValue().toString();
//            }
//            else {
//                label += "  Range: " + minValue.toString() + " to " + maxValue.toString();
//            }
            legendItems[index] = new LegendItem(label, label, null, true, null, null, null, null);
            legendItemColors[index] = paint;
            ret = true;
        //}
        return ret;
    }
项目:ccu-historian    文件:StandardChartTheme.java   
/**
 * Applies the attributes of this theme to a plot.
 *
 * @param plot  the plot (<code>null</code>).
 */
protected void applyToPlot(Plot plot) {
    ParamChecks.nullNotPermitted(plot, "plot");
    if (plot.getDrawingSupplier() != null) {
        plot.setDrawingSupplier(getDrawingSupplier());
    }
    if (plot.getBackgroundPaint() != null) {
        plot.setBackgroundPaint(this.plotBackgroundPaint);
    }
    plot.setOutlinePaint(this.plotOutlinePaint);

    // now handle specific plot types (and yes, I know this is some
    // really ugly code that has to be manually updated any time a new
    // plot type is added - I should have written something much cooler,
    // but I didn't and neither did anyone else).
    if (plot instanceof PiePlot) {
        applyToPiePlot((PiePlot) plot);
    }
    else if (plot instanceof MultiplePiePlot) {
        applyToMultiplePiePlot((MultiplePiePlot) plot);
    }
    else if (plot instanceof CategoryPlot) {
        applyToCategoryPlot((CategoryPlot) plot);
    }
    else if (plot instanceof XYPlot) {
        applyToXYPlot((XYPlot) plot);
    }
    else if (plot instanceof FastScatterPlot) {
        applyToFastScatterPlot((FastScatterPlot) plot);
    }
    else if (plot instanceof MeterPlot) {
        applyToMeterPlot((MeterPlot) plot);
    }
    else if (plot instanceof ThermometerPlot) {
        applyToThermometerPlot((ThermometerPlot) plot);
    }
    else if (plot instanceof SpiderWebPlot) {
        applyToSpiderWebPlot((SpiderWebPlot) plot);
    }
    else if (plot instanceof PolarPlot) {
        applyToPolarPlot((PolarPlot) plot);
    }
}
项目:jfreechart    文件:StandardChartTheme.java   
/**
 * Applies the attributes of this theme to a plot.
 *
 * @param plot  the plot ({@code null}).
 */
protected void applyToPlot(Plot plot) {
    Args.nullNotPermitted(plot, "plot");
    if (plot.getDrawingSupplier() != null) {
        plot.setDrawingSupplier(getDrawingSupplier());
    }
    if (plot.getBackgroundPaint() != null) {
        plot.setBackgroundPaint(this.plotBackgroundPaint);
    }
    plot.setOutlinePaint(this.plotOutlinePaint);

    // now handle specific plot types (and yes, I know this is some
    // really ugly code that has to be manually updated any time a new
    // plot type is added - I should have written something much cooler,
    // but I didn't and neither did anyone else).
    if (plot instanceof PiePlot) {
        applyToPiePlot((PiePlot) plot);
    }
    else if (plot instanceof MultiplePiePlot) {
        applyToMultiplePiePlot((MultiplePiePlot) plot);
    }
    else if (plot instanceof CategoryPlot) {
        applyToCategoryPlot((CategoryPlot) plot);
    }
    else if (plot instanceof XYPlot) {
        applyToXYPlot((XYPlot) plot);
    }
    else if (plot instanceof FastScatterPlot) {
        applyToFastScatterPlot((FastScatterPlot) plot);
    }
    else if (plot instanceof MeterPlot) {
        applyToMeterPlot((MeterPlot) plot);
    }
    else if (plot instanceof ThermometerPlot) {
        applyToThermometerPlot((ThermometerPlot) plot);
    }
    else if (plot instanceof SpiderWebPlot) {
        applyToSpiderWebPlot((SpiderWebPlot) plot);
    }
    else if (plot instanceof PolarPlot) {
        applyToPolarPlot((PolarPlot) plot);
    }
}
项目:aya-lang    文件:StandardChartTheme.java   
/**
 * Applies the attributes of this theme to a plot.
 *
 * @param plot  the plot (<code>null</code>).
 */
protected void applyToPlot(Plot plot) {
    ParamChecks.nullNotPermitted(plot, "plot");
    if (plot.getDrawingSupplier() != null) {
        plot.setDrawingSupplier(getDrawingSupplier());
    }
    if (plot.getBackgroundPaint() != null) {
        plot.setBackgroundPaint(this.plotBackgroundPaint);
    }
    plot.setOutlinePaint(this.plotOutlinePaint);

    // now handle specific plot types (and yes, I know this is some
    // really ugly code that has to be manually updated any time a new
    // plot type is added - I should have written something much cooler,
    // but I didn't and neither did anyone else).
    if (plot instanceof PiePlot) {
        applyToPiePlot((PiePlot) plot);
    }
    else if (plot instanceof MultiplePiePlot) {
        applyToMultiplePiePlot((MultiplePiePlot) plot);
    }
    else if (plot instanceof CategoryPlot) {
        applyToCategoryPlot((CategoryPlot) plot);
    }
    else if (plot instanceof XYPlot) {
        applyToXYPlot((XYPlot) plot);
    }
    else if (plot instanceof FastScatterPlot) {
        applyToFastScatterPlot((FastScatterPlot) plot);
    }
    else if (plot instanceof MeterPlot) {
        applyToMeterPlot((MeterPlot) plot);
    }
    else if (plot instanceof ThermometerPlot) {
        applyToThermometerPlot((ThermometerPlot) plot);
    }
    else if (plot instanceof SpiderWebPlot) {
        applyToSpiderWebPlot((SpiderWebPlot) plot);
    }
    else if (plot instanceof PolarPlot) {
        applyToPolarPlot((PolarPlot) plot);
    }
}
项目:metasfresh    文件:PerformanceIndicator.java   
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;
}
项目:HTML5_WebSite    文件:StandardChartTheme.java   
/**
 * Applies the attributes of this theme to a plot.
 *
 * @param plot  the plot (<code>null</code>).
 */
protected void applyToPlot(Plot plot) {
    if (plot == null) {
        throw new IllegalArgumentException("Null 'plot' argument.");
    }
    if (plot.getDrawingSupplier() != null) {
        plot.setDrawingSupplier(getDrawingSupplier());
    }
    if (plot.getBackgroundPaint() != null) {
        plot.setBackgroundPaint(this.plotBackgroundPaint);
    }
    plot.setOutlinePaint(this.plotOutlinePaint);

    // now handle specific plot types (and yes, I know this is some
    // really ugly code that has to be manually updated any time a new
    // plot type is added - I should have written something much cooler,
    // but I didn't and neither did anyone else).
    if (plot instanceof PiePlot) {
        applyToPiePlot((PiePlot) plot);
    }
    else if (plot instanceof MultiplePiePlot) {
        applyToMultiplePiePlot((MultiplePiePlot) plot);
    }
    else if (plot instanceof CategoryPlot) {
        applyToCategoryPlot((CategoryPlot) plot);
    }
    else if (plot instanceof XYPlot) {
        applyToXYPlot((XYPlot) plot);
    }
    else if (plot instanceof FastScatterPlot) {
        applyToFastScatterPlot((FastScatterPlot) plot);
    }
    else if (plot instanceof MeterPlot) {
        applyToMeterPlot((MeterPlot) plot);
    }
    else if (plot instanceof ThermometerPlot) {
        applyToThermometerPlot((ThermometerPlot) plot);
    }
    else if (plot instanceof SpiderWebPlot) {
        applyToSpiderWebPlot((SpiderWebPlot) plot);
    }
    else if (plot instanceof PolarPlot) {
        applyToPolarPlot((PolarPlot) plot);
    }
}
项目:populus    文件:StandardChartTheme.java   
/**
 * Applies the attributes of this theme to a plot.
 *
 * @param plot  the plot (<code>null</code>).
 */
protected void applyToPlot(Plot plot) {
    ParamChecks.nullNotPermitted(plot, "plot");
    if (plot.getDrawingSupplier() != null) {
        plot.setDrawingSupplier(getDrawingSupplier());
    }
    if (plot.getBackgroundPaint() != null) {
        plot.setBackgroundPaint(this.plotBackgroundPaint);
    }
    plot.setOutlinePaint(this.plotOutlinePaint);

    // now handle specific plot types (and yes, I know this is some
    // really ugly code that has to be manually updated any time a new
    // plot type is added - I should have written something much cooler,
    // but I didn't and neither did anyone else).
    if (plot instanceof PiePlot) {
        applyToPiePlot((PiePlot) plot);
    }
    else if (plot instanceof MultiplePiePlot) {
        applyToMultiplePiePlot((MultiplePiePlot) plot);
    }
    else if (plot instanceof CategoryPlot) {
        applyToCategoryPlot((CategoryPlot) plot);
    }
    else if (plot instanceof XYPlot) {
        applyToXYPlot((XYPlot) plot);
    }
    else if (plot instanceof FastScatterPlot) {
        applyToFastScatterPlot((FastScatterPlot) plot);
    }
    else if (plot instanceof MeterPlot) {
        applyToMeterPlot((MeterPlot) plot);
    }
    else if (plot instanceof ThermometerPlot) {
        applyToThermometerPlot((ThermometerPlot) plot);
    }
    else if (plot instanceof SpiderWebPlot) {
        applyToSpiderWebPlot((SpiderWebPlot) plot);
    }
    else if (plot instanceof PolarPlot) {
        applyToPolarPlot((PolarPlot) plot);
    }
}
项目:PI    文件:StandardChartTheme.java   
/**
 * Applies the attributes of this theme to a plot.
 *
 * @param plot  the plot (<code>null</code>).
 */
protected void applyToPlot(Plot plot) {
    if (plot == null) {
        throw new IllegalArgumentException("Null 'plot' argument.");
    }
    if (plot.getDrawingSupplier() != null) {
        plot.setDrawingSupplier(getDrawingSupplier());
    }
    if (plot.getBackgroundPaint() != null) {
        plot.setBackgroundPaint(this.plotBackgroundPaint);
    }
    plot.setOutlinePaint(this.plotOutlinePaint);

    // now handle specific plot types (and yes, I know this is some
    // really ugly code that has to be manually updated any time a new
    // plot type is added - I should have written something much cooler,
    // but I didn't and neither did anyone else).
    if (plot instanceof PiePlot) {
        applyToPiePlot((PiePlot) plot);
    }
    else if (plot instanceof MultiplePiePlot) {
        applyToMultiplePiePlot((MultiplePiePlot) plot);
    }
    else if (plot instanceof CategoryPlot) {
        applyToCategoryPlot((CategoryPlot) plot);
    }
    else if (plot instanceof XYPlot) {
        applyToXYPlot((XYPlot) plot);
    }
    else if (plot instanceof FastScatterPlot) {
        applyToFastScatterPlot((FastScatterPlot) plot);
    }
    else if (plot instanceof MeterPlot) {
        applyToMeterPlot((MeterPlot) plot);
    }
    else if (plot instanceof ThermometerPlot) {
        applyToThermometerPlot((ThermometerPlot) plot);
    }
    else if (plot instanceof SpiderWebPlot) {
        applyToSpiderWebPlot((SpiderWebPlot) plot);
    }
    else if (plot instanceof PolarPlot) {
        applyToPolarPlot((PolarPlot) plot);
    }
}