Java Code Examples for org.jfree.chart.plot.ThermometerPlot#setUnits()
The following examples show how to use
org.jfree.chart.plot.ThermometerPlot#setUnits() .
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 |
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: ThermometerChartExpression.java From pentaho-reporting with GNU Lesser General Public License v2.1 | 5 votes |
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 3
Source File: Thermometer.java From Knowage-Server with GNU Affero General Public License v3.0 | 4 votes |
/** * 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; }