List of usage examples for org.jfree.chart.axis LogarithmicAxis setLowerBound
public void setLowerBound(double min)
From source file:playground.thibautd.analysis.populationstats.PlotCliqueSizeDistribution.java
private static ChartUtil getHistogram(final List<Integer> sizes) { CountDataSet dataset = new CountDataSet(); dataset.addSeries("cliques", sizes); JFreeChart chart = ChartFactory.createHistogram(TITLE, XLABEL, YLABEL, dataset, PlotOrientation.VERTICAL, true, false, false);//from w w w . j a va 2 s .c om LogarithmicAxis axis = new LogarithmicAxis(YLABEL); axis.setAllowNegativesFlag(true); chart.getXYPlot().setRangeAxis(axis); axis.setLowerBound(0d); chart.getXYPlot().getDomainAxis().setLowerBound(0d); return new WrapperChartUtil(chart); }
From source file:org.squale.squaleweb.util.graph.ScatterMaker.java
/** * Construit (ou reconstruit) le diagramme puis le retourne * //ww w . j a va 2 s .c o 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 ww. ja v a 2s . 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; }