Example usage for org.jfree.chart.axis LogarithmicAxis setUpperBound

List of usage examples for org.jfree.chart.axis LogarithmicAxis setUpperBound

Introduction

In this page you can find the example usage for org.jfree.chart.axis LogarithmicAxis setUpperBound.

Prototype

public void setUpperBound(double max) 

Source Link

Document

Sets the upper bound for the axis range, and sends an AxisChangeEvent to all registered listeners.

Usage

From source file:org.squale.squaleweb.util.graph.ScatterMaker.java

/**
 * Construit (ou reconstruit) le diagramme puis le retourne
 * //from www .java 2 s .co m
 * @return le diagramme JFreeChart.
 */
protected JFreeChart getChart() {
    LOG.debug(WebMessages.getString("method.entry"));
    JFreeChart retChart = super.getChart();
    if (null == retChart) {
        // Gnration du Scatterplot
        retChart = ChartFactory.createScatterPlot(mTitle, mXLabel, mYLabel, mDataSet, PlotOrientation.VERTICAL,
                mShowLegend, false, false);
        ValueAxis domainAxis = retChart.getXYPlot().getDomainAxis();
        ValueAxis rangeAxis = retChart.getXYPlot().getRangeAxis();

        // Dtermination des bornes en abscisse et en ordonne
        double maxDomain = Math.max(domainAxis.getUpperBound(),
                DEFAULT_VERTICAL_AXIS_POS + DEFAULT_AXIS_MARGIN);
        double minDomain = Math.min(domainAxis.getLowerBound(),
                DEFAULT_VERTICAL_AXIS_POS - DEFAULT_AXIS_MARGIN);
        double maxRange = Math.max(rangeAxis.getUpperBound(),
                DEFAULT_HORIZONTAL_AXIS_POS + DEFAULT_AXIS_MARGIN);
        double minRange = Math.min(rangeAxis.getLowerBound(),
                DEFAULT_HORIZONTAL_AXIS_POS - DEFAULT_AXIS_MARGIN);

        // Mise  l'chelle logarithmique des axes
        LogarithmicAxis newDomainAxis = new LogarithmicAxis(domainAxis.getLabel());
        LogarithmicAxis newRangeAxis = new LogarithmicAxis(rangeAxis.getLabel());

        // Affectation des bornes en abscisse et en ordonne
        newDomainAxis.setLowerBound(minDomain);
        newDomainAxis.setUpperBound(maxDomain);
        newRangeAxis.setLowerBound(minRange);
        newRangeAxis.setUpperBound(maxRange);
        retChart.getXYPlot().setDomainAxis(newDomainAxis);
        retChart.getXYPlot().setRangeAxis(newRangeAxis);

        // Le point a une taille fixe
        Shape shape = new Rectangle(DEFAULT_POINT_SIZE, DEFAULT_POINT_SIZE);
        retChart.getXYPlot().getRenderer().setShape(shape);

        // Annotations
        XYLineAnnotation horizontalAxis = new XYLineAnnotation(minDomain, DEFAULT_HORIZONTAL_AXIS_POS,
                maxDomain, DEFAULT_HORIZONTAL_AXIS_POS);
        XYLineAnnotation verticalAxis = new XYLineAnnotation(DEFAULT_VERTICAL_AXIS_POS, minRange,
                DEFAULT_VERTICAL_AXIS_POS, maxRange);
        retChart.getXYPlot().addAnnotation(horizontalAxis);
        retChart.getXYPlot().addAnnotation(verticalAxis);

        super.setChart(retChart);
    }
    LOG.debug(WebMessages.getString("method.exit"));
    return retChart;
}

From source file:org.squale.squaleweb.util.graph.BubbleMaker.java

/**
 * Factorisation du code commun  la gnration du graphe
 * /*from  w  w  w .j  ava  2  s .  c o m*/
 * @return graphe de type Bubble
 */
private JFreeChart getCommonChart() {
    // Cration du graphe de type Bubble
    JFreeChart chart = ChartFactory.createBubbleChart(mTitle, mXLabel, mYLabel, mDataSet,
            PlotOrientation.VERTICAL, mShowLegend, true, false);

    ValueAxis domainAxis = chart.getXYPlot().getDomainAxis();
    ValueAxis rangeAxis = chart.getXYPlot().getRangeAxis();

    // Dtermination des bornes en abscisse et en ordonne
    double maxDomain = Math.max(domainAxis.getUpperBound(), DEFAULT_VERTICAL_AXIS_POS + DEFAULT_AXIS_MARGIN)
            + 1;
    double minDomain = 0;
    double maxRange = Math.max(rangeAxis.getUpperBound(), DEFAULT_HORIZONTAL_AXIS_POS + DEFAULT_AXIS_MARGIN)
            + 1;
    double minRange = 0;

    // Mise  l'chelle logarithmique des axes
    LogarithmicAxis newDomainAxis = new LogarithmicAxis(domainAxis.getLabel());
    LogarithmicAxis newRangeAxis = new LogarithmicAxis(rangeAxis.getLabel());

    // Affectation des bornes en abscisse et en ordonne
    newDomainAxis.setLowerBound(minDomain);
    newDomainAxis.setUpperBound(maxDomain);
    newRangeAxis.setLowerBound(minRange);
    newRangeAxis.setUpperBound(maxRange);
    chart.getXYPlot().setDomainAxis(newDomainAxis);
    chart.getXYPlot().setRangeAxis(newRangeAxis);

    // Affichage de la rpartition des mthodes selon les critres
    displayRepartitionSubtitles(chart);

    // Annotations
    XYLineAnnotation horizontalAxis = new XYLineAnnotation(minDomain, DEFAULT_HORIZONTAL_AXIS_POS, maxDomain,
            DEFAULT_HORIZONTAL_AXIS_POS);
    XYLineAnnotation verticalAxis = new XYLineAnnotation(DEFAULT_VERTICAL_AXIS_POS, minRange,
            DEFAULT_VERTICAL_AXIS_POS, maxRange);

    chart.getXYPlot().addAnnotation(horizontalAxis);
    chart.getXYPlot().addAnnotation(verticalAxis);
    return chart;
}