List of usage examples for org.jfree.chart.axis NumberAxis setVisible
public void setVisible(boolean flag)
From source file:com.intel.stl.ui.common.view.ComponentFactory.java
public static JFreeChart createBulletChart(CategoryDataset dataset, double[] thresholds, Color[] colors) { if (thresholds.length != colors.length) { throw new IllegalArgumentException( "Inconsistant array sizes: thresholds=" + thresholds.length + " colors=" + colors.length); }/*from w ww. j av a 2 s .co m*/ JFreeChart jfreechart = ChartFactory.createBarChart(null, null, null, dataset, PlotOrientation.HORIZONTAL, false, true, false); CategoryPlot categoryplot = jfreechart.getCategoryPlot(); categoryplot.setBackgroundPaint(null); categoryplot.setOutlinePaint(null); categoryplot.getDomainAxis().setVisible(false); NumberAxis rangeAxis = (NumberAxis) categoryplot.getRangeAxis(); rangeAxis.setVisible(false); rangeAxis.setRange(new Range(0, 1.0)); double last = 0.0; for (int i = 0; i < thresholds.length; i++) { IntervalMarker marker = new IntervalMarker(last, thresholds[i], colors[i]); categoryplot.addRangeMarker(marker, Layer.BACKGROUND); last = thresholds[i]; } BarRenderer renderer = (BarRenderer) categoryplot.getRenderer(); renderer.setShadowVisible(false); renderer.setMaximumBarWidth(0.33); renderer.setSeriesPaint(0, UIConstants.INTEL_DARK_GRAY); return jfreechart; }
From source file:scheduler.benchmarker.manager.CreateCombinedSplineChart.java
public ChartPanel createChartPanel() { XYDataset dataset = createDataset(); NumberAxis numberaxis = new NumberAxis("EMAILS"); numberaxis.setAutoRangeIncludesZero(true); numberaxis.setRange(0, dataset.getItemCount(1)); numberaxis.setVisible(false); NumberAxis numberaxis1 = new NumberAxis("TIME CONSUMED"); numberaxis.setAutoRangeIncludesZero(false); XYSplineRenderer xysplinerenderer = new XYSplineRenderer(); XYPlot xyplot = new XYPlot(dataset, numberaxis, numberaxis1, xysplinerenderer); xyplot.setBackgroundPaint(Color.lightGray); xyplot.setDomainGridlinePaint(Color.white); xyplot.setRangeGridlinePaint(Color.white); xyplot.setFixedLegendItems(null);//from www .j a v a 2s . com JFreeChart jfreechart = new JFreeChart( "PLAN VALUES FOR '" + sName[0] + "' AND '" + sName[1] + "' SCHEDULERS", new Font(Font.SANS_SERIF, Font.PLAIN, 11), xyplot, true); chartPanel = new ChartPanel(jfreechart, true); //Creating listener chartPanel.addChartMouseListener(new ChartMouseListener() { @Override public void chartMouseClicked(ChartMouseEvent e) { ChartEntity entity = e.getEntity(); if (entity != null && (entity instanceof XYItemEntity)) { XYItemEntity item = (XYItemEntity) entity; String chartTitle = "COMPARISON OF '" + sName[0] + "' AND '" + sName[1] + "' BEHAVIOUR FOR EMAIL '" + dataSource.get(0).getPlanningResult().get(item.getItem()).getEmailName() + "'"; createSubChart(new CreateCombinedCategoryPlot( new PlanningResult[] { dataSource.get(0).getPlanningResult().get(item.getItem()), dataSource.get(1).getPlanningResult().get(item.getItem()) }, pluginColor, chartTitle, new String[] { dataSource.get(0).getSchedulerUsed(), dataSource.get(1).getSchedulerUsed() }).createChartPanel()); } } @Override public void chartMouseMoved(ChartMouseEvent e) { //DO NOTHING } }); return chartPanel; }
From source file:com.intel.stl.ui.common.view.ComponentFactory.java
public static JFreeChart createPlainHistoryChart(IntervalXYDataset dataset, XYItemLabelGenerator labelGenerator) { if (dataset == null) { throw new IllegalArgumentException("No dataset."); }//from ww w . j a va 2 s. co m JFreeChart jfreechart = ChartFactory.createXYBarChart(null, null, true, null, dataset, PlotOrientation.VERTICAL, false, true, false); XYPlot xyplot = (XYPlot) jfreechart.getPlot(); xyplot.setBackgroundPaint(null); xyplot.setOutlinePaint(null); XYBarRenderer renderer = (XYBarRenderer) xyplot.getRenderer(); renderer.setShadowVisible(false); renderer.setBaseItemLabelsVisible(true); if (labelGenerator != null) { renderer.setBaseItemLabelGenerator(labelGenerator); } renderer.setBaseItemLabelFont(UIConstants.H4_FONT); renderer.setBarPainter(new StandardXYBarPainter()); renderer.setSeriesPaint(0, UIConstants.INTEL_BLUE); // xyplot.getDomainAxis().setVisible(false); xyplot.getDomainAxis().setAxisLineVisible(true); xyplot.getDomainAxis().setTickLabelsVisible(false); NumberAxis axis = (NumberAxis) xyplot.getRangeAxis(); axis.setRangeType(RangeType.POSITIVE); axis.setVisible(false); return jfreechart; }
From source file:com.intel.stl.ui.common.view.ComponentFactory.java
@SuppressWarnings("unchecked") public static JFreeChart createTopNBarChart2(String yAxisLabel, CategoryDataset dataset) { JFreeChart jfreechart = ChartFactory.createBarChart(null, null, yAxisLabel, dataset, PlotOrientation.HORIZONTAL, false, true, false); CategoryPlot categoryplot = jfreechart.getCategoryPlot(); categoryplot.setBackgroundPaint(null); categoryplot.setOutlinePaint(null);/*from w ww.j ava 2 s .c o m*/ categoryplot.setDomainGridlinesVisible(true); categoryplot.setDomainGridlinePosition(CategoryAnchor.END); categoryplot.setDomainGridlineStroke(new BasicStroke(0.5F)); categoryplot.setDomainGridlinePaint(UIConstants.INTEL_BORDER_GRAY); categoryplot.setRangeGridlinesVisible(false); categoryplot.clearRangeMarkers(); CategoryAxis categoryaxis = categoryplot.getDomainAxis(); categoryaxis.setVisible(false); categoryaxis.setCategoryMargin(0.75D); NumberAxis axis = (NumberAxis) categoryplot.getRangeAxis(); axis.setRangeType(RangeType.POSITIVE); axis.setVisible(false); BarRenderer barrenderer = (BarRenderer) categoryplot.getRenderer(); barrenderer.setShadowVisible(false); barrenderer.setSeriesPaint(0, UIConstants.INTEL_BLUE); barrenderer.setDrawBarOutline(false); barrenderer.setBaseItemLabelsVisible(true); barrenderer.setBaseItemLabelFont(UIConstants.H5_FONT); barrenderer.setBarPainter(new StandardBarPainter()); List<String> names = dataset.getColumnKeys(); for (String name : names) { CategoryTextAnnotation categorytextannotation = new CategoryTextAnnotation(name, name, 0.0D); categorytextannotation.setFont(UIConstants.H6_FONT); categorytextannotation.setTextAnchor(TextAnchor.BOTTOM_LEFT); categorytextannotation.setCategoryAnchor(CategoryAnchor.MIDDLE); categoryplot.addAnnotation(categorytextannotation); } return jfreechart; }
From source file:uk.ac.lkl.cram.ui.chart.LearningExperienceChartMaker.java
/** * Create a chart from the provide category dataset * @return a Chart that can be rendered in a ChartPanel */// w ww.j a v a 2 s. c o m @Override protected JFreeChart createChart() { //Create a horizontal stacked bar chart from the chart factory, with no title, no axis labels, a legend, tooltips but no URLs JFreeChart chart = ChartFactory.createStackedBarChart(null, null, null, (CategoryDataset) dataset, PlotOrientation.HORIZONTAL, true, true, false); //Get the plot from the chart CategoryPlot plot = (CategoryPlot) chart.getPlot(); //Remove offsets from the plot plot.setInsets(RectangleInsets.ZERO_INSETS); plot.setAxisOffset(RectangleInsets.ZERO_INSETS); //Hide the range lines plot.setRangeGridlinesVisible(false); //Get the renderer for the plot StackedBarRenderer sbRenderer = (StackedBarRenderer) plot.getRenderer(); //Set the painter for the renderer (nothing fancy) sbRenderer.setBarPainter(new StandardBarPainter()); //sbRenderer.setItemMargin(0.5); //Makes no difference //reduces width of bar as proportion of overall width sbRenderer.setMaximumBarWidth(0.5); //Render the bars as percentages sbRenderer.setRenderAsPercentages(true); //Set the colours for the bars sbRenderer.setSeriesPaint(0, PERSONALISED_COLOR); sbRenderer.setSeriesPaint(1, SOCIAL_COLOR); sbRenderer.setSeriesPaint(2, ONE_SIZE_FOR_ALL_COLOR); //Set the tooltips to render percentages sbRenderer.setBaseToolTipGenerator(new StandardCategoryToolTipGenerator() { @Override public String generateToolTip(CategoryDataset cd, int row, int column) { //Only interested in row, as there's only one column //TODO--really inefficient @SuppressWarnings("unchecked") List<Comparable> rows = cd.getRowKeys(); Comparable columnKey = cd.getColumnKey(column); //Sum running total int total = 0; for (Comparable comparable : rows) { total += cd.getValue(comparable, columnKey).intValue(); } //Get the value for the row (in our case the learning type) Comparable rowKey = cd.getRowKey(row); float value = cd.getValue(rowKey, columnKey).floatValue(); //The tooltip is the value of the learning type divided by the total, expressed as a percentage @SuppressWarnings("StringBufferWithoutInitialCapacity") StringBuilder builder = new StringBuilder(); builder.append("<html><center>"); builder.append(cd.getRowKey(row)); builder.append(" ("); builder.append(FORMATTER.format(value / total)); builder.append(")<br/>"); builder.append("Double-click for more"); return builder.toString(); } }); //Hide both axes CategoryAxis categoryAxis = plot.getDomainAxis(); //categoryAxis.setCategoryMargin(0.5D);//Makes no difference categoryAxis.setVisible(false); NumberAxis numberAxis = (NumberAxis) plot.getRangeAxis(); numberAxis.setVisible(false); return chart; }
From source file:it.eng.spagobi.engines.chart.bo.charttypes.targetcharts.WinLose.java
@Override public JFreeChart createChart(DatasetMap datasets) { logger.debug("IN"); DefaultCategoryDataset dataset = (DefaultCategoryDataset) datasets.getDatasets().get("1"); JFreeChart chart = ChartFactory.createBarChart(name, null, null, dataset, PlotOrientation.VERTICAL, legend, false, false);/* w w w .j a v a 2 s . co m*/ chart.setBorderVisible(false); chart.setBackgroundPaint(color); TextTitle title = setStyleTitle(name, styleTitle); chart.setTitle(title); if (subName != null && !subName.equals("")) { TextTitle subTitle = setStyleTitle(subName, styleSubTitle); chart.addSubtitle(subTitle); } CategoryPlot plot = chart.getCategoryPlot(); plot.setOutlineVisible(false); plot.setInsets(new RectangleInsets(0.0, 0.0, 0.0, 0.0)); plot.setBackgroundPaint(color); plot.setDomainGridlinesVisible(false); plot.setRangeGridlinesVisible(false); plot.setRangeCrosshairVisible(true); plot.setRangeCrosshairStroke(new BasicStroke(1f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL)); plot.setRangeCrosshairPaint(color.BLACK); // customize axes CategoryAxis domainAxis = plot.getDomainAxis(); domainAxis.setVisible(false); domainAxis.setCategoryMargin(0.2); NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); rangeAxis.setVisible(false); rangeAxis.setRange(new Range(-(barHeight + 0.2), (barHeight + 0.2))); // customize renderer MyBarRendererThresholdPaint renderer = new MyBarRendererThresholdPaint(useTargets, thresholds, dataset, timeSeries, nullValues, bottomThreshold, color); if (wlt_mode.doubleValue() == 0) { renderer.setBaseItemLabelsVisible(Boolean.FALSE, true); } else { renderer.setBaseItemLabelsVisible(Boolean.TRUE, true); renderer.setBaseItemLabelFont( new Font(styleValueLabels.getFontName(), Font.PLAIN, styleValueLabels.getSize())); renderer.setBaseItemLabelPaint(styleValueLabels.getColor()); renderer.setBaseItemLabelGenerator( new StandardCategoryItemLabelGenerator("{2}", new DecimalFormat("0.#")) { public String generateLabel(CategoryDataset dataset, int row, int column) { if (dataset.getValue(row, column) == null || dataset.getValue(row, column).doubleValue() == 0) return ""; String columnKey = (String) dataset.getColumnKey(column); int separator = columnKey.indexOf('-'); String month = columnKey.substring(0, separator); String year = columnKey.substring(separator + 1); int monthNum = Integer.parseInt(month); if (wlt_mode.doubleValue() >= 1 && wlt_mode.doubleValue() <= 4) { if (wlt_mode.doubleValue() == 2 && column % 2 == 0) return ""; Calendar calendar = Calendar.getInstance(); calendar.set(Calendar.MONTH, monthNum - 1); SimpleDateFormat dataFormat = new SimpleDateFormat("MMM"); return dataFormat.format(calendar.getTime()); } else return "" + monthNum; } }); } if (wlt_mode.doubleValue() == 3) { renderer.setBasePositiveItemLabelPosition(new ItemLabelPosition(ItemLabelAnchor.OUTSIDE12, org.jfree.ui.TextAnchor.BOTTOM_CENTER, org.jfree.ui.TextAnchor.BOTTOM_RIGHT, Math.PI / 2)); renderer.setBaseNegativeItemLabelPosition(new ItemLabelPosition(ItemLabelAnchor.OUTSIDE6, org.jfree.ui.TextAnchor.TOP_CENTER, org.jfree.ui.TextAnchor.HALF_ASCENT_LEFT, Math.PI / 2)); } else if (wlt_mode.doubleValue() == 4 || wlt_mode.doubleValue() == 5) { renderer.setBasePositiveItemLabelPosition(new ItemLabelPosition(ItemLabelAnchor.OUTSIDE12, org.jfree.ui.TextAnchor.BOTTOM_CENTER, org.jfree.ui.TextAnchor.BOTTOM_RIGHT, Math.PI / 4)); renderer.setBaseNegativeItemLabelPosition(new ItemLabelPosition(ItemLabelAnchor.OUTSIDE6, org.jfree.ui.TextAnchor.TOP_CENTER, org.jfree.ui.TextAnchor.HALF_ASCENT_LEFT, Math.PI / 4)); } if (legend == true) { LegendItemCollection collection = createThresholdLegend(plot); plot.setFixedLegendItems(collection); } if (maxBarWidth != null) { renderer.setMaximumBarWidth(maxBarWidth); } //renderer.setSeriesPaint(0, Color.BLUE); plot.setRenderer(renderer); logger.debug("OUT"); if (mainThreshold == null) return null; return chart; }
From source file:org.projectforge.charting.XYChartBuilder.java
public XYChartBuilder setYAxis(final boolean showAxisValues, final String valueAxisUnitKey) { final NumberAxis yAxis; if (showAxisValues == true && valueAxisUnitKey != null) { yAxis = new NumberAxis(ThreadLocalUserContext.getLocalizedString(valueAxisUnitKey)); } else {//from w w w . j a v a 2s . c o m yAxis = new NumberAxis(); } yAxis.setVisible(showAxisValues); plot.setRangeAxis(yAxis); return this; }
From source file:net.sf.mzmine.chartbasics.chartthemes.EStandardChartTheme.java
@Override public void apply(JFreeChart chart) { // TODO Auto-generated method stub super.apply(chart); ////from w ww . jav a2 s . c om chart.getXYPlot().setDomainGridlinesVisible(showXGrid); chart.getXYPlot().setRangeGridlinesVisible(showYGrid); // all axes for (int i = 0; i < chart.getXYPlot().getDomainAxisCount(); i++) { NumberAxis a = (NumberAxis) chart.getXYPlot().getDomainAxis(i); a.setTickMarkPaint(axisLinePaint); a.setAxisLinePaint(axisLinePaint); // visible? a.setVisible(showXAxis); } for (int i = 0; i < chart.getXYPlot().getRangeAxisCount(); i++) { NumberAxis a = (NumberAxis) chart.getXYPlot().getRangeAxis(i); a.setTickMarkPaint(axisLinePaint); a.setAxisLinePaint(axisLinePaint); // visible? a.setVisible(showYAxis); } // apply bg chart.setBackgroundPaint(this.getChartBackgroundPaint()); chart.getPlot().setBackgroundPaint(this.getPlotBackgroundPaint()); for (int i = 0; i < chart.getSubtitleCount(); i++) { // visible? chart.getSubtitle(i).setVisible(subtitleVisible); // if (PaintScaleLegend.class.isAssignableFrom(chart.getSubtitle(i).getClass())) ((PaintScaleLegend) chart.getSubtitle(i)).setBackgroundPaint(this.getChartBackgroundPaint()); } if (chart.getLegend() != null) chart.getLegend().setBackgroundPaint(this.getChartBackgroundPaint()); // chart.setAntiAlias(isAntiAliased()); chart.getTitle().setVisible(isShowTitle()); chart.getPlot().setBackgroundAlpha(isNoBackground() ? 0 : 1); }
From source file:org.projectforge.statistics.TimesheetDisciplineChartBuilder.java
private JFreeChart create(final TimeSeries series1, final TimeSeries series2, final Shape shape, final Stroke stroke, final boolean showAxisValues, final String valueAxisUnitKey) { final TimeSeriesCollection dataset = new TimeSeriesCollection(); dataset.addSeries(series1);//from www . j av a2s .c om dataset.addSeries(series2); final JFreeChart chart = ChartFactory.createXYLineChart(null, null, null, dataset, PlotOrientation.VERTICAL, true, true, false); final XYDifferenceRenderer renderer = new XYDifferenceRenderer(new Color(238, 176, 176), new Color(135, 206, 112), true); renderer.setSeriesPaint(0, new Color(222, 23, 33)); renderer.setSeriesPaint(1, new Color(64, 169, 59)); if (shape != null) { renderer.setSeriesShape(0, shape); renderer.setSeriesShape(1, shape); } else { final Shape none = new Rectangle(); renderer.setSeriesShape(0, none); renderer.setSeriesShape(1, none); } renderer.setSeriesStroke(0, stroke); renderer.setSeriesStroke(1, stroke); renderer.setSeriesVisibleInLegend(0, false); renderer.setSeriesVisibleInLegend(1, false); final XYPlot plot = chart.getXYPlot(); plot.setRenderer(renderer); plot.setBackgroundPaint(Color.white); plot.setDomainGridlinePaint(Color.lightGray); plot.setRangeGridlinePaint(Color.lightGray); final DateAxis xAxis = new DateAxis(); xAxis.setTickMarkPosition(DateTickMarkPosition.MIDDLE); xAxis.setLowerMargin(0.0); xAxis.setUpperMargin(0.0); xAxis.setVisible(showAxisValues); plot.setDomainAxis(xAxis); final NumberAxis yAxis; if (showAxisValues == true) { yAxis = new NumberAxis(PFUserContext.getLocalizedString(valueAxisUnitKey)); } else { yAxis = new NumberAxis(); } yAxis.setVisible(showAxisValues); plot.setRangeAxis(yAxis); plot.setOutlineVisible(false); return chart; }
From source file:com.rapidminer.gui.new_plotter.engine.jfreechart.ChartAxisFactory.java
public static ValueAxis createRangeAxis(RangeAxisConfig rangeAxisConfig, PlotInstance plotInstance) throws ChartPlottimeException { if (rangeAxisConfig.getValueType() == ValueType.UNKNOWN || rangeAxisConfig.getValueType() == ValueType.INVALID) { return null; } else {/* w ww . j av a2 s . c o m*/ RangeAxisData rangeAxisData = plotInstance.getPlotData().getRangeAxisData(rangeAxisConfig); double initialUpperBound = rangeAxisData.getUpperViewBound(); double initialLowerBound = rangeAxisData.getLowerViewBound(); double upperBound = initialUpperBound; double lowerBound = initialLowerBound; // fetch old zooming LinkAndBrushMaster linkAndBrushMaster = plotInstance.getMasterPlotConfiguration() .getLinkAndBrushMaster(); Range axisZoom = linkAndBrushMaster.getRangeAxisZoom(rangeAxisConfig, plotInstance.getCurrentPlotConfigurationClone()); List<ValueSource> valueSources = rangeAxisConfig.getValueSources(); if (rangeAxisConfig.hasAbsolutStackedPlot()) { for (ValueSource valueSource : valueSources) { VisualizationType seriesType = valueSource.getSeriesFormat().getSeriesType(); if (seriesType == VisualizationType.BARS || seriesType == VisualizationType.AREA) { if (valueSource.getSeriesFormat().getStackingMode() == StackingMode.ABSOLUTE) { Pair<Double, Double> minMax = calculateUpperAndLowerBounds(valueSource, plotInstance); if (upperBound < minMax.getSecond()) { upperBound = minMax.getSecond(); } if (lowerBound > minMax.getFirst()) { lowerBound = minMax.getFirst(); } } } } } double margin = upperBound - lowerBound; if (lowerBound == upperBound) { margin = lowerBound; } if (margin == 0) { margin = 0.1; } double normalPad = RangeAxisConfig.padFactor * margin; if (rangeAxisConfig.isLogarithmicAxis()) { if (!rangeAxisConfig.isUsingUserDefinedLowerViewBound()) { lowerBound -= RangeAxisConfig.logPadFactor * lowerBound; } if (!rangeAxisConfig.isUsingUserDefinedUpperViewBound()) { upperBound += RangeAxisConfig.logPadFactor * upperBound; } } else { // add margin if (!rangeAxisConfig.isUsingUserDefinedLowerViewBound()) { lowerBound -= normalPad; } if (!rangeAxisConfig.isUsingUserDefinedUpperViewBound()) { upperBound += normalPad; } } boolean includeZero = false; if (isIncludingZero(rangeAxisConfig, initialLowerBound) && !rangeAxisConfig.isUsingUserDefinedLowerViewBound()) { // if so set lower bound to zero lowerBound = 0.0; includeZero = true; } boolean upToOne = false; // if there are only relative plots set upper Bound to 1.0 if (rangeAxisConfig.mustHaveUpperBoundOne(initialUpperBound) && !rangeAxisConfig.isUsingUserDefinedUpperViewBound()) { upperBound = 1.0; upToOne = true; } if (includeZero && !upToOne) { upperBound *= 1.05; } String label = rangeAxisConfig.getLabel(); if (label == null) { label = I18N.getGUILabel("plotter.unnamed_value_label"); } ValueAxis rangeAxis; if (rangeAxisConfig.getValueType() == ValueType.NOMINAL && !valueSources.isEmpty()) { // get union of distinct values of all plotValueConfigs on range axis int maxValue = Integer.MIN_VALUE; for (ValueSource valueSource : rangeAxisData.getRangeAxisConfig().getValueSources()) { ValueSourceData valueSourceData = plotInstance.getPlotData().getValueSourceData(valueSource); double maxValueInSource = valueSourceData.getMaxValue(); if (maxValueInSource > maxValue) { maxValue = (int) maxValueInSource; } } Vector<String> yValueStrings = new Vector<String>(maxValue); yValueStrings.setSize(maxValue + 1); ValueSourceData valueSourceData = plotInstance.getPlotData() .getValueSourceData(valueSources.get(0)); for (int i = 0; i <= maxValue; ++i) { yValueStrings.set(i, valueSourceData.getStringForValue(SeriesUsageType.MAIN_SERIES, i)); } String[] yValueStringArray = new String[yValueStrings.size()]; int i = 0; for (String s : yValueStrings) { yValueStringArray[i] = s; ++i; } CustomSymbolAxis symbolRangeAxis = new CustomSymbolAxis(null, yValueStringArray); symbolRangeAxis.setVisible(true); symbolRangeAxis.setAutoRangeIncludesZero(false); symbolRangeAxis.saveUpperBound(upperBound, initialUpperBound); symbolRangeAxis.saveLowerBound(lowerBound, initialLowerBound); symbolRangeAxis.setLabel(label); Font axesFont = plotInstance.getCurrentPlotConfigurationClone().getAxesFont(); if (axesFont != null) { symbolRangeAxis.setLabelFont(axesFont); symbolRangeAxis.setTickLabelFont(axesFont); } // set range if axis has been zoomed before if (axisZoom != null) { symbolRangeAxis.setRange(axisZoom); } rangeAxis = symbolRangeAxis; } else if (rangeAxisConfig.getValueType() == ValueType.NUMERICAL) { NumberAxis numberRangeAxis; if (rangeAxisConfig.isLogarithmicAxis()) { if (rangeAxisData.getMinYValue() <= 0) { throw new ChartPlottimeException("log_axis_contains_zero", label); } numberRangeAxis = new CustomLogarithmicAxis(null); ((CustomLogarithmicAxis) numberRangeAxis).saveUpperBound(upperBound, initialUpperBound); ((CustomLogarithmicAxis) numberRangeAxis).saveLowerBound(lowerBound, initialLowerBound); } else { numberRangeAxis = new CustomNumberAxis(); ((CustomNumberAxis) numberRangeAxis).saveUpperBound(upperBound, initialUpperBound); ((CustomNumberAxis) numberRangeAxis).saveLowerBound(lowerBound, initialLowerBound); } numberRangeAxis.setAutoRangeIncludesZero(false); numberRangeAxis.setVisible(true); numberRangeAxis.setLabel(label); Font axesFont = plotInstance.getCurrentPlotConfigurationClone().getAxesFont(); if (axesFont != null) { numberRangeAxis.setLabelFont(axesFont); numberRangeAxis.setTickLabelFont(axesFont); } // set range if axis has been zoomed before if (axisZoom != null) { numberRangeAxis.setRange(axisZoom); } rangeAxis = numberRangeAxis; } else if (rangeAxisConfig.getValueType() == ValueType.DATE_TIME) { CustomDateAxis dateRangeAxis; if (rangeAxisConfig.isLogarithmicAxis()) { throw new ChartPlottimeException("logarithmic_not_supported_for_value_type", label, ValueType.DATE_TIME); } else { dateRangeAxis = new CustomDateAxis(); } dateRangeAxis.saveUpperBound(upperBound, initialUpperBound); dateRangeAxis.saveLowerBound(lowerBound, initialLowerBound); dateRangeAxis.setVisible(true); dateRangeAxis.setLabel(label); Font axesFont = plotInstance.getCurrentPlotConfigurationClone().getAxesFont(); if (axesFont != null) { dateRangeAxis.setLabelFont(axesFont); } // set range if axis has been zoomed before if (axisZoom != null) { dateRangeAxis.setRange(axisZoom); } rangeAxis = dateRangeAxis; } else { throw new RuntimeException("Unknown value type. This should not happen"); } // configure format formatAxis(plotInstance.getCurrentPlotConfigurationClone(), rangeAxis); return rangeAxis; } }