Java Code Examples for org.jfree.chart.axis.LogAxis#setBase()

The following examples show how to use org.jfree.chart.axis.LogAxis#setBase() . 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: LogAxisTests.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Confirm that the equals method can distinguish all the required fields.
 */
public void testEquals() {
    LogAxis a1 = new LogAxis("Test");
    LogAxis a2 = new LogAxis("Test");
    assertTrue(a1.equals(a2));

    a1.setBase(2.0);
    assertFalse(a1.equals(a2));
    a2.setBase(2.0);
    assertTrue(a1.equals(a2));

    a1.setSmallestValue(0.1);
    assertFalse(a1.equals(a2));
    a2.setSmallestValue(0.1);
    assertTrue(a1.equals(a2));

    a1.setMinorTickCount(8);
    assertFalse(a1.equals(a2));
    a2.setMinorTickCount(8);
    assertTrue(a1.equals(a2));
}
 
Example 2
Source File: LogAxisTests.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Confirm that the equals method can distinguish all the required fields.
 */
public void testEquals() {
    LogAxis a1 = new LogAxis("Test");
    LogAxis a2 = new LogAxis("Test");
    assertTrue(a1.equals(a2));

    a1.setBase(2.0);
    assertFalse(a1.equals(a2));
    a2.setBase(2.0);
    assertTrue(a1.equals(a2));

    a1.setSmallestValue(0.1);
    assertFalse(a1.equals(a2));
    a2.setSmallestValue(0.1);
    assertTrue(a1.equals(a2));

    a1.setMinorTickCount(8);
    assertFalse(a1.equals(a2));
    a2.setMinorTickCount(8);
    assertTrue(a1.equals(a2));
}
 
Example 3
Source File: Scatter.java    From hortonmachine with GNU General Public License v3.0 4 votes vote down vote up
public JFreeChart getChart() {
    if (chart == null) {
        chart = ChartFactory.createXYLineChart(title, // chart title
                xLabel,
                // domain axis label
                yLabel,
                // range axis label
                dataset,
                // data
                PlotOrientation.VERTICAL,
                // orientation
                true,
                // include legend
                true,
                // tooltips?
                false
        // URLs?
        );

        XYPlot plot = (XYPlot) chart.getPlot();
        if (xLog) {
            LogAxis xAxis = new LogAxis("");
            xAxis.setBase(10);
            plot.setDomainAxis(xAxis);
        }
        if (yLog) {
            LogAxis yAxis = new LogAxis("");
            yAxis.setBase(10);
            plot.setRangeAxis(yAxis);
        }

        if (colors == null) {
            colors = ColorBrewer.getPairedColors(dataset.getSeriesCount());
        }
        for( int i = 0; i < colors.length; i++ ) {
            plot.getRenderer().setSeriesPaint(i, colors[i]);
        }

        ValueAxis rangeAxis = plot.getRangeAxis();
        if (rangeAxis instanceof NumberAxis) {
            NumberAxis axis = (NumberAxis) rangeAxis;
            axis.setAutoRangeIncludesZero(false);
        }

        XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer) plot.getRenderer();
        double x = 1.5;
        double w = x * 2;
        renderer.setSeriesShape(0, new Ellipse2D.Double(-x, x, w, w));
        setShapeLinesVisibility(plot);
    }
    return chart;
}