org.jfree.chart.plot.ThermometerPlot Java Examples

The following examples show how to use org.jfree.chart.plot.ThermometerPlot. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: PanamaHitek_ThermometerChart.java    From PanamaHitek_Arduino with GNU Lesser General Public License v3.0 6 votes vote down vote up
public void buildPlot1() {
    setColorLimits();
    dataset = new DefaultValueDataset(30);
    ThermometerPlot thermometerplot = new ThermometerPlot(dataset);
    thermometerplot.setRange(plotBottonLimit, plotTopLimit);
    thermometerplot.setUnits(ThermometerPlot.UNITS_CELCIUS);
    thermometerplot.setSubrange(0, greenBottomLimit, greenTopLimit);
    thermometerplot.setSubrangePaint(0, Color.green);
    thermometerplot.setSubrange(1, yellowBottomLimit, yellowTopLimit);
    thermometerplot.setSubrangePaint(1, Color.yellow);
    thermometerplot.setSubrange(2, redBottomLimit, redTopLimit);
    thermometerplot.setSubrangePaint(2, Color.red);
    JFreeChart jfreechart = new JFreeChart(plotTitle, thermometerplot);
    ChartUtilities.applyCurrentTheme(jfreechart);
    add(new ChartPanel(jfreechart));
}
 
