Java Code Examples for org.jfree.chart.plot.ThermometerPlot#setThermometerPaint()

The following examples show how to use org.jfree.chart.plot.ThermometerPlot#setThermometerPaint() . 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: 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 2
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 3
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 4
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 5
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 6
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 7
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 8
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 9
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;       
}