Example usage for org.jfree.chart.plot CombinedDomainXYPlot setRenderer

List of usage examples for org.jfree.chart.plot CombinedDomainXYPlot setRenderer

Introduction

In this page you can find the example usage for org.jfree.chart.plot CombinedDomainXYPlot setRenderer.

Prototype

@Override
public void setRenderer(XYItemRenderer renderer) 

Source Link

Document

Sets the item renderer FOR ALL SUBPLOTS.

Usage

From source file:com.compomics.cell_coord.gui.controller.computation.ComputationDataController.java

/**
 *
 * @param track//from  w ww . j  av a2s.c o  m
 */
private void plotCoordinatesTime(Track track) {
    Double[][] coordinates = track.getCoordinates();
    Double[][] transpose2DArray = ComputationUtils.transpose2DArray(coordinates);
    double[] timeIndexes = track.getTimeIndexes();
    double[] xCoordinates = ArrayUtils.toPrimitive(ComputationUtils.excludeNullValues(transpose2DArray[0]));
    XYSeries xtSeries = JFreeChartUtils.generateXYSeries(timeIndexes, xCoordinates);
    XYSeriesCollection xtSeriesCollection = new XYSeriesCollection(xtSeries);
    XYItemRenderer renderer = new StandardXYItemRenderer();
    NumberAxis xAxis = new NumberAxis("x");
    XYPlot xTPlot = new XYPlot(xtSeriesCollection, null, xAxis, renderer);
    NumberAxis yAxis = new NumberAxis("y");
    double[] yCoordinates = ArrayUtils.toPrimitive(ComputationUtils.excludeNullValues(transpose2DArray[1]));
    XYSeries ytSeries = JFreeChartUtils.generateXYSeries(timeIndexes, yCoordinates);
    XYSeriesCollection ytSeriesCollection = new XYSeriesCollection(ytSeries);
    XYPlot yTPlot = new XYPlot(ytSeriesCollection, null, yAxis, renderer);
    // domain axis
    NumberAxis domainAxis = new NumberAxis("time index");
    CombinedDomainXYPlot combinedDomainXYPlot = new CombinedDomainXYPlot(domainAxis);
    combinedDomainXYPlot.setRenderer(new XYLineAndShapeRenderer());
    combinedDomainXYPlot.add(xTPlot);
    combinedDomainXYPlot.add(yTPlot);
    combinedDomainXYPlot.setOrientation(PlotOrientation.VERTICAL);
    JFreeChart combinedChart = new JFreeChart("temp. evolution", combinedDomainXYPlot);
    ChartPanel chartPanel = new ChartPanel(combinedChart);
    computationDataPanel.getxYParentPanel().removeAll();
    computationDataPanel.getxYParentPanel().add(chartPanel, gridBagConstraints);
    computationDataPanel.getxYParentPanel().revalidate();
    computationDataPanel.getxYParentPanel().repaint();
}