Example usage for org.jfree.data.xy XYSeriesCollection XYSeriesCollection

List of usage examples for org.jfree.data.xy XYSeriesCollection XYSeriesCollection

Introduction

In this page you can find the example usage for org.jfree.data.xy XYSeriesCollection XYSeriesCollection.

Prototype

public XYSeriesCollection() 

Source Link

Document

Constructs an empty dataset.

Usage

From source file:cv.mikusher.freechart.XYLineChart.java

private XYDataset createDataset() {
    final XYSeries firefox = new XYSeries("Firefox");
    firefox.add(1.0, 1.0);/*from   w w  w . j  a va  2 s .  c  om*/
    firefox.add(2.0, 4.0);
    firefox.add(3.0, 3.0);
    final XYSeries chrome = new XYSeries("Chrome");
    chrome.add(1.0, 4.0);
    chrome.add(2.0, 5.0);
    chrome.add(3.0, 6.0);
    final XYSeries iexplorer = new XYSeries("InternetExplorer");
    iexplorer.add(3.0, 4.0);
    iexplorer.add(4.0, 5.0);
    iexplorer.add(5.0, 4.0);
    final XYSeriesCollection dataset = new XYSeriesCollection();
    dataset.addSeries(firefox);
    dataset.addSeries(chrome);
    dataset.addSeries(iexplorer);
    return dataset;
}

From source file:com.compomics.pepshell.view.statistics.CleavingProbabilityPane.java

@Override
public void setGraphData(PepshellProtein aPepshellProtein) {
    //obligatory checks
    if (aPepshellProtein != null && experiment.getProteins().contains(aPepshellProtein)) {
        if (aPepshellProtein != currentPepshellProtein) {
            //TODO: run this outside of the gui thread
            currentPepshellProtein = experiment.getProteins()
                    .get(experiment.getProteins().indexOf(aPepshellProtein));
            XYSeriesCollection xYSeriesCollection = new XYSeriesCollection();
            fillSeries(currentPepshellProtein).forEach(xYSeriesCollection::addSeries);
            JFreeChart CPDTchart = ChartFactory.createXYLineChart("probability of cleaving",
                    "aminoacids of " + currentPepshellProtein.getVisibleAccession(), "probability",
                    xYSeriesCollection, PlotOrientation.VERTICAL, false, true, false);
            prettifyChart(CPDTchart);/*from  w ww  .j  av  a 2  s  .  c om*/
            CPDTchart.getXYPlot().getRangeAxis().setLowerBound(cutoff - 0.05);
            for (int i = 0; i < CPDTchart.getXYPlot().getSeriesCount(); i++) {
                CPDTchart.getXYPlot().getRenderer().setSeriesStroke(i, new BasicStroke(5));
            }
            if (!aPepshellProtein.getDomains().isEmpty()) {
                CPDTchart.setBackgroundImageAlpha(0.18f);
                CPDTchart.getXYPlot().getDomainAxis().setRange(0,
                        aPepshellProtein.getProteinSequence().length());
                BufferedImage anImage = new BufferedImage(this.getHeight(), this.getWidth(),
                        BufferedImage.TYPE_INT_ARGB);
                for (FeatureWithLocation aDomain : aPepshellProtein.getDomains()) {
                    anImage.getGraphics().drawRect(aDomain.getStartPosition(), 0, aDomain.getEndPosition(),
                            this.getHeight());
                }
                CPDTchart.setBackgroundImage(anImage);
            }
            chart.setChart(CPDTchart);
        }
    } else {
        chart.setChart(null);
        this.getGraphics().drawString("missing data", 0, 0);
    }
}

From source file:org.matsim.core.utils.charts.XYLineChart.java

public XYLineChart(final String title, final String xAxisLabel, final String yAxisLabel,
        boolean isLogarithmicAxis) {
    super(title, xAxisLabel, yAxisLabel);
    this.isLogarithmicAxis = isLogarithmicAxis;
    this.dataset = new XYSeriesCollection();
    this.chart = createChart(title, xAxisLabel, yAxisLabel, this.dataset);
    addDefaultFormatting();//w  ww  . j av  a  2 s  .c  o m
}

From source file:com.artnaseef.jmeter.report.HitsPerSecondReport.java

@Override
public void onFeedStart(String uri, Properties reportProperties) throws Exception {
    this.feedUri = uri;

    this.extractReportProperties(reportProperties);

    this.chartSeries = new XYSeries("Hits");
    this.dataset = new XYSeriesCollection();
    this.hitsPerSecond = new TreeMap<Long, Long>();

    if (this.detailOutputFile != null) {
        this.detailFileWriter = new PrintStream(this.detailOutputFile);
    }/*from   ww w. j a  va2s.  c  om*/
}

