Java Code Examples for org.jfree.chart.axis.ValueAxis#setLabelFont()
The following examples show how to use
org.jfree.chart.axis.ValueAxis#setLabelFont() .
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 | 6 votes |
/** * Applies the attributes for this theme to a {@link ValueAxis}. * * @param axis the axis (<code>null</code> not permitted). */ protected void applyToValueAxis(ValueAxis axis) { axis.setLabelFont(this.largeFont); axis.setLabelPaint(this.axisLabelPaint); axis.setTickLabelFont(this.regularFont); axis.setTickLabelPaint(this.tickLabelPaint); if (axis instanceof SymbolAxis) { applyToSymbolAxis((SymbolAxis) axis); } if (axis instanceof PeriodAxis) { applyToPeriodAxis((PeriodAxis) axis); } }
Example 2
Source File: ParallelPlotter2.java From rapidminer-studio with GNU Affero General Public License v3.0 | 6 votes |
private static JFreeChart createChart(XYDataset dataset) { // create the chart... JFreeChart chart = ChartFactory.createXYLineChart(null, // chart title null, // x axis label null, // y axis label dataset, // data PlotOrientation.VERTICAL, false, // include legend true, // tooltips false // urls ); chart.setBackgroundPaint(Color.white); // get a reference to the plot for further customization... XYPlot plot = (XYPlot) chart.getPlot(); plot.setBackgroundPaint(Color.WHITE); ValueAxis valueAxis = plot.getRangeAxis(); valueAxis.setLabelFont(LABEL_FONT_BOLD); valueAxis.setTickLabelFont(LABEL_FONT); return chart; }
Example 3
Source File: StatisticChartStyling.java From snap-desktop with GNU General Public License v3.0 | 6 votes |
static ValueAxis updateScalingOfAxis(boolean logScaled, ValueAxis oldAxis, final boolean autoRangeIncludesZero) { ValueAxis newAxis = oldAxis; if (logScaled) { if (!(oldAxis instanceof CustomLogarithmicAxis)) { final CustomLogarithmicAxis logarithmicAxis = createLogarithmicAxis(oldAxis.getLabel()); logarithmicAxis.setAutoRange(oldAxis.isAutoRange()); newAxis = logarithmicAxis; } } else { if (oldAxis instanceof CustomLogarithmicAxis) { final NumberAxis numberAxis = createNumberAxis(oldAxis.getLabel(), autoRangeIncludesZero); numberAxis.setAutoRange(oldAxis.isAutoRange()); newAxis = numberAxis; } } newAxis.setLabelFont(oldAxis.getLabelFont()); newAxis.setLabelPaint(oldAxis.getLabelPaint()); newAxis.setTickLabelFont(oldAxis.getTickLabelFont()); newAxis.setTickLabelPaint(oldAxis.getTickLabelPaint()); return newAxis; }
Example 4
Source File: StandardChartTheme.java From ccu-historian with GNU General Public License v3.0 | 5 votes |
/** * Applies the attributes for this theme to a {@link ValueAxis}. * * @param axis the axis (<code>null</code> not permitted). */ protected void applyToValueAxis(ValueAxis axis) { axis.setLabelFont(this.largeFont); axis.setLabelPaint(this.axisLabelPaint); axis.setTickLabelFont(this.regularFont); axis.setTickLabelPaint(this.tickLabelPaint); if (axis instanceof SymbolAxis) { applyToSymbolAxis((SymbolAxis) axis); } if (axis instanceof PeriodAxis) { applyToPeriodAxis((PeriodAxis) axis); } }
Example 5
Source File: StandardChartTheme.java From SIMVA-SoS with Apache License 2.0 | 5 votes |
/** * Applies the attributes for this theme to a {@link ValueAxis}. * * @param axis the axis (<code>null</code> not permitted). */ protected void applyToValueAxis(ValueAxis axis) { axis.setLabelFont(this.largeFont); axis.setLabelPaint(this.axisLabelPaint); axis.setTickLabelFont(this.regularFont); axis.setTickLabelPaint(this.tickLabelPaint); if (axis instanceof SymbolAxis) { applyToSymbolAxis((SymbolAxis) axis); } if (axis instanceof PeriodAxis) { applyToPeriodAxis((PeriodAxis) axis); } }
Example 6
Source File: StandardChartTheme.java From ECG-Viewer with GNU General Public License v2.0 | 5 votes |
/** * Applies the attributes for this theme to a {@link ValueAxis}. * * @param axis the axis (<code>null</code> not permitted). */ protected void applyToValueAxis(ValueAxis axis) { axis.setLabelFont(this.largeFont); axis.setLabelPaint(this.axisLabelPaint); axis.setTickLabelFont(this.regularFont); axis.setTickLabelPaint(this.tickLabelPaint); if (axis instanceof SymbolAxis) { applyToSymbolAxis((SymbolAxis) axis); } if (axis instanceof PeriodAxis) { applyToPeriodAxis((PeriodAxis) axis); } }
Example 7
Source File: StandardChartTheme.java From astor with GNU General Public License v2.0 | 5 votes |
/** * Applies the attributes for this theme to a {@link ValueAxis}. * * @param axis the axis (<code>null</code> not permitted). */ protected void applyToValueAxis(ValueAxis axis) { axis.setLabelFont(this.largeFont); axis.setLabelPaint(this.axisLabelPaint); axis.setTickLabelFont(this.regularFont); axis.setTickLabelPaint(this.tickLabelPaint); if (axis instanceof SymbolAxis) { applyToSymbolAxis((SymbolAxis) axis); } if (axis instanceof PeriodAxis) { applyToPeriodAxis((PeriodAxis) axis); } }
Example 8
Source File: MetadataPlotPanel.java From snap-desktop with GNU General Public License v3.0 | 5 votes |
private ValueAxis configureRangeIndex(int index, int dataType) { ValueAxis axis = createAxis(dataType); axis.setAutoRange(true); Font axisFont = axis.getLabelFont().deriveFont(Font.BOLD); axis.setLabelFont(axisFont); axis.setLabel(String.format("Y%d Samples", index + 1)); xyPlot.setRangeAxis(index, axis); xyPlot.setRangeAxisLocation(index, index == 0 ? AxisLocation.BOTTOM_OR_LEFT : AxisLocation.BOTTOM_OR_RIGHT); return axis; }
Example 9
Source File: MetadataPlotPanel.java From snap-desktop with GNU General Public License v3.0 | 5 votes |
private void configureDomainAxis(int index, String nameX, int dataType) { ValueAxis axis = createAxis(dataType); axis.setAutoRange(true); axis.setAutoRangeMinimumSize(2); axis.setLabel(nameX); Font axisFont = axis.getLabelFont().deriveFont(Font.BOLD); axis.setLabelFont(axisFont); xyPlot.setDomainAxis(index, axis); }
Example 10
Source File: StandardChartTheme.java From buffer_bci with GNU General Public License v3.0 | 5 votes |
/** * Applies the attributes for this theme to a {@link ValueAxis}. * * @param axis the axis (<code>null</code> not permitted). */ protected void applyToValueAxis(ValueAxis axis) { axis.setLabelFont(this.largeFont); axis.setLabelPaint(this.axisLabelPaint); axis.setTickLabelFont(this.regularFont); axis.setTickLabelPaint(this.tickLabelPaint); if (axis instanceof SymbolAxis) { applyToSymbolAxis((SymbolAxis) axis); } if (axis instanceof PeriodAxis) { applyToPeriodAxis((PeriodAxis) axis); } }
Example 11
Source File: StandardChartTheme.java From buffer_bci with GNU General Public License v3.0 | 5 votes |
/** * Applies the attributes for this theme to a {@link ValueAxis}. * * @param axis the axis (<code>null</code> not permitted). */ protected void applyToValueAxis(ValueAxis axis) { axis.setLabelFont(this.largeFont); axis.setLabelPaint(this.axisLabelPaint); axis.setTickLabelFont(this.regularFont); axis.setTickLabelPaint(this.tickLabelPaint); if (axis instanceof SymbolAxis) { applyToSymbolAxis((SymbolAxis) axis); } if (axis instanceof PeriodAxis) { applyToPeriodAxis((PeriodAxis) axis); } }
Example 12
Source File: DeviationChartPlotter.java From rapidminer-studio with GNU Affero General Public License v3.0 | 4 votes |
private JFreeChart createChart(XYDataset dataset, boolean createLegend) { // create the chart... JFreeChart chart = ChartFactory.createXYLineChart(null, // chart title null, // x axis label null, // y axis label dataset, // data PlotOrientation.VERTICAL, createLegend, // include legend true, // tooltips false // urls ); chart.setBackgroundPaint(Color.white); // get a reference to the plot for further customization... XYPlot plot = (XYPlot) chart.getPlot(); plot.setBackgroundPaint(Color.WHITE); plot.setAxisOffset(new RectangleInsets(5.0, 5.0, 5.0, 5.0)); plot.setDomainGridlinePaint(Color.LIGHT_GRAY); plot.setRangeGridlinePaint(Color.LIGHT_GRAY); DeviationRenderer renderer = new DeviationRenderer(true, false); Stroke stroke = new BasicStroke(2.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND); if (dataset.getSeriesCount() == 1) { renderer.setSeriesStroke(0, stroke); renderer.setSeriesPaint(0, Color.RED); renderer.setSeriesFillPaint(0, Color.RED); } else { for (int i = 0; i < dataset.getSeriesCount(); i++) { renderer.setSeriesStroke(i, stroke); Color color = getColorProvider().getPointColor((double) i / (double) (dataset.getSeriesCount() - 1)); renderer.setSeriesPaint(i, color); renderer.setSeriesFillPaint(i, color); } } renderer.setAlpha(0.12f); plot.setRenderer(renderer); ValueAxis valueAxis = plot.getRangeAxis(); valueAxis.setLabelFont(LABEL_FONT_BOLD); valueAxis.setTickLabelFont(LABEL_FONT); return chart; }
Example 13
Source File: SeriesChartPlotter.java From rapidminer-studio with GNU Affero General Public License v3.0 | 4 votes |
@Override protected void updatePlotter() { int categoryCount = prepareData(); String maxClassesProperty = ParameterService .getParameterValue(MainFrame.PROPERTY_RAPIDMINER_GUI_PLOTTER_COLORS_CLASSLIMIT); int maxClasses = 20; try { if (maxClassesProperty != null) { maxClasses = Integer.parseInt(maxClassesProperty); } } catch (NumberFormatException e) { // LogService.getGlobal().log("Series plotter: cannot parse property 'rapidminer.gui.plotter.colors.classlimit', using maximal 20 different classes.", // LogService.WARNING); LogService.getRoot().log(Level.WARNING, "com.rapidminer.gui.plotter.charts.SeriesChartPlotter.parsing_property_error"); } boolean createLegend = categoryCount > 0 && categoryCount < maxClasses; JFreeChart chart = createChart(this.dataset, createLegend); // set the background color for the chart... chart.setBackgroundPaint(Color.white); // domain axis if (axis[INDEX] >= 0) { if (!dataTable.isNominal(axis[INDEX])) { if (dataTable.isDate(axis[INDEX]) || dataTable.isDateTime(axis[INDEX])) { DateAxis domainAxis = new DateAxis(dataTable.getColumnName(axis[INDEX])); domainAxis.setTimeZone(Tools.getPreferredTimeZone()); chart.getXYPlot().setDomainAxis(domainAxis); if (getRangeForDimension(axis[INDEX]) != null) { domainAxis.setRange(getRangeForDimension(axis[INDEX])); } domainAxis.setLabelFont(LABEL_FONT_BOLD); domainAxis.setTickLabelFont(LABEL_FONT); domainAxis.setVerticalTickLabels(isLabelRotating()); } } else { LinkedHashSet<String> values = new LinkedHashSet<String>(); for (DataTableRow row : dataTable) { String stringValue = dataTable.mapIndex(axis[INDEX], (int) row.getValue(axis[INDEX])); if (stringValue.length() > 40) { stringValue = stringValue.substring(0, 40); } values.add(stringValue); } ValueAxis categoryAxis = new SymbolAxis(dataTable.getColumnName(axis[INDEX]), values.toArray(new String[values.size()])); categoryAxis.setLabelFont(LABEL_FONT_BOLD); categoryAxis.setTickLabelFont(LABEL_FONT); categoryAxis.setVerticalTickLabels(isLabelRotating()); chart.getXYPlot().setDomainAxis(categoryAxis); } } // legend settings LegendTitle legend = chart.getLegend(); if (legend != null) { legend.setPosition(RectangleEdge.TOP); legend.setFrame(BlockBorder.NONE); legend.setHorizontalAlignment(HorizontalAlignment.LEFT); legend.setItemFont(LABEL_FONT); } AbstractChartPanel panel = getPlotterPanel(); if (panel == null) { panel = createPanel(chart); } else { panel.setChart(chart); } // ATTENTION: WITHOUT THIS WE GET SEVERE MEMORY LEAKS!!! panel.getChartRenderingInfo().setEntityCollection(null); }
Example 14
Source File: ROCChartPlotter.java From rapidminer-studio with GNU Affero General Public License v3.0 | 4 votes |
private JFreeChart createChart(XYDataset dataset) { // create the chart... JFreeChart chart = ChartFactory.createXYLineChart(null, // chart title null, // x axis label null, // y axis label dataset, // data PlotOrientation.VERTICAL, true, // include legend true, // tooltips false // urls ); chart.setBackgroundPaint(Color.white); // get a reference to the plot for further customisation... XYPlot plot = (XYPlot) chart.getPlot(); plot.setBackgroundPaint(Color.WHITE); plot.setAxisOffset(new RectangleInsets(5.0, 5.0, 5.0, 5.0)); plot.setDomainGridlinePaint(Color.LIGHT_GRAY); plot.setRangeGridlinePaint(Color.LIGHT_GRAY); ValueAxis valueAxis = plot.getRangeAxis(); valueAxis.setLabelFont(PlotterAdapter.LABEL_FONT_BOLD); valueAxis.setTickLabelFont(PlotterAdapter.LABEL_FONT); ValueAxis domainAxis = plot.getDomainAxis(); domainAxis.setLabelFont(PlotterAdapter.LABEL_FONT_BOLD); domainAxis.setTickLabelFont(PlotterAdapter.LABEL_FONT); DeviationRenderer renderer = new DeviationRenderer(true, false); Stroke stroke = new BasicStroke(2.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND); if (dataset.getSeriesCount() == 1) { renderer.setSeriesStroke(0, stroke); renderer.setSeriesPaint(0, Color.RED); renderer.setSeriesFillPaint(0, Color.RED); } else if (dataset.getSeriesCount() == 2) { renderer.setSeriesStroke(0, stroke); renderer.setSeriesPaint(0, Color.RED); renderer.setSeriesFillPaint(0, Color.RED); renderer.setSeriesStroke(1, stroke); renderer.setSeriesPaint(1, Color.BLUE); renderer.setSeriesFillPaint(1, Color.BLUE); } else { for (int i = 0; i < dataset.getSeriesCount(); i++) { renderer.setSeriesStroke(i, stroke); Color color = colorProvider.getPointColor((double) i / (double) (dataset.getSeriesCount() - 1)); renderer.setSeriesPaint(i, color); renderer.setSeriesFillPaint(i, color); } } renderer.setAlpha(0.12f); plot.setRenderer(renderer); // legend settings LegendTitle legend = chart.getLegend(); if (legend != null) { legend.setPosition(RectangleEdge.TOP); legend.setFrame(BlockBorder.NONE); legend.setHorizontalAlignment(HorizontalAlignment.LEFT); legend.setItemFont(PlotterAdapter.LABEL_FONT); } return chart; }