List of usage examples for org.jfree.chart.axis Axis setLabelPaint
public void setLabelPaint(Paint paint)
From source file:ch.zhaw.parallelComputing.view.Plotter.java
/** * Generates a plot for comparing to datasets * @param title the name of the plot//from ww w .j av a 2s . co m * @param dataset1 the first data set for plotting * @param dataset2 the second data set for plotting * @return a chart object for displaying or saving as picture */ public static JFreeChart plot(String title, XYDataset dataset1, XYDataset dataset2) { JFreeChart chart = ChartFactory.createTimeSeriesChart(title, // title "Date", // x-axis label "Input Value", // y-axis label dataset1, // data true, // create legend? true, // generate tooltips? false // generate URLs? ); XYPlot plot = chart.getXYPlot(); Axis axis1 = plot.getRangeAxis(0); axis1.setLabelPaint(Color.red); NumberAxis axis2 = new NumberAxis("Twitter"); axis2.setLabelPaint(Color.blue); plot.setRangeAxis(1, axis2); plot.setDataset(1, dataset2); plot.mapDatasetToRangeAxis(1, 1); XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer(); renderer.setSeriesPaint(0, Color.blue); renderer.setBaseShapesVisible(false); plot.setRenderer(1, renderer); return chart; }
From source file:com.rapidminer.gui.new_plotter.engine.jfreechart.ChartAxisFactory.java
public static void formatAxis(PlotConfiguration plotConfiguration, Axis axis) { Color axisColor = plotConfiguration.getAxisLineColor(); if (axis != null) { axis.setAxisLinePaint(axisColor); axis.setAxisLineStroke(new BasicStroke(plotConfiguration.getAxisLineWidth())); axis.setLabelPaint(axisColor); axis.setTickLabelPaint(axisColor); }/*w w w. jav a 2s . co m*/ }
From source file:org.jreserve.dummy.plot.charts.AbstractChart.java
protected void formatAxisColors(Axis axis) { Color color = format.getForeColor(); axis.setAxisLinePaint(color);/*from w w w . j a va 2s .c om*/ axis.setTickMarkPaint(color); axis.setTickLabelPaint(color); axis.setLabelPaint(color); }
From source file:org.openfaces.component.chart.impl.helpers.AxisUtil.java
public static void setupAxisPresentation(String label, Axis axis, FakeAxisStyle axisStyle) { StyleObjectModel model = axisStyle.getStyleObjectModel(); StyleBorderModel border = model.getBorder(); if (border != null) { if (border.getColor() != null) { axis.setAxisLinePaint(border.getColor()); }/*from w w w . j a va 2s .c o m*/ if (!border.isNone()) { axis.setAxisLineVisible(true); axis.setAxisLineStroke(PropertiesConverter.toStroke(border)); axis.setTickMarkPaint(border.getColor()); axis.setTickMarksVisible(true); if (!axis.isTickMarksVisible()) axis.setTickMarksVisible(false); } if (border.getStyle().equalsIgnoreCase("none")) { axis.setAxisLineVisible(false); axis.setTickMarksVisible(false); if (axis.isTickMarksVisible()) axis.setTickMarksVisible(true); } } axis.setTickLabelsVisible(axisStyle.isTickLabelsVisible()); if (axisStyle.isLabelVisible() && label != null) { axis.setLabel(label); axis.setLabelPaint(model.getColor()); axis.setLabelFont(CSSUtil.getFont(model)); } if (axisStyle.isTickLabelsVisible()) { axis.setTickLabelsVisible(true); axis.setTickLabelPaint(model.getColor()); axis.setTickLabelFont(CSSUtil.getFont(model)); } else { axis.setTickLabelsVisible(false); } Double tickInterval = axisStyle.getTickInterval(); if (tickInterval != null && tickInterval != 0 && axis instanceof NumberAxis) { NumberAxis numberAxis = (NumberAxis) axis; if (tickInterval > 0) { NumberTickUnit tickUnit = new NumberTickUnit(tickInterval); numberAxis.setTickUnit(tickUnit); } else if (tickInterval == -1) { TickUnitSource tickUnits = NumberAxis.createIntegerTickUnits(); numberAxis.setStandardTickUnits(tickUnits); } else { throw new FacesException("tickInterval must be a positive number for a fixed tick interval, " + "or -1 for automatic integer tick selection: " + tickInterval); } numberAxis.setMinorTickMarksVisible(true); numberAxis.setMinorTickCount(2); numberAxis.setMinorTickMarkOutsideLength(3); numberAxis.setMinorTickMarkInsideLength(3); numberAxis.setTickMarkInsideLength(5); numberAxis.setTickMarkOutsideLength(5); } axis.setTickMarkInsideLength(axisStyle.getTickInsideLength()); axis.setTickMarkOutsideLength(axisStyle.getTickOutsideLength()); if (axisStyle.getMinorTicksVisible()) { axis.setMinorTickMarksVisible(true); if (axis instanceof ValueAxis) ((ValueAxis) axis).setMinorTickCount(axisStyle.getMinorTickCount() + 1); axis.setMinorTickMarkInsideLength(axisStyle.getMinorTickInsideLength()); axis.setMinorTickMarkOutsideLength(axisStyle.getMinorTickOutsideLength()); } else { axis.setMinorTickMarksVisible(false); } }
From source file:com.rcp.wbw.demo.editor.SWTAxisEditor.java
/** * Sets the properties of the specified axis to match * the properties defined on this panel. * /*from w w w .j av a 2s . com*/ * @param axis * the axis. */ public void setAxisProperties(Axis axis) { axis.setLabel(getLabel()); axis.setLabelFont(getLabelFont()); axis.setLabelPaint(getLabelPaint()); axis.setTickMarksVisible(this.showTickMarksCheckBox.getSelection()); axis.setTickLabelsVisible(this.showTickLabelsCheckBox.getSelection()); axis.setTickLabelFont(getTickLabelFont()); axis.setTickLabelPaint(getTickLabelPaint()); }
From source file:daylightchart.options.chart.AxisOptions.java
/** * Sets the properties of the specified axis to match the properties * defined on this panel./*from w ww. j a v a2 s.c om*/ * * @param axis * the axis. */ void setAxisProperties(final Axis axis) { axis.setLabel(label); if (labelFont != null) { axis.setLabelFont(labelFont); } if (labelPaint != null) { axis.setLabelPaint(labelPaint); } if (labelInsets != null) { axis.setLabelInsets(labelInsets); } // axis.setTickMarksVisible(tickMarksVisible); axis.setTickLabelsVisible(tickLabelsVisible); if (tickLabelFont != null) { axis.setTickLabelFont(tickLabelFont); } if (tickLabelPaint != null) { axis.setTickLabelPaint(tickLabelPaint); } if (tickLabelInsets != null) { axis.setTickLabelInsets(tickLabelInsets); } }
From source file:ch.zhaw.simulation.diagram.charteditor.DefaultAxisEditor.java
/** * Sets the properties of the specified axis to match the properties defined * on this panel./* w ww . j a v a 2 s.co m*/ * * @param axis * the axis. */ public void setAxisProperties(Axis axis) { axis.setLabel(getLabel()); axis.setLabelFont(getLabelFont()); axis.setLabelPaint(getLabelPaint()); axis.setTickMarksVisible(isTickMarksVisible()); axis.setTickLabelsVisible(isTickLabelsVisible()); axis.setTickLabelFont(getTickLabelFont()); axis.setTickLabelPaint(getTickLabelPaint()); axis.setTickLabelInsets(getTickLabelInsets()); axis.setLabelInsets(getLabelInsets()); }
From source file:com.bdaum.zoom.report.internal.wizards.ReportComponent.java
private static void applyAxisProperties(Axis axis, String prefix, Map<String, Object> properties) { axis.setLabel((String) properties.get(prefix + AXISLABEL)); Font font = (Font) properties.get(prefix + AXISLABELFONT); if (font != null) axis.setLabelFont(font);/*from w ww .java 2 s.c o m*/ Paint paint = (Paint) properties.get(prefix + AXISLABELPAINT); if (paint != null) axis.setLabelPaint(paint); Boolean visible = (Boolean) properties.get(prefix + TICKMARKSVISIBLE); if (visible != null) axis.setTickMarksVisible(visible); visible = (Boolean) properties.get(prefix + TICKLABELSVISIBLE); if (visible != null) axis.setTickLabelsVisible(visible); font = (Font) properties.get(prefix + TICKLABELFONT); if (font != null) axis.setTickLabelFont(font); paint = (Paint) properties.get(prefix + TICKLABELPAINT); if (paint != null) axis.setTickLabelPaint(paint); }
From source file:com.xpn.xwiki.plugin.charts.ChartCustomizer.java
public static void customizeAxis(Axis axis, ChartParams params, String prefix) { if (params.get(prefix + ChartParams.AXIS_VISIBLE_SUFIX) != null && params.getBoolean(prefix + ChartParams.AXIS_VISIBLE_SUFIX).booleanValue() == false) { axis.setVisible(false);/*from w w w.ja va 2s. c o m*/ } else { if (params.get(prefix + ChartParams.AXIS_LINE_VISIBLE_SUFFIX) != null) { if (params.getBoolean(prefix + ChartParams.AXIS_LINE_VISIBLE_SUFFIX).booleanValue()) { axis.setAxisLineVisible(true); if (params.get(prefix + ChartParams.AXIS_LINE_COLOR_SUFFIX) != null) { axis.setAxisLinePaint(params.getColor(prefix + ChartParams.AXIS_LINE_COLOR_SUFFIX)); } if (params.get(prefix + ChartParams.AXIS_LINE_STROKE_SUFFIX) != null) { axis.setAxisLineStroke(params.getStroke(prefix + ChartParams.AXIS_LINE_STROKE_SUFFIX)); } } else { axis.setAxisLineVisible(false); } } if (params.get(prefix + ChartParams.AXIS_LABEL_SUFFIX) != null) { axis.setLabel(params.getString(prefix + ChartParams.AXIS_LABEL_SUFFIX)); if (params.get(prefix + ChartParams.AXIS_LABEL_FONT_SUFFIX) != null) { axis.setLabelFont(params.getFont(prefix + ChartParams.AXIS_LABEL_FONT_SUFFIX)); } if (params.get(prefix + ChartParams.AXIS_LABEL_COLOR_SUFFIX) != null) { axis.setLabelPaint(params.getColor(prefix + ChartParams.AXIS_LABEL_COLOR_SUFFIX)); } if (params.get(prefix + ChartParams.AXIS_LABEL_INSERTS_SUFFIX) != null) { axis.setLabelInsets(params.getRectangleInsets(prefix + ChartParams.AXIS_LABEL_INSERTS_SUFFIX)); } } if (params.get(prefix + ChartParams.AXIS_TICK_LABEL_VISIBLE_SUFFIX) != null) { if (params.getBoolean(prefix + ChartParams.AXIS_TICK_LABEL_VISIBLE_SUFFIX).booleanValue()) { axis.setTickLabelsVisible(true); if (params.get(prefix + ChartParams.AXIS_TICK_LABEL_FONT_SUFFIX) != null) { axis.setTickLabelFont(params.getFont(prefix + ChartParams.AXIS_TICK_LABEL_FONT_SUFFIX)); } if (params.get(prefix + ChartParams.AXIS_TICK_LABEL_COLOR_SUFFIX) != null) { axis.setTickLabelPaint(params.getColor(prefix + ChartParams.AXIS_TICK_LABEL_COLOR_SUFFIX)); } if (params.get(prefix + ChartParams.AXIS_TICK_LABEL_INSERTS_SUFFIX) != null) { axis.setTickLabelInsets( params.getRectangleInsets(prefix + ChartParams.AXIS_TICK_LABEL_INSERTS_SUFFIX)); } } else { axis.setTickLabelsVisible(false); } } if (params.get(prefix + ChartParams.AXIS_TICK_MARK_VISIBLE_SUFFIX) != null) { if (params.getBoolean(prefix + ChartParams.AXIS_TICK_MARK_VISIBLE_SUFFIX).booleanValue()) { axis.setTickMarksVisible(true); if (params.get(prefix + ChartParams.AXIS_TICK_MARK_INSIDE_LENGTH_SUFFIX) != null) { axis.setTickMarkInsideLength(params .getFloat(prefix + ChartParams.AXIS_TICK_MARK_INSIDE_LENGTH_SUFFIX).floatValue()); } if (params.get(prefix + ChartParams.AXIS_TICK_MARK_OUTSIDE_LENGTH_SUFFIX) != null) { axis.setTickMarkOutsideLength(params .getFloat(prefix + ChartParams.AXIS_TICK_MARK_OUTSIDE_LENGTH_SUFFIX).floatValue()); } if (params.get(prefix + ChartParams.AXIS_TICK_MARK_COLOR_SUFFIX) != null) { axis.setTickMarkPaint(params.getColor(prefix + ChartParams.AXIS_TICK_MARK_COLOR_SUFFIX)); } if (params.get(prefix + ChartParams.AXIS_TICK_MARK_COLOR_SUFFIX) != null) { axis.setTickMarkStroke(params.getStroke(prefix + ChartParams.AXIS_TICK_MARK_STROKE_SUFFIX)); } } else { axis.setTickMarksVisible(false); } } } }
From source file:lucee.runtime.tag.Chart.java
private void setAxis(Axis axis, Font font) { if (axis != null) { axis.setLabelFont(font);/*from w w w .j a v a 2 s . c om*/ axis.setLabelPaint(foregroundcolor); axis.setTickLabelFont(font); axis.setTickLabelPaint(foregroundcolor); axis.setTickLabelsVisible(true); } }