From source file:playground.dgrether.linkanalysis.DgCountPerIterationGraph.java

public DgCountPerIterationGraph(ControlerConfigGroup controlerConfigGroup) {
    this.dataset = new XYSeriesCollection();
    this.controllerConfig = controlerConfigGroup;
}

From source file:sanger.team16.gui.genevar.eqtl.gene.RegionalPlot.java

private XYDataset createDataset(List<QTL> significances, List<QTL> insignificances) {
    XYSeriesCollection dataset = new XYSeriesCollection();

    this.addToDataset(dataset, significances);
    this.addToDataset(dataset, insignificances);

    return dataset;
}

From source file:cs.register.geraGrafico.java

private XYSeriesCollection datakda(List<partida> list1) {
    XYSeriesCollection data = new XYSeriesCollection();
    XYSeries ser = new XYSeries("kda");
    for (partida p : list1) {
        ser.add(list1.indexOf(p) + 1, (p.getKill() / p.getDeath()));
    }//  w ww  . j av  a 2s.c  o  m
    data.addSeries(ser);

    return data;
}

From source file:cloud.requestengine.ResponseTimeService.java

private XYDataset getDataset() {
    XYSeriesCollection dataSet = new XYSeriesCollection();
    dataSet.addSeries(series);
    return dataSet;
}

From source file:org.esa.s1tbx.insar.rcp.toolviews.insar_statistics.StatESDMeasure.java

public Component createPanel() {

    // Add the series to your data set
    dataset = new XYSeriesCollection();

    // Generate the graph
    chart = ChartFactory.createXYLineChart(TITLE, // Title
            XAXIS_LABEL, // x-axis Label
            YAXIS_LABEL, // y-axis Label
            dataset, // Dataset
            PlotOrientation.VERTICAL, // Plot Orientation
            true, // Show Legend
            true, // Use tooltips
            false // Configure chart to generate URLs?
    );//from ww  w  . j  a  v  a  2 s  . c o m

    chartPanel = new ChartPanel(chart);
    chartPanel.setPreferredSize(new java.awt.Dimension(500, 470));
    chartPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));

    panel = new JPanel(new BorderLayout());
    textarea = new JTextArea(EmptyMsg);
    panel.add(textarea, BorderLayout.NORTH);
    panel.add(chartPanel, BorderLayout.CENTER);
    setVisible(false);

    return panel;
}

From source file:be.vds.jtbdive.client.view.core.dive.profile.DiveProfileChartFactory.java

