Example usage for org.jfree.chart.axis NumberAxis setStandardTickUnits

List of usage examples for org.jfree.chart.axis NumberAxis setStandardTickUnits

Introduction

In this page you can find the example usage for org.jfree.chart.axis NumberAxis setStandardTickUnits.

Prototype

public void setStandardTickUnits(TickUnitSource source) 

Source Link

Document

Sets the source for obtaining standard tick units for the axis and sends an AxisChangeEvent to all registered listeners.

Usage

From source file:org.jfree.chart.demo.StackedXYBarChartDemo1.java

private static JFreeChart createChart(TableXYDataset tablexydataset) {
    NumberAxis numberaxis = new NumberAxis("X");
    numberaxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    NumberAxis numberaxis1 = new NumberAxis("Y");
    StackedXYBarRenderer stackedxybarrenderer = new StackedXYBarRenderer(0.10000000000000001D);
    stackedxybarrenderer.setDrawBarOutline(false);
    XYPlot xyplot = new XYPlot(tablexydataset, numberaxis, numberaxis1, stackedxybarrenderer);
    JFreeChart jfreechart = new JFreeChart("Stacked XY Bar Chart Demo 1", xyplot);
    return jfreechart;
}

From source file:org.jfree.chart.demo.VectorPlotDemo1.java

private static JFreeChart createChart(VectorXYDataset dataset) {
    NumberAxis xAxis = new NumberAxis("X");
    xAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    xAxis.setLowerMargin(0.01D);//from  w ww.  ja v a 2 s. c om
    xAxis.setUpperMargin(0.01D);
    xAxis.setAutoRangeIncludesZero(false);
    NumberAxis yAxis = new NumberAxis("Y");
    yAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    yAxis.setLowerMargin(0.01D);
    yAxis.setUpperMargin(0.01D);
    yAxis.setAutoRangeIncludesZero(false);
    //
    VectorRenderer renderer = new VectorRenderer();
    renderer.setSeriesPaint(0, Color.blue);
    XYPlot plot = new XYPlot(dataset, xAxis, yAxis, renderer);
    plot.setBackgroundPaint(Color.lightGray);
    plot.setDomainGridlinePaint(Color.white);
    plot.setRangeGridlinePaint(Color.white);
    plot.setAxisOffset(new RectangleInsets(5D, 5D, 5D, 5D));
    plot.setOutlinePaint(Color.black);
    JFreeChart chart = new JFreeChart("Vector Plot Demo 1", plot);
    chart.setBackgroundPaint(Color.white);
    return chart;
}

From source file:org.jfree.chart.demo.VectorRendererDemo1.java

private static JFreeChart createChart(VectorXYDataset dataset) {
    NumberAxis xAxis = new NumberAxis("X");
    xAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    xAxis.setLowerMargin(0.01D);// www.  j  a v a 2  s  .  co  m
    xAxis.setUpperMargin(0.01D);
    xAxis.setAutoRangeIncludesZero(false);
    NumberAxis yAxis = new NumberAxis("Y");
    yAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    yAxis.setLowerMargin(0.01D);
    yAxis.setUpperMargin(0.01D);
    yAxis.setAutoRangeIncludesZero(false);
    //
    VectorRenderer renderer = new VectorRenderer();
    renderer.setSeriesPaint(0, Color.blue);
    XYPlot plot = new XYPlot(dataset, xAxis, yAxis, renderer);
    plot.setBackgroundPaint(Color.lightGray);
    plot.setDomainGridlinePaint(Color.white);
    plot.setRangeGridlinePaint(Color.white);
    plot.setAxisOffset(new RectangleInsets(5D, 5D, 5D, 5D));
    plot.setOutlinePaint(Color.black);
    JFreeChart chart = new JFreeChart("Vector Renderer Demo 1", plot);
    chart.setBackgroundPaint(Color.white);
    return chart;
}

From source file:org.jfree.chart.demo.PolarChartDemo1.java

