List of usage examples for org.jfree.chart.axis NumberAxis setAutoRangeIncludesZero
public void setAutoRangeIncludesZero(boolean flag)
From source file:org.jfree.chart.demo.BoxAndWhiskerDemo.java
/** * Creates a new demo.// w w w . ja va 2s . com * * @param title the frame title. */ public BoxAndWhiskerDemo(final String title) { super(title); final BoxAndWhiskerCategoryDataset dataset = createSampleDataset(); final CategoryAxis xAxis = new CategoryAxis("Type"); final NumberAxis yAxis = new NumberAxis("Value"); yAxis.setAutoRangeIncludesZero(false); final BoxAndWhiskerRenderer renderer = new BoxAndWhiskerRenderer(); renderer.setFillBox(false); renderer.setToolTipGenerator(new BoxAndWhiskerToolTipGenerator()); final CategoryPlot plot = new CategoryPlot(dataset, xAxis, yAxis, renderer); final JFreeChart chart = new JFreeChart("Box-and-Whisker Demo", new Font("SansSerif", Font.BOLD, 14), plot, true); final ChartPanel chartPanel = new ChartPanel(chart); chartPanel.setPreferredSize(new java.awt.Dimension(450, 270)); setContentPane(chartPanel); }
From source file:org.mwc.cmap.grideditor.chart.Value2ValueManager.java
private NumberAxis createNumberAxis() { final NumberAxis result = new NumberAxis(); result.setAutoRangeIncludesZero(false); return result; }
From source file:playground.anhorni.counts.StdDevBoxPlot.java
public JFreeChart createChart() { DefaultBoxAndWhiskerCategoryDataset dataset = new DefaultBoxAndWhiskerCategoryDataset(); ArrayList<Double>[] lists = this.createArrayLists(); // add the collected values to the graph / dataset for (int i = 0; i < 24; i++) { dataset.add(lists[i], "hour", Integer.toString(i + 1)); }// w w w . j ava2 s. co m final CategoryAxis xAxis = new CategoryAxis(xlabel); xAxis.setTickLabelFont(new Font("SansSerif", Font.PLAIN, 10)); //xAxis.setCategoryLabelPositions(CategoryLabelPositions.UP_45); final NumberAxis yAxis = new NumberAxis(ylabel); yAxis.setAutoRangeIncludesZero(true); final BoxAndWhiskerRenderer renderer = new BoxAndWhiskerRenderer(); renderer.setFillBox(false); renderer.setSeriesPaint(0, Color.blue); CategoryPlot plot = new CategoryPlot(dataset, xAxis, yAxis, renderer); this.chart_ = new JFreeChart(chartTitle, new Font("SansSerif", Font.BOLD, 14), plot, false); return this.chart_; }
From source file:playground.anhorni.PLOC.analysis.MultipleEnsemblesBoxPlot.java
public JFreeChart createChart() { String title = chartTitle;/*from w w w . j av a 2 s . c om*/ final CategoryAxis xAxis = new CategoryAxis("Runs ensemble size"); xAxis.setTickLabelFont(new Font("SansSerif", Font.PLAIN, 10)); xAxis.setCategoryLabelPositions(CategoryLabelPositions.UP_45); final NumberAxis yAxis = new NumberAxis("AvgDaysRuns_OfEnsembleAverageOfTotalExpenditures"); yAxis.setAutoRangeIncludesZero(true); final BoxAndWhiskerRenderer renderer = new BoxAndWhiskerRenderer(); renderer.setFillBox(false); renderer.setSeriesPaint(0, Color.blue); CategoryPlot plot = new CategoryPlot(dataset, xAxis, yAxis, renderer); this.chart_ = new JFreeChart(title, new Font("SansSerif", Font.BOLD, 14), plot, false); return this.chart_; }
From source file:com.hazelcast.monitor.server.MChartGenerator.java
@Override protected void afterPlot(List<? super InstanceStatistics> list, JFreeChart chart, XYPlot plot) { NumberAxis sizeAxis = (NumberAxis) plot.getRangeAxis(0); Font labelFont = sizeAxis.getLabelFont(); Paint labelPaint = sizeAxis.getLabelPaint(); TimeSeries tm = new TimeSeries("memory"); for (int i = 0; i < list.size(); i++) { double memory = 0; MapStatistics mapStatistics = (MapStatistics) list.get(i); for (MapStatistics.LocalMapStatistics localMapStatistics : mapStatistics.getListOfLocalStats()) { memory = memory + localMapStatistics.ownedEntryMemoryCost + localMapStatistics.backupEntryMemoryCost + localMapStatistics.markedAsRemovedMemoryCost; }// w ww .ja v a2 s.co m double mem = new Double(memory / (double) (1024 * 1024)); tm.addOrUpdate(new Second(((MapStatistics) list.get(i)).getCreatedDate()), mem); } NumberAxis memoryAxis = new NumberAxis("memory (MB)"); memoryAxis.setAutoRange(true); memoryAxis.setAutoRangeIncludesZero(false); plot.setDataset(1, new TimeSeriesCollection(tm)); plot.setRangeAxis(1, memoryAxis); plot.mapDatasetToRangeAxis(1, 1); plot.setRenderer(1, new StandardXYItemRenderer()); plot.setDatasetRenderingOrder(DatasetRenderingOrder.FORWARD); increaseRange(memoryAxis); memoryAxis.setLabelFont(labelFont); memoryAxis.setLabelPaint(labelPaint); }
From source file:org.mwc.cmap.grideditor.chart.Date2ValueManager.java
public ValueAxis createYAxis() { final NumberAxis result = new NumberAxis(null); result.setAutoRangeIncludesZero(false); return result; }
From source file:playground.yu.utils.charts.TimeLineChart.java
private JFreeChart createChart(String title, String timeAxisLabel, String valueAxisLabel, final TimeTableXYDataset dataset) { ValueAxis timeAxis = new DateAxis(timeAxisLabel); timeAxis.setLowerMargin(0.02); // reduce the default margins timeAxis.setUpperMargin(0.02);/* w ww . ja v a2s.c om*/ NumberAxis valueAxis = new NumberAxis(valueAxisLabel); valueAxis.setAutoRangeIncludesZero(false); // override default XYPlot plot = new XYPlot(dataset, timeAxis, valueAxis, null); XYToolTipGenerator toolTipGenerator = null; boolean tooltips = false; if (tooltips) { toolTipGenerator = StandardXYToolTipGenerator.getTimeSeriesInstance(); } XYURLGenerator urlGenerator = null; boolean urls = false; if (urls) { urlGenerator = new StandardXYURLGenerator(); } XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer(true/* line */, false/* shape */); renderer.setBaseToolTipGenerator(toolTipGenerator); renderer.setURLGenerator(urlGenerator); plot.setRenderer(renderer); boolean legend = true; JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT, plot, legend); return chart; }
From source file:ec.nbdemetra.chainlinking.outlineview.ChainLinkingChart.java
private void configureAxis(XYPlot plot) { NumberAxis xAxis = new NumberAxis(); xAxis.setAutoRangeIncludesZero(false); plot.setRangeAxis(xAxis);//w w w . ja va 2 s . co m QuarterDateFormat qdf = new QuarterDateFormat(); DateAxis dateAxis = new DateAxis(); dateAxis.setTickMarkPosition(DateTickMarkPosition.MIDDLE); dateAxis.setDateFormatOverride(qdf); plot.setDomainAxis(dateAxis); }
From source file:bigdataproject.ScatterPlot.java
/** * Creates a new fast scatter plot.//from w ww. ja v a 2 s . co m * * @param title the frame title. * @param samples the 2D matrix to plot. */ public ScatterPlot(final String title, double[][] samples, List<Cluster<DoublePoint>> list) { super(title); this.list = list; convertToFloat(samples); listToHashMap(); HashMap<Integer, float[][]> clusterData = HashMapDoubleToFloat(); final NumberAxis domainAxis = new NumberAxis("X1"); domainAxis.setAutoRangeIncludesZero(false); final NumberAxis rangeAxis = new NumberAxis("X2"); rangeAxis.setAutoRangeIncludesZero(false); final CustomFastScatterPlot plot = new CustomFastScatterPlot(this.data, domainAxis, rangeAxis, clusterData); final JFreeChart chart = new JFreeChart(title, plot); //chart.setLegend(null); // force aliasing of the rendered content.. chart.getRenderingHints().put(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); final ChartPanel panel = new ChartPanel(chart, true); panel.setPreferredSize(new java.awt.Dimension(1000, 540)); panel.setMinimumDrawHeight(10); panel.setMaximumDrawHeight(2000); panel.setMinimumDrawWidth(20); panel.setMaximumDrawWidth(2000); setContentPane(panel); }
From source file:com.sixrr.metrics.ui.charts.DistributionDialog.java
private JFreeChart createChart(XYDataset dataset) { final String title = getTitle(); final NumberAxis xAxis = new NumberAxis(metricName); xAxis.setAutoRangeIncludesZero(false); if (metricType == MetricType.Ratio || metricType == MetricType.RecursiveRatio) { xAxis.setNumberFormatOverride(new PercentFormatter()); }//from www .j a va 2 s .c o m final NumberAxis yAxis = new NumberAxis("%"); final XYItemRenderer renderer = new StandardXYItemRenderer(StandardXYItemRenderer.LINES); final XYPlot plot = new XYPlot(dataset, xAxis, yAxis, renderer); plot.setOrientation(PlotOrientation.VERTICAL); renderer.setToolTipGenerator(new StandardXYToolTipGenerator()); return new JFreeChart(title, JFreeChartConstants.DEFAULT_TITLE_FONT, plot, true); }