public static JFreeChart createDiveProfileChartPanel(DiveProfile diveProfile, Locale locale,
        LengthUnit lengthUnit) {// w w w  .  j a  va  2  s  .  com
    XYSeries depthSerie = new XYSeries(SERIE_DEPTH);
    XYSeriesCollection depthCollection = new XYSeriesCollection();
    depthCollection.addSeries(depthSerie);

    JFreeChart chart = ChartFactory.createXYAreaChart(null, getDomainLegend(locale),
            getRangeLegend(locale, lengthUnit), depthCollection, PlotOrientation.VERTICAL, false, true, false);
    XYPlot xyp = chart.getXYPlot();

    Paint p = new GradientPaint(0f, 0f, UIAgent.getInstance().getColorWaterBottom(), 200f, 200f,
            UIAgent.getInstance().getColorWaterSurface(), false);
    xyp.setBackgroundPaint(p);
    xyp.setDomainGridlinePaint(UIAgent.getInstance().getColorWaterGrid());
    xyp.setRangeGridlinePaint(UIAgent.getInstance().getColorWaterGrid());
    ((NumberAxis) xyp.getDomainAxis()).setNumberFormatOverride(new MinutesNumberFormat());

    XYAreaRenderer renderer0 = new XYAreaRenderer();
    renderer0.setOutline(true);
    renderer0.setBaseOutlinePaint(UIAgent.getInstance().getColorWaterBottom());

    Color baseColor = UIAgent.getInstance().getColorBaseBackground();
    renderer0.setSeriesPaint(0, new Color(baseColor.getRed(), baseColor.getGreen(), baseColor.getBlue(), 50));
    xyp.setRenderer(0, renderer0);

    int i = 1;

    XYSeriesCollection decoEntriesCollection = new XYSeriesCollection();
    XYSeries decoEntriesSerie = new XYSeries(SERIE_DECO_ENTRY);
    decoEntriesCollection.addSeries(decoEntriesSerie);
    XYLineAndShapeRenderer renderer2 = new XYLineAndShapeRenderer();
    renderer2.setSeriesLinesVisible(0, false);
    renderer2.setAutoPopulateSeriesShape(false);
    renderer2.setSeriesPaint(0, UIAgent.getInstance().getColorDecoEntries());
    renderer2.setBaseShape(DefaultDrawingSupplier.DEFAULT_SHAPE_SEQUENCE[SHAPE_DECO_ENTRY]);
    xyp.setDataset(i, decoEntriesCollection);
    xyp.setRenderer(i, renderer2);

    i++;
    XYSeriesCollection ascentTooFastCollection = new XYSeriesCollection();
    XYSeries ascentTooFastSerie = new XYSeries(SERIE_WARNING_ASCENT_TOO_FAST);
    ascentTooFastCollection.addSeries(ascentTooFastSerie);
    renderer2 = new XYLineAndShapeRenderer();
    renderer2.setSeriesLinesVisible(0, false);
    renderer2.setAutoPopulateSeriesShape(false);
    renderer2.setSeriesPaint(0, UIAgent.getInstance().getColorWarningAscentTooFast());
    renderer2.setBaseShape(DefaultDrawingSupplier.DEFAULT_SHAPE_SEQUENCE[SHAPE_ASCENT_TOO_FAST_WARNING]);
    xyp.setDataset(i, ascentTooFastCollection);
    xyp.setRenderer(i, renderer2);

    i++;
    XYSeriesCollection decoWarningCollection = new XYSeriesCollection();
    XYSeries decoWarningSerie = new XYSeries(SERIE_DECO_STOP);
    decoWarningCollection.addSeries(decoWarningSerie);
    renderer2 = new XYLineAndShapeRenderer();
    renderer2.setSeriesLinesVisible(0, false);
    renderer2.setAutoPopulateSeriesShape(false);
    renderer2.setSeriesPaint(0, UIAgent.getInstance().getColorWarningDecoCeiling());
    renderer2.setBaseShape(DefaultDrawingSupplier.DEFAULT_SHAPE_SEQUENCE[SHAPE_DECO_WARNING]);
    xyp.setDataset(i, decoWarningCollection);
    xyp.setRenderer(i, renderer2);

    i++;
    XYSeriesCollection remainBottomTimeCollection = new XYSeriesCollection();
    XYSeries remainBottomTimeSerie = new XYSeries(SERIE_REMAINING_BOTTOM_TIME);
    remainBottomTimeCollection.addSeries(remainBottomTimeSerie);
    renderer2 = new XYLineAndShapeRenderer();
    renderer2.setSeriesLinesVisible(0, false);
    renderer2.setAutoPopulateSeriesShape(false);
    renderer2.setSeriesPaint(0, UIAgent.getInstance().getColorWarningRemainingBottomTime());
    renderer2.setBaseShape(DefaultDrawingSupplier.DEFAULT_SHAPE_SEQUENCE[SHAPE_REMAINING_BOTTOM_TIME_WARNING]);
    xyp.setDataset(i, remainBottomTimeCollection);
    xyp.setRenderer(i, renderer2);

    Map<Double, Double> depthEntries = diveProfile.getDepthEntries();
    Set<Double> ascentWarning = diveProfile.getAscentWarnings();
    Set<Double> decoWarnings = diveProfile.getDecoCeilingWarnings();
    Set<Double> remainBottomTime = diveProfile.getRemainingBottomTimeWarnings();
    Set<Double> decoEntryTime = diveProfile.getDecoEntries();

    if (depthEntries.size() > 0 && depthEntries.get(0d) == null) {
        depthEntries.put(0d, 0d);
    }

    for (Double seconds : depthEntries.keySet()) {
        double d = UnitsAgent.getInstance().convertLengthFromModel(depthEntries.get(seconds), lengthUnit);
        depthSerie.add(seconds, Double.valueOf(d));
    }

    if (null != ascentWarning) {
        for (Double seconds : ascentWarning) {
            ascentTooFastSerie.add(seconds, depthEntries.get(seconds));
        }
    }

    if (null != decoWarnings) {
        for (Double seconds : decoWarnings) {
            decoWarningSerie.add(seconds, depthEntries.get(seconds));
        }
    }

    if (null != remainBottomTime) {
        for (Double seconds : remainBottomTime) {
            remainBottomTimeSerie.add(seconds, depthEntries.get(seconds));
        }
    }

    if (null != decoEntryTime) {
        for (Double seconds : decoEntryTime) {
            decoEntriesSerie.add(seconds, depthEntries.get(seconds));
        }
    }
    return chart;
}