private static JFreeChart createChart(XYDataset xydataset) {
    JFreeChart jfreechart = ChartFactory.createPolarChart("Polar Chart Demo 1", xydataset, true, false, false);
    jfreechart.setBackgroundPaint(Color.white);
    PolarPlot polarplot = (PolarPlot) jfreechart.getPlot();
    polarplot.setBackgroundPaint(Color.lightGray);
    polarplot.addCornerTextItem("Corner Item 1");
    polarplot.addCornerTextItem("Corner Item 2");
    polarplot.setAngleGridlinePaint(Color.white);
    polarplot.setRadiusGridlinePaint(Color.white);
    NumberAxis numberaxis = (NumberAxis) polarplot.getAxis();
    numberaxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    return jfreechart;
}

From source file:org.jfree.chart.demo.StatisticalLineChartDemo1.java

private static JFreeChart createChart(CategoryDataset categorydataset) {
    JFreeChart jfreechart = ChartFactory.createLineChart("Statistical Line Chart Demo 1", "Type", "Value",
            categorydataset, PlotOrientation.VERTICAL, true, true, false);
    jfreechart.setBackgroundPaint(Color.white);
    CategoryPlot categoryplot = (CategoryPlot) jfreechart.getPlot();
    categoryplot.setBackgroundPaint(Color.lightGray);
    categoryplot.setRangeGridlinePaint(Color.white);
    CategoryAxis categoryaxis = categoryplot.getDomainAxis();
    categoryaxis.setUpperMargin(0.0D);//  w ww .ja  va 2  s .  c o  m
    categoryaxis.setLowerMargin(0.0D);
    NumberAxis numberaxis = (NumberAxis) categoryplot.getRangeAxis();
    numberaxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    numberaxis.setAutoRangeIncludesZero(true);
    StatisticalLineAndShapeRenderer statisticallineandshaperenderer = new StatisticalLineAndShapeRenderer(true,
            false);
    categoryplot.setRenderer(statisticallineandshaperenderer);
    return jfreechart;
}

From source file:org.jfree.chart.demo.BarChartDemo11.java

private static JFreeChart createChart(CategoryDataset categorydataset) {
    JFreeChart jfreechart = ChartFactory.createBarChart("Open Source Projects By Licence", "Licence",
            "Project Count", categorydataset, PlotOrientation.HORIZONTAL, false, true, false);
    jfreechart.setBackgroundPaint(Color.white);
    CategoryPlot categoryplot = (CategoryPlot) jfreechart.getPlot();
    categoryplot.setBackgroundPaint(Color.lightGray);
    categoryplot.setDomainGridlinePaint(Color.white);
    categoryplot.setDomainGridlinesVisible(true);
    categoryplot.setRangeGridlinePaint(Color.white);
    categoryplot.getDomainAxis().setMaximumCategoryLabelWidthRatio(0.4F);
    NumberAxis numberaxis = (NumberAxis) categoryplot.getRangeAxis();
    numberaxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    BarRenderer barrenderer = (BarRenderer) categoryplot.getRenderer();
    barrenderer.setDrawBarOutline(false);
    GradientPaint gradientpaint = new GradientPaint(0.0F, 0.0F, Color.blue, 0.0F, 0.0F, new Color(0, 0, 64));
    barrenderer.setSeriesPaint(0, gradientpaint);
    return jfreechart;
}

From source file:org.jfree.chart.demo.BoxAndWhiskerChartDemo1.java

private static JFreeChart createChart(BoxAndWhiskerCategoryDataset boxandwhiskercategorydataset) {
    JFreeChart jfreechart = ChartFactory.createBoxAndWhiskerChart("Box and Whisker Chart Demo 1", "Category",
            "Value", boxandwhiskercategorydataset, true);
    CategoryPlot categoryplot = (CategoryPlot) jfreechart.getPlot();
    jfreechart.setBackgroundPaint(Color.white);
    categoryplot.setBackgroundPaint(Color.lightGray);
    categoryplot.setDomainGridlinePaint(Color.white);
    categoryplot.setDomainGridlinesVisible(true);
    categoryplot.setRangeGridlinePaint(Color.white);
    NumberAxis numberaxis = (NumberAxis) categoryplot.getRangeAxis();
    numberaxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    return jfreechart;
}

From source file:org.jfree.chart.demo.StatisticalBarChartDemo1.java

