Package org.jfree.chart.plot

Examples of org.jfree.chart.plot.CombinedRangeXYPlot


    /**
     * Confirm that cloning works.
     */
    public void testCloning() {
        CombinedRangeXYPlot plot1 = createPlot();
        CombinedRangeXYPlot plot2 = null;
        try {
            plot2 = (CombinedRangeXYPlot) plot1.clone();
        }
        catch (CloneNotSupportedException e) {
            e.printStackTrace();
        }
        assertTrue(plot1 != plot2);
        assertTrue(plot1.getClass() == plot2.getClass());
        assertTrue(plot1.equals(plot2));
    }
View Full Code Here


    /**
     * Serialize an instance, restore it, and check for equality.
     */
    public void testSerialization() {
        CombinedRangeXYPlot plot1 = createPlot();
        CombinedRangeXYPlot plot2 = null;
        try {
            ByteArrayOutputStream buffer = new ByteArrayOutputStream();
            ObjectOutput out = new ObjectOutputStream(buffer);
            out.writeObject(plot1);
            out.close();
View Full Code Here

    /**
     * Check that only one chart change event is generated by a change to a
     * subplot.
     */
    public void testNotification() {
        CombinedRangeXYPlot plot = createPlot();
        JFreeChart chart = new JFreeChart(plot);
        chart.addChangeListener(this);
        XYPlot subplot1 = (XYPlot) plot.getSubplots().get(0);
        NumberAxis xAxis = (NumberAxis) subplot1.getDomainAxis();
        xAxis.setAutoRangeIncludesZero(!xAxis.getAutoRangeIncludesZero());
        assertEquals(1, this.events.size());

        // a redraw should NOT trigger another change event
View Full Code Here

        xAxis2.setAutoRangeIncludesZero(false);
        XYPlot subplot2 = new XYPlot(data2, xAxis2, null, renderer2);
        subplot2.setRangeAxisLocation(AxisLocation.TOP_OR_LEFT);

        // parent plot...
        CombinedRangeXYPlot plot = new CombinedRangeXYPlot(new NumberAxis(
                "Range"));
        plot.setGap(10.0);

        // add the subplots...
        plot.add(subplot1, 1);
        plot.add(subplot2, 1);
        plot.setOrientation(PlotOrientation.VERTICAL);
        return plot;
    }
View Full Code Here

              ((CombinedDomainXYPlot) plot).add(temp);
            }
            return new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT, plot, true);
          case RANGE :
            ValueAxis rangeAxis = new NumberAxis(yAxisLabel);
            plot = new CombinedRangeXYPlot(rangeAxis);
            for (int i = 0; i < plotDefinitions.size(); i++) {
              PlotDefinition pd = (PlotDefinition) plotDefinitions.get(i);
              check((Dataset) pd.getDataset(), XYDataset.class, chartType);
              XYPlot temp = (XYPlot) pd.getPlot(chartTypeConst);
              temp.setDomainAxis(new DateAxis(pd.getXaxislabel()));
View Full Code Here

    private JFreeChart createChart(CheapTimeSolution solution) {
        NumberAxis rangeAxis = new NumberAxis("Period");
        rangeAxis.setRange(-0.5, solution.getGlobalPeriodRangeTo() + 0.5);
        XYPlot taskAssignmentPlot = createTaskAssignmentPlot(solution);
        XYPlot periodCostPlot = createPeriodCostPlot(solution);
        CombinedRangeXYPlot combinedPlot = new CombinedRangeXYPlot(rangeAxis);
        combinedPlot.add(taskAssignmentPlot, 5);
        combinedPlot.add(periodCostPlot, 1);

        combinedPlot.setOrientation(PlotOrientation.HORIZONTAL);
        return new JFreeChart("Cheap Power Time Scheduling", JFreeChart.DEFAULT_TITLE_FONT,
                combinedPlot, true);
    }
View Full Code Here

                    applyToPlot(subplot);
                }
            }
        }
        if (plot instanceof CombinedRangeXYPlot) {
            CombinedRangeXYPlot cp = (CombinedRangeXYPlot) plot;
            Iterator iterator = cp.getSubplots().iterator();
            while (iterator.hasNext()) {
                XYPlot subplot = (XYPlot) iterator.next();
                if (subplot != null) {
                    applyToPlot(subplot);
                }
View Full Code Here

    /**
     * Test the equals method.
     */
    public void testEquals() {
        CombinedRangeXYPlot plot1 = createPlot();
        CombinedRangeXYPlot plot2 = createPlot();
        assertTrue(plot1.equals(plot2));   
        assertTrue(plot2.equals(plot1));
    }
View Full Code Here

    /**
     * This is a test to replicate the bug report 987080.
     */
    public void testRemoveSubplot() {
        CombinedRangeXYPlot plot = new CombinedRangeXYPlot();
        XYPlot plot1 = new XYPlot();
        XYPlot plot2 = new XYPlot();
        plot.add(plot1);
        plot.add(plot2);
        // remove plot2, but plot1 is removed instead
        plot.remove(plot2);
        List plots = plot.getSubplots();
        assertTrue(plots.get(0) == plot1);
    }
View Full Code Here

   
    /**
     * Confirm that cloning works.
     */
    public void testCloning() {
        CombinedRangeXYPlot plot1 = createPlot();       
        CombinedRangeXYPlot plot2 = null;
        try {
            plot2 = (CombinedRangeXYPlot) plot1.clone();
        }
        catch (CloneNotSupportedException e) {
            System.err.println("CombinedRangeXYPlotTests.testCloning: failed to clone.");
        }
        assertTrue(plot1 != plot2);
        assertTrue(plot1.getClass() == plot2.getClass());
        assertTrue(plot1.equals(plot2));
    }
View Full Code Here

TOP

Related Classes of org.jfree.chart.plot.CombinedRangeXYPlot

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.