Example #2
Source File: StandardChartTheme.java    From ECG-Viewer with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Applies the attributes for this theme to a {@link ThermometerPlot}.
 * This method is called from the {@link #applyToPlot(Plot)} method.
 *
 * @param plot  the plot.
 */
protected void applyToThermometerPlot(ThermometerPlot plot) {
    plot.setValueFont(this.largeFont);
    plot.setThermometerPaint(this.thermometerPaint);
    ValueAxis axis = plot.getRangeAxis();
    if (axis != null) {
        applyToValueAxis(axis);
    }
}
 
Example #3
Source File: StandardChartTheme.java    From buffer_bci with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Applies the attributes for this theme to a {@link ThermometerPlot}.
 * This method is called from the {@link #applyToPlot(Plot)} method.
 *
 * @param plot  the plot.
 */
protected void applyToThermometerPlot(ThermometerPlot plot) {
    plot.setValueFont(this.largeFont);
    plot.setThermometerPaint(this.thermometerPaint);
    ValueAxis axis = plot.getRangeAxis();
    if (axis != null) {
        applyToValueAxis(axis);
    }
}
 
Example #4
Source File: StandardChartTheme.java    From buffer_bci with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Applies the attributes for this theme to a {@link ThermometerPlot}.
 * This method is called from the {@link #applyToPlot(Plot)} method.
 *
 * @param plot  the plot.
 */
protected void applyToThermometerPlot(ThermometerPlot plot) {
    plot.setValueFont(this.largeFont);
    plot.setThermometerPaint(this.thermometerPaint);
    ValueAxis axis = plot.getRangeAxis();
    if (axis != null) {
        applyToValueAxis(axis);
    }
}
 
Example #5
Source File: ThermometerChartExpression.java    From pentaho-reporting with GNU Lesser General Public License v2.1 5 votes vote down vote up
protected void configureChart( final JFreeChart chart ) {
  super.configureChart( chart );

  final Plot plot = chart.getPlot();
  final ThermometerPlot thermometerPlot = (ThermometerPlot) plot;

  if ( isShowBorder() == false || isChartSectionOutline() == false ) {
    chart.setBorderVisible( false );
    thermometerPlot.setOutlineVisible( false );
  }

  if ( getThermometerUnits() != null ) {
    thermometerPlot.setUnits( getThermometerUnits().getUnitConstant() );
  }
  thermometerPlot
    .setLowerBound( Math.min( getCriticalRangeLow(), Math.min( getNormalRangeLow(), getWarningRangeLow() ) ) );
  thermometerPlot
    .setUpperBound( Math.max( getCriticalRangeHigh(), Math.max( getNormalRangeHigh(), getWarningRangeHigh() ) ) );
  thermometerPlot.setBulbRadius( getBulbRadius() );
  thermometerPlot.setColumnRadius( getColumnRadius() );
  thermometerPlot.setSubrange( ThermometerPlot.CRITICAL, getCriticalRangeLow(), getCriticalRangeHigh() );
  thermometerPlot.setSubrange( ThermometerPlot.WARNING, getWarningRangeLow(), getWarningRangeHigh() );
  thermometerPlot.setSubrange( ThermometerPlot.NORMAL, getNormalRangeLow(), getNormalRangeHigh() );
  if ( getMercuryPaint() != null ) {
    thermometerPlot.setMercuryPaint( getMercuryPaint() );
  }
  if ( getThermometerPaint() != null ) {
    thermometerPlot.setThermometerPaint( getThermometerPaint() );
  }

  if ( getCriticalRangeColor() != null ) {
    thermometerPlot.setSubrangePaint( ThermometerPlot.CRITICAL, getCriticalRangeColor() );
  }
  if ( getWarningRangeColor() != null ) {
    thermometerPlot.setSubrangePaint( ThermometerPlot.WARNING, getWarningRangeColor() );
  }
  if ( getNormalRangeColor() != null ) {
    thermometerPlot.setSubrangePaint( ThermometerPlot.NORMAL, getNormalRangeColor() );
  }
}
 
Example #6
Source File: StandardChartTheme.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Applies the attributes for this theme to a {@link ThermometerPlot}.
 * This method is called from the {@link #applyToPlot(Plot)} method.
 *
 * @param plot  the plot.
 */
protected void applyToThermometerPlot(ThermometerPlot plot) {
    plot.setValueFont(this.largeFont);
    plot.setThermometerPaint(this.thermometerPaint);
    ValueAxis axis = plot.getRangeAxis();
    if (axis != null) {
        applyToValueAxis(axis);
    }
}
 
Example #7
Source File: StandardChartTheme.java    From SIMVA-SoS with Apache License 2.0 5 votes vote down vote up
/**
 * Applies the attributes for this theme to a {@link ThermometerPlot}.
 * This method is called from the {@link #applyToPlot(Plot)} method.
 *
 * @param plot  the plot.
 */
protected void applyToThermometerPlot(ThermometerPlot plot) {
    plot.setValueFont(this.largeFont);
    plot.setThermometerPaint(this.thermometerPaint);
    ValueAxis axis = plot.getRangeAxis();
    if (axis != null) {
        applyToValueAxis(axis);
    }
}
 
Example #8
Source File: StandardChartTheme.java    From ccu-historian with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Applies the attributes for this theme to a {@link ThermometerPlot}.
 * This method is called from the {@link #applyToPlot(Plot)} method.
 *
 * @param plot  the plot.
 */
protected void applyToThermometerPlot(ThermometerPlot plot) {
    plot.setValueFont(this.largeFont);
    plot.setThermometerPaint(this.thermometerPaint);
    ValueAxis axis = plot.getRangeAxis();
    if (axis != null) {
        applyToValueAxis(axis);
    }
}
 
Example #9
Source File: StandardChartTheme.java    From openstock with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Applies the attributes for this theme to a {@link ThermometerPlot}.
 * This method is called from the {@link #applyToPlot(Plot)} method.
 *
 * @param plot  the plot.
 */
protected void applyToThermometerPlot(ThermometerPlot plot) {
    plot.setValueFont(this.largeFont);
    plot.setThermometerPaint(this.thermometerPaint);
    ValueAxis axis = plot.getRangeAxis();
    if (axis != null) {
        applyToValueAxis(axis);
    }
}
 
Example #10
Source File: StandardChartTheme.java    From SIMVA-SoS with Apache License 2.0 4 votes vote down vote up
/**
 * 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);
    }
}
 
Example #11
Source File: StandardChartTheme.java    From ECG-Viewer with GNU General Public License v2.0 4 votes vote down vote up
/**
 * 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);
    }
}
 
Example #12
Source File: StandardChartTheme.java    From openstock with GNU General Public License v3.0 4 votes vote down vote up
/**
 * 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);
    }
}
 
Example #13
Source File: StandardChartTheme.java    From astor with GNU General Public License v2.0 4 votes vote down vote up
/**
 * 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);
    }
}
 
Example #14
Source File: StandardChartTheme.java    From ccu-historian with GNU General Public License v3.0 4 votes vote down vote up
/**
 * 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);
    }
}
 
Example #15
Source File: ThermometerChartExpression.java    From pentaho-reporting with GNU Lesser General Public License v2.1 4 votes vote down vote up
public static int getDefaultBulbRadius() {
  return ThermometerPlot.DEFAULT_BULB_RADIUS;
}
 
Example #16
Source File: ThermometerChartExpression.java    From pentaho-reporting with GNU Lesser General Public License v2.1 4 votes vote down vote up
public static int getDefaultColumnRadius() {
  return ThermometerPlot.DEFAULT_COLUMN_RADIUS;
}
 
Example #17
Source File: StandardChartTheme.java    From buffer_bci with GNU General Public License v3.0 4 votes vote down vote up
/**
 * 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);
    }
}
 
Example #18
Source File: Thermometer.java    From Knowage-Server with GNU Affero General Public License v3.0 4 votes vote down vote up
/**
 * Creates a chart of type thermometer.
 * 
 * @param chartTitle  the chart title.
 * @param dataset  the dataset.
 * 
 * @return A chart thermometer.
 */


public JFreeChart createChart(DatasetMap datasets) {
	logger.debug("IN");
	Dataset dataset=(Dataset)datasets.getDatasets().get("1");

	ThermometerPlot plot = new ThermometerPlot((ValueDataset)dataset);
	JFreeChart chart = new JFreeChart(name, JFreeChart.DEFAULT_TITLE_FONT,	plot, true);               
	chart.setBackgroundPaint(color);

	TextTitle title = setStyleTitle(name, styleTitle);
	chart.setTitle(title);
	if(subName!= null && !subName.equals("")){
		TextTitle subTitle =setStyleTitle(subName, styleSubTitle);
		chart.addSubtitle(subTitle);
	}

	
	plot.setInsets(new RectangleInsets(5.0, 5.0, 5.0, 5.0));
	plot.setPadding(new RectangleInsets(10.0, 10.0, 10.0, 10.0));
	plot.setThermometerStroke(new BasicStroke(2.0f));
	plot.setThermometerPaint(Color.lightGray);
	plot.setGap(3);
	plot.setValueLocation(3);
	plot.setValuePaint(labelsValueStyle.getColor());
	plot.setValueFont(new Font(labelsValueStyle.getFontName(), Font.PLAIN, labelsValueStyle.getSize()));

	plot.setRange(lower, upper);


	if(units.equalsIgnoreCase(FAHRENHEIT))plot.setUnits(ThermometerPlot.UNITS_FAHRENHEIT);	
	else if(units.equalsIgnoreCase(CELCIUS)) plot.setUnits(ThermometerPlot.UNITS_CELCIUS);	
	else if(units.equalsIgnoreCase(KELVIN)) plot.setUnits(ThermometerPlot.UNITS_KELVIN);	
	else plot.setUnits(ThermometerPlot.UNITS_NONE);


	// set subranges	
	for (Iterator iterator = intervals.iterator(); iterator.hasNext();){
		KpiInterval subrange = (KpiInterval) iterator.next();
		int range=0;
		if(subrange.getLabel().equalsIgnoreCase(NORMAL))range=(ThermometerPlot.NORMAL);
		else if(subrange.getLabel().equalsIgnoreCase(WARNING))range=(ThermometerPlot.WARNING);
		else if(subrange.getLabel().equalsIgnoreCase(CRITICAL))range=(ThermometerPlot.CRITICAL);

		plot.setSubrange(range, subrange.getMin(), subrange.getMax());
		if(subrange.getColor()!=null){
			plot.setSubrangePaint(range, subrange.getColor());
		}
		//plot.setDisplayRange(subrange.getRange(), subrange.getLower(), subrange.getUpper());	
	}
	//plot.setFollowDataInSubranges(true);
	logger.debug("OUT");

	return chart;       
}
 
Example #19
Source File: StandardChartTheme.java    From buffer_bci with GNU General Public License v3.0 4 votes vote down vote up
/**
 * 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);
    }
}