private static JFreeChart createChart(CategoryDataset categorydataset) {
    JFreeChart jfreechart = ChartFactory.createLineChart("Statistical Bar Chart Demo 1", "Type", "Value",
            categorydataset, PlotOrientation.VERTICAL, true, true, false);
    jfreechart.setBackgroundPaint(Color.white);
    CategoryPlot categoryplot = (CategoryPlot) jfreechart.getPlot();
    categoryplot.setBackgroundPaint(Color.lightGray);
    categoryplot.setRangeGridlinePaint(Color.white);
    NumberAxis numberaxis = (NumberAxis) categoryplot.getRangeAxis();
    numberaxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    numberaxis.setAutoRangeIncludesZero(false);
    StatisticalBarRenderer statisticalbarrenderer = new StatisticalBarRenderer();
    statisticalbarrenderer.setErrorIndicatorPaint(Color.black);
    statisticalbarrenderer.setIncludeBaseInRange(false);
    categoryplot.setRenderer(statisticalbarrenderer);
    statisticalbarrenderer.setBaseItemLabelGenerator(new StandardCategoryItemLabelGenerator());
    statisticalbarrenderer.setBaseItemLabelsVisible(true);
    statisticalbarrenderer.setBasePositiveItemLabelPosition(
            new ItemLabelPosition(ItemLabelAnchor.INSIDE6, TextAnchor.BOTTOM_CENTER));
    return jfreechart;
}

From source file:org.jfree.chart.demo.XYShapeRendererDemo1.java

private static JFreeChart createChart(XYZDataset xyzdataset) {
    NumberAxis numberaxis = new NumberAxis("X");
    numberaxis.setAutoRangeIncludesZero(false);
    NumberAxis numberaxis1 = new NumberAxis("Y");
    numberaxis1.setAutoRangeIncludesZero(false);
    XYShapeRenderer xyshaperenderer = new XYShapeRenderer();
    LookupPaintScale lookuppaintscale = new LookupPaintScale(1.0D, 4D, new Color(0, 0, 255));
    lookuppaintscale.add(2D, new Color(100, 100, 255));
    lookuppaintscale.add(3D, new Color(200, 200, 255));
    xyshaperenderer.setPaintScale(lookuppaintscale);
    XYPlot xyplot = new XYPlot(xyzdataset, numberaxis, numberaxis1, xyshaperenderer);
    xyplot.setDomainPannable(true);//ww  w . j a v a  2s. com
    xyplot.setRangePannable(true);
    JFreeChart jfreechart = new JFreeChart("XYShapeRendererDemo1", xyplot);
    jfreechart.removeLegend();
    NumberAxis numberaxis2 = new NumberAxis("Score");
    numberaxis2.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    PaintScaleLegend paintscalelegend = new PaintScaleLegend(lookuppaintscale, numberaxis2);
    paintscalelegend.setPosition(RectangleEdge.RIGHT);
    paintscalelegend.setMargin(4D, 4D, 40D, 4D);
    paintscalelegend.setAxisLocation(AxisLocation.BOTTOM_OR_RIGHT);
    jfreechart.addSubtitle(paintscalelegend);
    ChartUtilities.applyCurrentTheme(jfreechart);
    return jfreechart;
}

From source file:org.jfree.chart.demo.LineChartDemo7.java

private static JFreeChart createChart(CategoryDataset categorydataset) {
    JFreeChart jfreechart = ChartFactory.createLineChart("Line Chart Demo 7", "Category", "Count",
            categorydataset, PlotOrientation.VERTICAL, true, true, false);
    jfreechart.setBackgroundPaint(Color.white);
    CategoryPlot categoryplot = (CategoryPlot) jfreechart.getPlot();
    categoryplot.setBackgroundPaint(Color.lightGray);
    categoryplot.setRangeGridlinePaint(Color.white);
    NumberAxis numberaxis = (NumberAxis) categoryplot.getRangeAxis();
    numberaxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    LineAndShapeRenderer lineandshaperenderer = (LineAndShapeRenderer) categoryplot.getRenderer();
    lineandshaperenderer.setSeriesShapesVisible(0, true);
    lineandshaperenderer.setSeriesShapesVisible(1, false);
    lineandshaperenderer.setSeriesShapesVisible(2, true);
    lineandshaperenderer.setSeriesLinesVisible(2, false);
    lineandshaperenderer.setSeriesShape(2, ShapeUtilities.createDiamond(4F));
    lineandshaperenderer.setDrawOutlines(true);
    lineandshaperenderer.setUseFillPaint(true);
    lineandshaperenderer.setBaseFillPaint(Color.white);
    return jfreechart;
}