List of usage examples for org.jfree.chart.plot ThermometerPlot setBulbRadius
public void setBulbRadius(int r)
From source file:org.cyberoam.iview.charts.Thermometer.java
/** * This method generates JFreeChart instance for Thermometer chart with iView customization. * @param reportID/*from w w w . ja v a 2 s . c o m*/ * @param rsw * @param request * @return */ public static JFreeChart getChart(int reportID, ResultSetWrapper rsw, HttpServletRequest request) { ReportBean reportBean = ReportBean.getRecordbyPrimarykey(reportID); JFreeChart chart = null; ReportColumnBean reportColumnBean = null; GraphBean graphBean = null; try { DefaultValueDataset dataset = null; graphBean = GraphBean.getRecordbyPrimarykey(reportBean.getGraphId()); reportColumnBean = ReportColumnBean.getRecordByPrimaryKey(reportBean.getReportId(), graphBean.getYColumnId()); String yColumnDBname = reportColumnBean.getDbColumnName(); rsw.first(); double used = Double.parseDouble(rsw.getString(yColumnDBname)); rsw.next(); double free = Double.parseDouble(rsw.getString(yColumnDBname)); dataset = new DefaultValueDataset((100 * used) / (used + free)); ThermometerPlot plot = new ThermometerPlot(dataset); chart = new JFreeChart("", // chart title JFreeChart.DEFAULT_TITLE_FONT, plot, // plot false); // include legend chart.setBackgroundPaint(Color.white); plot.setThermometerStroke(new BasicStroke(2.0f)); plot.setThermometerPaint(Color.DARK_GRAY); plot.setBulbRadius(30); plot.setColumnRadius(15); plot.setUnits(ThermometerPlot.UNITS_NONE); plot.setMercuryPaint(Color.WHITE); plot.setValueFont(new Font("Vandara", Font.CENTER_BASELINE, 12)); plot.setBackgroundPaint(Color.white); plot.setBackgroundAlpha(0.0f); plot.setOutlineVisible(false); plot.setSubrangeInfo(0, 0, 50); plot.setSubrangeInfo(1, 50, 85); plot.setSubrangeInfo(2, 85, 100); plot.setSubrangePaint(0, new Color(75, 200, 85)); plot.setSubrangePaint(1, new Color(254, 211, 41)); plot.setSubrangePaint(2, new Color(255, 85, 85)); } catch (Exception e) { CyberoamLogger.appLog.debug("Thermometer=>getChart.exception : " + e, e); } return chart; }
From source file:org.sonar.plugins.ral.GaugeChart.java
@Override protected Plot getPlot(ChartParameters params) { ThermometerPlot plot = new ThermometerPlot(createDataset(params)); plot.setGap(1);//w w w. jav a 2 s .c o m plot.setRange(0, 1); plot.setSubrange(0, 0, 1); plot.setSubrangePaint(0, Color.decode("#ffffff")); plot.setSubrangePaint(1, Color.decode("#ffffff")); plot.setSubrangePaint(2, Color.decode("#ffffff")); plot.setMercuryPaint(Color.decode("#dddddd")); plot.setThermometerPaint(Color.decode("#aaaaaa")); plot.setValuePaint(Color.decode("#333333")); plot.setUseSubrangePaint(false); plot.setUnits(ThermometerPlot.UNITS_NONE); plot.setBulbRadius(15); plot.setColumnRadius(6); NumberAxis axis = new NumberAxis(); axis.setNumberFormatOverride(NumberFormat.getPercentInstance()); plot.setRangeAxis(axis); plot.setValueLocation(ThermometerPlot.NONE); return plot; }
From source file:org.pentaho.plugin.jfreereport.reportcharts.ThermometerChartExpression.java
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);/*from ww w .j a va 2 s . c om*/ 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()); } }
From source file:biz.ixnay.pivot.charts.skin.jfree.ThermometerViewSkin.java
@Override protected JFreeChart createChart() { ValueDataset value = getDataset();/*from w ww .j a va2s .c om*/ ThermometerPlot plot = new ThermometerPlot(value); // TODO: set style values before creating the chart object SingleValueChartView chartView = (SingleValueChartView) getComponent(); SingleValueChartView.ValueRange bounds = chartView.getValueBounds(); plot.setRange(bounds.getLower(), bounds.getUpper()); for (SingleValueChartView.Range range : SingleValueChartView.Range.values()) { SingleValueChartView.ValueRange rangeBounds = chartView.getValueRange(range); if (rangeBounds != null) { double lower = rangeBounds.getLower(); double upper = rangeBounds.getUpper(); switch (range) { case NORMAL: plot.setSubrange(ThermometerPlot.NORMAL, lower, upper); break; case WARNING: plot.setSubrange(ThermometerPlot.WARNING, lower, upper); break; case CRITICAL: plot.setSubrange(ThermometerPlot.CRITICAL, lower, upper); break; } } } if (units != null) { switch (units) { case NONE: plot.setUnits(ThermometerPlot.UNITS_NONE); break; case CELSIUS: plot.setUnits(ThermometerPlot.UNITS_CELCIUS); break; case FAHRENHEIT: plot.setUnits(ThermometerPlot.UNITS_FAHRENHEIT); break; case KELVIN: plot.setUnits(ThermometerPlot.UNITS_KELVIN); break; } } if (bulbRadius > 0) { plot.setBulbRadius(bulbRadius); } return createChart(plot); }
From source file:hpssim.grafica.HPSsim.java
private void setMeter() { datasetCPU = new DefaultValueDataset(0D); JFreeChart jfreechartCPU = createChart(datasetCPU, "CPU Usage"); datasetGPU = new DefaultValueDataset(0D); JFreeChart jfreechartGPU = createChart(datasetGPU, "GPU Usage"); panelCPU.add("Center", new ChartPanel(jfreechartCPU)); panelCPU.add("South", new Label("")); panelGPU.add("Center", new ChartPanel(jfreechartGPU)); panelGPU.add("South", new Label("")); datasetQueueCPU = new DefaultValueDataset(0D); datasetQueueGPU = new DefaultValueDataset(0D); ThermometerPlot gpuThermometerQueue = new ThermometerPlot(datasetQueueGPU); gpuThermometerQueue.setRange(0, 50); gpuThermometerQueue.setSubrange(ThermometerPlot.NORMAL, 0.0, 10.0); gpuThermometerQueue.setSubrange(ThermometerPlot.WARNING, 10.0, 25.0); gpuThermometerQueue.setSubrange(ThermometerPlot.CRITICAL, 25.0, 5000.0); gpuThermometerQueue.setUnits(ThermometerPlot.UNITS_NONE); gpuThermometerQueue.setBulbRadius(22); gpuThermometerQueue.setColumnRadius(20); ThermometerPlot cpuThermometerQueue = new ThermometerPlot(datasetQueueCPU); cpuThermometerQueue.setRange(0, 50); cpuThermometerQueue.setSubrange(ThermometerPlot.NORMAL, 0.0, 10.0); cpuThermometerQueue.setSubrange(ThermometerPlot.WARNING, 10.0, 25.0); cpuThermometerQueue.setSubrange(ThermometerPlot.CRITICAL, 25.0, 5000.0); cpuThermometerQueue.setUnits(ThermometerPlot.UNITS_NONE); cpuThermometerQueue.setBulbRadius(22); cpuThermometerQueue.setColumnRadius(20); panelCPUQueue.add("Center", new ChartPanel( new JFreeChart("CPU Queue", JFreeChart.DEFAULT_TITLE_FONT, cpuThermometerQueue, false))); panelCPUQueue.add("South", new Label("")); panelGPUQueue.add("Center", new ChartPanel( new JFreeChart("GPU Queue", JFreeChart.DEFAULT_TITLE_FONT, gpuThermometerQueue, false))); panelGPUQueue.add("South", new Label("")); }