ValueAxis domainAxis = plot.getDomainAxis(); domainAxis.setStandardTickUnits(TimeAxis.createTimeTickUnits()); //Here sets the horizontal numbers
public void createGcChart( HistoricSamples samples, String dataId ) throws IOException { XYPlot xyplot1 = newPlot( samples.getGcRatio( dataId ), "chronos.label.gc.ratio", true ); xyplot1.setRangeAxisLocation( AxisLocation.BOTTOM_OR_LEFT ); xyplot1.getRenderer().setSeriesPaint( 0, Color.GREEN ); xyplot1.getRangeAxis().setStandardTickUnits( NumberAxis.createStandardTickUnits() ); XYPlot xyplot2 = newPlot( samples.getKbCollectedPrSecond( dataId ), "chronos.label.gc.kbpersec", true ); xyplot2.setRangeAxisLocation( AxisLocation.TOP_OR_LEFT ); xyplot2.getRenderer().setSeriesPaint( 0, Color.GRAY ); xyplot2.getRangeAxis().setStandardTickUnits( NumberAxis.createStandardTickUnits() ); String timeLabel = bundle.getString( "chronos.label.gc.historytime" ); DateAxis timeAxis = ChartUtil.createTimeAxis( timeLabel, new SimpleDateFormat() ); XYPlot combinedPlot = ChartUtil.createCombinedPlot( timeAxis, xyplot1, xyplot2 ); // xyplot1.setDomainAxis( timeAxis ); // XYPlot combinedPlot = xyplot1; JFreeChart chart = new JFreeChart( bundle.getString( "chronos.label.gc" ), combinedPlot ); renderer.renderChart( "history-gc-" + dataId, chart ); }
public static void scaleChart(JFreeChart chart, XYSeries dSeries, boolean normalized) { XYPlot plot = (XYPlot) chart.getPlot(); ValueAxis domainAxis = plot.getDomainAxis(); domainAxis.setLowerMargin(1.0); domainAxis.setUpperMargin(1.0); domainAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); if (normalized) { domainAxis.setRange(-0.05, 1.05); } else { domainAxis.setRange(dSeries.getMinX() - 1, dSeries.getMaxX() + 1); } NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); rangeAxis.setRange(-0.1 * Math.sqrt(dSeries.getMaxY()), dSeries.getMaxY() + 0.1 * Math.sqrt(dSeries.getMaxY())); }
axis.setStandardTickUnits(tickUnits);
tick.setTickUnit(new NumberTickUnit(1)); standardUnits.add(tick.getTickUnit()); plot.getRangeAxis().setStandardTickUnits(standardUnits);
domainAxis.setCategoryLabelPositions(CategoryLabelPositions.DOWN_45); final ValueAxis axis2 = new NumberAxis("# executions"); axis2.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); plot.setRangeAxis(1, axis2);
tick.setTickUnit(new NumberTickUnit(1)); standardUnits.add(tick.getTickUnit()); plot.getRangeAxis().setStandardTickUnits(standardUnits);
valueAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());