/** * 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); }
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 * 10d; double end = start + 10d; 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; }
MeterPlot chartPlot = new MeterPlot((ValueDataset)getDataset()); chartPlot.setDialShape(DialShape.CHORD); break; case JRMeterPlot.SHAPE_CIRCLE : chartPlot.setDialShape(DialShape.CIRCLE); break; case JRMeterPlot.SHAPE_PIE : default : chartPlot.setDialShape(DialShape.PIE); chartPlot.setRange(convertRange(jrPlot.getDataRange())); chartPlot.setMeterAngle(meterAngle); chartPlot.setUnits(units); chartPlot.setTickLabelFont(JRFontUtil.getAwtFont(jrPlot.getTickLabelFont(), getLocale())); chartPlot.setTickSize(tickInterval); chartPlot.setDialBackgroundPaint(color); chartPlot.setNeedlePaint(color); chartPlot.setValuePaint(display.getColor()); chartPlot.setTickLabelFormat(new DecimalFormat(display.getMask()));
MeterPlot meter = new MeterPlot( widget ); meter.setUnits( units ); meter.setValuePaint( widget.getValuePaint() ); meter.setTickPaint( widget.getTickPaint() ); int tickSize = widget.getTickSize(); if ( tickSize == 0 ) { meter.setTickLabelsVisible( false ); } else { meter.setTickLabelsVisible( true ); meter.setTickSize( tickSize ); meter.setValueFont( widget.getValueFont() ); } else { meter.setValuePaint( JFreeChartEngine.getTransparent() );
while ( intervalIterator.hasNext() ) { MeterInterval interval = (MeterInterval) intervalIterator.next(); meter.addInterval( interval ); meter.setNeedlePaint( widget.getNeedlePaint() ); meter.setDialShape( widget.getDialShape() ); meter.setDialBackgroundPaint( widget.getPlotBackgroundPaint() ); meter.setRange( new Range( widget.getMinimum(), widget.getMaximum() ) );
/** * 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); }