List of usage examples for org.jfree.chart.fx ChartViewer setMinHeight
public final void setMinHeight(double value)
From source file:com.bdb.weather.display.current.Thermometer.java
private ChartViewer createChartElements() { thermometerPlot/*from ww w . j a va 2 s.c o m*/ .setMercuryPaint(new GradientPaint(0.0f, 0.0f, Color.RED.darker(), 5.0f, 5.0f, Color.RED, true)); thermometerPlot.setUseSubrangePaint(false); thermometerPlot.setBulbRadius(15); thermometerPlot.setColumnRadius(10); thermometerPlot.setValueLocation(ThermometerPlot.RIGHT); thermometerPlot.setValuePaint(Color.BLACK); thermometerPlot.setSubrange(0, 80.0, 80.0); thermometerPlot.setSubrangePaint(0, Color.BLUE); thermometerPlot.setSubrangePaint(1, Color.RED); thermometerPlot.setSubrange(1, 1000.0, 1000.0); thermometerPlot.setSubrange(2, 1000.0, 1000.0); thermometerPlot.setBackgroundPaint(Color.GRAY); thermometerPlot.setOutlineVisible(false); thermometerPlot.setValueFont(thermometerPlot.getValueFont().deriveFont(14.0F).deriveFont(Font.PLAIN)); chart = new JFreeChart(thermometerPlot); chart.setTitle(titleProperty.getValue()); chart.setBackgroundPaint(Color.GRAY); ChartViewer chartViewer = new ChartViewer(chart); chartViewer.setMinHeight(75); chartViewer.setMinWidth(25); return chartViewer; }
From source file:com.bdb.weather.display.current.Barometer.java
private ChartViewer createChartElements(Pressure min, Pressure max) { Color backgroundDialColor = StageUtilities .toAwtColor(colorPrefs.getColorPref(ColorPreferences.GUAGE_DIAL_COLOR)); Paint backgroundPaint = new GradientPaint(0.0f, 0.0f, Color.LIGHT_GRAY, 100.0f, 0.0f, backgroundDialColor); DialBackground background = new DialBackground(backgroundPaint); plot.addLayer(background);// www . j a v a2s .c o m double dialTickIncrements = .2; switch (Pressure.getDefaultUnit()) { case IN_HG: dialTickIncrements = .2; break; case HECTO_PASCAL: case MILLIBAR: dialTickIncrements = 10.0; break; } scale = new StandardDialScale(min.get(), max.get(), 240.0, -300.0, dialTickIncrements, 10); scale.setTickLabelFont(scale.getTickLabelFont().deriveFont(14.0F).deriveFont(Font.PLAIN)); scale.setTickRadius(.9); scale.setTickLabelFormatter(Pressure.getDefaultFormatter()); scale.setTickLabelOffset(.25); scale.setTickLabelPaint( StageUtilities.toAwtColor(colorPrefs.getColorPref(ColorPreferences.GUAGE_SCALE_TEXT))); scale.setMajorTickPaint( StageUtilities.toAwtColor(colorPrefs.getColorPref(ColorPreferences.GUAGE_SCALE_TICK))); scale.setMinorTickPaint( StageUtilities.toAwtColor(colorPrefs.getColorPref(ColorPreferences.GUAGE_SCALE_TICK))); plot.addScale(0, scale); plot.setDialFrame(new StandardDialFrame()); DialValueIndicator valueInd = new DialValueIndicator(0); // // Set background and outline paint to be completely transparent so they do not show at all // valueInd.setBackgroundPaint(new Color(255, 255, 255, 0)); valueInd.setOutlinePaint(new Color(255, 255, 255, 0)); valueInd.setPaint(StageUtilities.toAwtColor(colorPrefs.getColorPref(ColorPreferences.GUAGE_VALUE))); valueInd.setNumberFormat(Pressure.getDefaultUnit().getFormatterWithUnit()); plot.addLayer(valueInd); double angle = valueInd.getAngle(); double radius = valueInd.getRadius(); trendAnnotation.setPaint(StageUtilities.toAwtColor(colorPrefs.getColorPref(ColorPreferences.GUAGE_VALUE))); trendAnnotation.setAngle(angle); trendAnnotation.setRadius(radius + .1); plot.addLayer(trendAnnotation); DialPointer.Pointer pointer = new DialPointer.Pointer(0); plot.addPointer(pointer); DialCap cap = new DialCap(); cap.setRadius(cap.getRadius() * 1.5); plot.setCap(cap); range = new StandardDialRange(0.0, 360.0, StageUtilities.toAwtColor(colorPrefs.getColorPref(ColorPreferences.GUAGE_VALUE_RANGE))); range.setInnerRadius(.40); range.setOuterRadius(.45); range.setScaleIndex(0); plot.addLayer(range); JFreeChart chart = new JFreeChart(plot); chart.setBackgroundPaint( StageUtilities.toAwtColor(colorPrefs.getColorPref(ColorPreferences.GUAGE_BACKGROUND))); ChartViewer chartViewer = new ChartViewer(chart); chartViewer.setMinHeight(200); chartViewer.setMinWidth(200); chartViewer.setMaxHeight(10000); chartViewer.setMaxWidth(10000); //chartViewer.setBorder(new BevelBorder(BevelBorder.RAISED)); return chartViewer; }