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:org.drugis.mtc.gui.results.ConvergencePlotsDialog.java

private JPanel createPanel() {
    final FormLayout layout = new FormLayout("pref:grow:fill", "p, 3dlu, p, 3dlu, p");
    final PanelBuilder builder = new PanelBuilder(layout);
    builder.setDefaultDialogBorder();/*from  w  w  w. j  a  va 2 s .  c  om*/
    final CellConstraints cc = new CellConstraints();

    final XYSeriesCollection datasetRhat = new XYSeriesCollection();
    final XYSeriesCollection datasetVhatVsW = new XYSeriesCollection();
    datasetRhat.addSeries(d_rHatSeries);
    datasetVhatVsW.addSeries(d_vHatSeries);
    datasetVhatVsW.addSeries(d_wSeries);
    final JFreeChart rHatChart = createRhatChart(datasetRhat);
    final JFreeChart vHatvsWChart = createVhatVsWChart(datasetVhatVsW);
    final ChartPanel chartPanelRhat = new ChartPanel(rHatChart);
    final ChartPanel chartPanelVhatVsW = new ChartPanel(vHatvsWChart);
    chartPanelRhat.setVisible(true);
    chartPanelVhatVsW.setVisible(true);

    final JProgressBar bar = new TaskProgressBar(d_task);

    builder.add(bar, cc.xy(1, 1));
    builder.add(chartPanelRhat, cc.xy(1, 3));
    builder.add(chartPanelVhatVsW, cc.xy(1, 5));
    return builder.getPanel();
}

From source file:org.easyrec.controller.StatisticsController.java

@Override
protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response)
        throws Exception {

    if (Security.isSignedIn(request)) {

        int tenant;
        int month;
        int year;
        boolean flot;

        String actionType = request.getParameter("actionType");
        try {/*from w w w  .  j av  a 2s . c om*/
            tenant = Integer.parseInt(request.getParameter("tenant"));
            month = Integer.parseInt(request.getParameter("month"));
            year = Integer.parseInt(request.getParameter("year"));
            flot = Integer.parseInt(request.getParameter("flot")) != 0;
        } catch (Exception e) {
            logger.warn(e);
            return null;
        }

        ModelAndView mav = new ModelAndView();
        XYSeriesCollection dataset = new XYSeriesCollection();
        FlotDataSet flotDataSet = new FlotDataSet();

        Calendar from = Calendar.getInstance();
        Calendar to = Calendar.getInstance();

        from.set(year, month, Calendar.getInstance().getActualMinimum(Calendar.DAY_OF_MONTH), 0, 0, 0);
        to.set(year, month, from.getActualMaximum(Calendar.DAY_OF_MONTH), 23, 59, 59);

        Integer actionTypeId = null;
        Integer assocTypeId = null;

        if (!Strings.isNullOrEmpty(actionType)) {
            if ("CLICKS_ON_RECS".equals(actionType))
                assocTypeId = 1001;
            else if ("CLICKS_ON_CHARTS".equals(actionType))
                assocTypeId = 998;
            else
                actionTypeId = typeMappingService.getIdOfActionType(tenant, actionType);
        }

        HashMap<Integer, HashMap<Integer, Integer>> actionBundleMap = statisticsDAO.getActionBundleMap(tenant,
                from.getTimeInMillis(), to.getTimeInMillis(), actionTypeId, assocTypeId);

        Iterator<Integer> iterator = actionBundleMap.keySet().iterator();

        while (iterator.hasNext()) {
            actionTypeId = iterator.next();
            if (actionTypeId == 1001)
                actionType = "clicks on recommendations";
            else if (actionTypeId == 998)
                actionType = "clicks on rankings";
            else
                actionType = typeMappingService.getActionTypeById(tenant, actionTypeId).toLowerCase()
                        + " actions";

            XYSeries xySeries = new XYSeries(actionType);
            FlotSeries flotSeries = new FlotSeries();
            flotSeries.setTitle(actionType);

            for (int i = 1; i <= 31; i++) {
                Integer y = actionBundleMap.get(actionTypeId).get(i);
                xySeries.add(i, y != null ? y : 0);
                flotSeries.add(i, y != null ? y : 0);
            }
            //mav.addObject("data",flotDataSet.toString());

            dataset.addSeries(xySeries);
            flotDataSet.add(flotSeries);
        }

        // create datapoints that are rendered in the clients browser
        // return array or html side that renders array
        if (flot) {
            boolean onlyData = (ServletUtils.getSafeParameter(request, "onlyData", 0) != 0);
            if (onlyData) {
                mav.setViewName("flot/dataOutput");
            } else {
                mav.setViewName("flot/flotPlot");
            }
            mav.addObject("data", flotDataSet.toString());
            mav.addObject("flotDataSet", flotDataSet.getData());
            mav.addObject("noActions", flotDataSet.getData().isEmpty());
            return mav;

            // create a png
        } else {
            JFreeChart action_chart = ChartFactory.createXYLineChart("", "actions", "days", dataset,
                    PlotOrientation.VERTICAL, true, // show legend
                    true, // show tooltips
                    false); // show urls

            XYPlot plot = action_chart.getXYPlot();

            ValueAxis axis = plot.getDomainAxis();
            axis.setRange(1, 31);
            plot.setDomainAxis(axis);

            BufferedImage bi = action_chart.createBufferedImage(300, 200);

            byte[] bytes = ChartUtilities.encodeAsPNG(bi);

            if (bytes != null & !flot) {
                OutputStream os = response.getOutputStream();
                response.setContentType("image/png");
                response.setContentLength(bytes.length);
                os.write(bytes);
                os.close();
            }
        }
        return null;

    } else {
        return Security.redirectHome(request, response);
    }

}

From source file:fungus.PeerRatioChartFrame.java

public PeerRatioChartFrame(String prefix) {
    simulationCycles = Configuration.getDouble(PAR_SIMULATION_CYCLES);
    this.setTitle("MycoNet Statistics Chart");
    graph = JungGraphObserver.getGraph();

    //data.add(-1,0);
    XYSeriesCollection dataset = new XYSeriesCollection();
    dataset.setAutoWidth(false);//from  w ww. j a va2  s  .  c  o m
    dataset.setIntervalWidth(simulationCycles);

    //averageUtilizationData = new XYSeries("Average Utilization");
    //dataset.addSeries(averageUtilizationData);
    //averageStableUtilizationData = new XYSeries("Avg Stable Util");
    //dataset.addSeries(averageStableUtilizationData);
    bulwarkRatioData = new XYSeries("Bulwark Ratio");
    dataset.addSeries(bulwarkRatioData);
    biomassRatioData = new XYSeries("Biomass Ratio");
    dataset.addSeries(biomassRatioData);
    hyphaRatioData = new XYSeries("Hypha Ratio");
    dataset.addSeries(hyphaRatioData);
    // stableHyphaRatioData = new XYSeries("Stable Hypha Ratio");
    // dataset.addSeries(stableHyphaRatioData);

    //XYSeriesCollection dataset;

    JFreeChart peerRatioChart = ChartFactory.createXYLineChart("Bulwark Metrics", "Cycle", "Peer State Ratio",
            dataset, PlotOrientation.VERTICAL, true, false, false);
    ChartPanel peerRatioChartPanel = new ChartPanel(peerRatioChart);

    XYPlot xyplot = peerRatioChart.getXYPlot();

    NumberAxis domainAxis = (NumberAxis) xyplot.getDomainAxis();
    NumberAxis rangeAxis = (NumberAxis) xyplot.getRangeAxis();
    domainAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    rangeAxis.setRange(0, 1);

    //chart.setBackgroundPaint(Color.white);
    //XYPlot plot = chart.getXYPlot();

    //        BufferedImage chartImage = chart.createBufferedImage(500,300);
    //        chartLabel = new JLabel();
    //chartLabel.setIcon(new ImageIcon(chartImage));

    Container contentPane = getContentPane();
    contentPane.setLayout(new BoxLayout(contentPane, BoxLayout.PAGE_AXIS));
    JPanel labelPane = new JPanel();
    labelPane.setLayout(new GridLayout(1, 1));
    //chartPane.setPreferredSize(new java.awt.Dimension(500, 300));
    JPanel buttonPane = new JPanel();
    buttonPane.setLayout(new BoxLayout(buttonPane, BoxLayout.LINE_AXIS));

    ////contentPane.add(labelPane,BorderLayout.PAGE_START);
    //contentPane.add(Box.createRigidArea(new Dimension(0,5)));
    contentPane.add(peerRatioChartPanel, BorderLayout.CENTER);
    //contentPane.add(Box.createRigidArea(new Dimension(0,5)));
    ////contentPane.add(buttonPane, BorderLayout.PAGE_END);

    //data = node.getHyphaData();
    //link = node.getHyphaLink();
    //mycocast = node.getMycoCast();

    setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);

    //chartPanel.add(chartLabel);

    /*JButton updateButton = new JButton("Refresh");
      ActionListener updater = new ActionListener() {
      public void actionPerformed(ActionEvent e) {
      refreshData();
      }
      };
      updateButton.addActionListener(updater);
            
      JButton closeButton = new JButton("Close");
      ActionListener closer = new ActionListener() {
      public void actionPerformed(ActionEvent e) {
      closeFrame();
      }
      };
      closeButton.addActionListener(closer);
            
      buttonPane.add(Box.createHorizontalGlue());
      buttonPane.add(updateButton);
      buttonPane.add(Box.createRigidArea(new Dimension(5,0)));
      buttonPane.add(closeButton);
      refreshData();
    */

    //JungGraphObserver.addChangeListener(this);

    this.pack();
    this.setVisible(true);
}

From source file:umontreal.iro.lecuyer.charts.XYListSeriesCollection.java

/**
 * Creates a new <TT>XYListSeriesCollection</TT> instance with an empty dataset.
 * /* w ww .  ja va 2  s .c om*/
 */
public XYListSeriesCollection() {
    renderer = new XYLineAndShapeRenderer(true, false);
    // ((XYLineAndShapeRenderer)renderer).setShapesVisible(false);
    seriesCollection = new XYSeriesCollection();
}

From source file:no.ntnu.mmfplanner.ui.graph.SaNpvChart.java

private void updateModel() {
    XYSeriesCollection dataset = new XYSeriesCollection();
    XYPlot plot = ((XYPlot) getChart().getPlot());
    XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer) plot.getRenderer();

    // the x=0 line
    XYSeries line = new XYSeries("");
    line.add(1.0, 0.0);// w  w w.j a v a2 s. c o  m
    line.add(project.getPeriods(), 0.0);
    dataset.addSeries(line);

    // adds the line plot for each mmf
    int[][] saNpvValues = project.getSaNpvTable();
    for (int mmfI = 0; mmfI < saNpvValues.length; mmfI++) {
        Mmf mmf = project.get(mmfI);
        XYSeries values = new XYSeries(mmf.getId() + ": " + mmf.getName());

        for (int period = 1; period <= saNpvValues[mmfI].length; period++) {
            values.add(period, saNpvValues[mmfI][period - 1]);
        }

        dataset.addSeries(values);
        renderer.setSeriesShapesVisible(mmfI + 1, false);
        renderer.setSeriesStroke(mmfI + 1, SERIES_STROKE);
        renderer.setSeriesPaint(mmfI + 1, CHART_COLOR[mmfI % CHART_COLOR.length]);
    }

    plot.setDataset(dataset);
}

From source file:gov.nih.nci.caintegrator.plots.kaplanmeier.JFreeChartIKMPlottermpl.java

public JFreeChart createKMPlot(Collection<GroupCoordinates> groupsToBePlotted, String title, String xAxisLabel,
        String yAxisLabel) {//from  w  w  w.  j a va2  s . co  m
    List<KMPlotPointSeriesSet> kmPlotSets = new ArrayList<KMPlotPointSeriesSet>(
            convertToKaplanMeierPlotPointSeriesSet(groupsToBePlotted));

    XYSeriesCollection finalDataCollection = new XYSeriesCollection();
    /*  Repackage all the datasets to go into the XYSeriesCollection */
    for (KMPlotPointSeriesSet dataSet : kmPlotSets) {
        finalDataCollection.addSeries(dataSet.getCensorPlotPoints());
        finalDataCollection.addSeries(dataSet.getProbabilityPlotPoints());

    }

    JFreeChart chart = ChartFactory.createXYLineChart("", xAxisLabel, yAxisLabel, finalDataCollection,
            PlotOrientation.VERTICAL, true, //legend
            true, //tooltips
            false//urls
    );
    XYPlot plot = (XYPlot) chart.getPlot();
    /*
     * Ideally the actual Renderer settings should have been created
     * at the survivalLength of iterating KaplanMeierPlotPointSeriesSets, adding them to the actual
     * Data Set that is going to be going into the Chart plotter.  But you have no idea how
     * they are going to be sitting in the Plot dataset so there is no guarantee that setting the
     * renderer based on a supposed index will actually work. In fact
     */

    XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer();
    for (int i = 0; i < finalDataCollection.getSeriesCount(); i++) {
        KMPlotPointSeries kmSeries = (KMPlotPointSeries) finalDataCollection.getSeries(i);

        if (kmSeries.getType() == KMPlotPointSeries.SeriesType.CENSOR) {
            renderer.setSeriesLinesVisible(i, false);
            renderer.setSeriesShapesVisible(i, true);
            renderer.setSeriesShape(i, getCensorShape());
        } else if (kmSeries.getType() == KMPlotPointSeries.SeriesType.PROBABILITY) {
            renderer.setSeriesLinesVisible(i, true);
            renderer.setSeriesShapesVisible(i, false);

        } else {
            //don't show this set as it is not a known type
            renderer.setSeriesLinesVisible(i, false);
            renderer.setSeriesShapesVisible(i, false);
        }
        renderer.setSeriesPaint(i, getKMSetColor(kmPlotSets, kmSeries.getKey(), kmSeries.getType()), true);
    }

    renderer.setToolTipGenerator(new StandardXYToolTipGenerator());
    renderer.setDefaultEntityRadius(6);
    plot.setRenderer(renderer);

    /* change the auto tick unit selection to integer units only... */
    NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
    rangeAxis.setStandardTickUnits(NumberAxis.createStandardTickUnits());

    /* OPTIONAL CUSTOMISATION COMPLETED. */
    rangeAxis.setAutoRange(true);
    rangeAxis.setRange(0.0, 1.0);

    /* set Title and Legend */
    chart.setTitle(title);
    createLegend(chart, kmPlotSets);

    return chart;
}

From source file:wm.edu.cs420.Data.ChartBuilder.java

/**
 * Creates a sample dataset.//from  w  w  w  .j  a v  a  2  s  .c o m
 * 
 * @return a sample dataset.
 */
public XYDataset createTestDataset() {

    final XYSeries series1 = new XYSeries("");
    series1.add(1.0, 1.0);
    series1.add(2.0, 4.0);
    series1.add(3.0, 3.0);
    series1.add(4.0, 5.0);
    series1.add(5.0, 5.0);
    series1.add(6.0, 7.0);
    series1.add(7.0, 7.0);
    series1.add(8.0, 8.0);

    final XYSeriesCollection dataset = new XYSeriesCollection();
    dataset.addSeries(series1);

    return dataset;

}

From source file:br.ufrgs.enq.jcosmo.test.VLEdiagrams.java

@SuppressWarnings("deprecation")
public JPanel calcEthTol() throws Exception {
    super.setTitle("P vs x1");
    double T = 60;
    setLayout(new BorderLayout());

    COSMOSACDataBase db = COSMOSACDataBase.getInstance();

    COSMOSACCompound comps[] = new COSMOSACCompound[2];
    comps[0] = db.getComp("ethanol");
    comps[1] = db.getComp("toluene");

    COSMOSAC cosmosac = new COSMOSAC();
    cosmosac.setComponents(comps);/*from ww  w  . ja  v  a 2  s.c  o  m*/

    cosmosac.setTemperature(T + 273.15);

    double[] x1 = new double[n];
    double[] x2 = new double[n];
    double[] gamma1 = new double[n];
    double[] gamma2 = new double[n];
    double[] z = new double[2];
    double[] lnGamma = new double[2];
    z[0] = 0.00;
    int j = 0;
    while (z[0] < 1.0001) {
        z[1] = 1 - z[0];
        x1[j] = z[0];
        x2[j] = z[1];
        cosmosac.setComposition(z);
        cosmosac.activityCoefficient(lnGamma);
        gamma1[j] = Math.exp(lnGamma[0]);
        gamma2[j] = Math.exp(lnGamma[1]);
        z[0] += 0.05;
        j++;
    }

    double[][] parAntoine = new double[3][3];
    parAntoine[0][0] = 16.8958;
    parAntoine[0][1] = 3795.17;
    parAntoine[0][2] = 230.918;
    parAntoine[1][0] = 13.9320;
    parAntoine[1][1] = 3056.96;
    parAntoine[1][2] = 217.625;

    double[] Psat = pSat(parAntoine, T);
    double[] P = calcPx(x1, x2, gamma1, gamma2, Psat);
    double[] y1 = calcY(x1, gamma1, Psat, P);

    XYPlot plot1;
    XYSeriesCollection dataset = new XYSeriesCollection();
    XYSeries liq = new XYSeries("liquid");
    XYSeries vap = new XYSeries("vapor");
    XYSeries raoult = new XYSeries("Raoult's Law");
    for (int i = 0; i < n; i++) {
        liq.add(x1[i], P[i]);
        vap.add(y1[i], P[i]);
    }
    raoult.add(0, Psat[1]);
    raoult.add(1, Psat[0]);
    dataset.addSeries(liq);
    dataset.addSeries(vap);
    dataset.addSeries(raoult);

    JFreeChart chart = ChartFactory.createXYLineChart(null, "Mole Fraction: x1, y1", "P/KPa", null,
            PlotOrientation.VERTICAL, true, true, false);
    plot1 = (XYPlot) chart.getPlot();
    plot1.getDomainAxis().setRange(new Range(0.0, 1.0));
    plot1.getRangeAxis().setRange(new Range(15.0, 50.0));

    plot1.setDataset(dataset);

    XYSplineRenderer r = new XYSplineRenderer();
    BasicStroke stroke = new BasicStroke(2f);
    r.setStroke(stroke);
    plot1.setRenderer(r);
    r.setBaseShapesVisible(false);

    ChartPanel chartPanel = new ChartPanel(chart);
    JPanel jp = new JPanel(new BorderLayout());
    jp.add(chartPanel);

    add(jp, BorderLayout.CENTER);
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    setSize(400, 500);

    return jp;
}

From source file:org.matsim.pt.counts.PtCountsSimRealPerHourGraph.java

/**
 * @param hour//  w  w  w  .  j a v  a2  s .c o m
 *            A value in 1..24, 1 for 0 a.m. to 1 a.m., 2 for 1 a.m. to 2
 *            a.m. ...
 */
@Override
public JFreeChart createChart(final int hour) {
    this.hour = hour;

    XYSeriesCollection dataset0 = new XYSeriesCollection();
    XYSeries series = new XYSeries("MATSim volumes");
    // easier to use another dataset
    XYSeriesCollection dataset_outliers = new XYSeriesCollection();
    XYSeries series_outliers = new XYSeries("MATSim outliers");

    CustomXYURLGenerator url_gen = new CustomXYURLGenerator();
    CustomXYToolTipGenerator tt_gen = new CustomXYToolTipGenerator();

    final ArrayList<String> urls = new ArrayList<String>();
    final ArrayList<String> tooltips = new ArrayList<String>();
    List<Comp> comps = new Vector<Comp>();

    Iterator<CountSimComparison> l_it = this.ccl_.iterator();
    // int elementCounter=0;
    while (l_it.hasNext()) {
        CountSimComparison cc = l_it.next();

        /*
         * values with simVal==0.0 or countVal==0.0 are drawn on the x==1
         * or/and y==1-line Such values are the result of a poor simulation
         * run, but they can also represent a valid result (closing summer
         * road during winter time)
         */
        if (cc.getHour() == hour) {
            // elementCounter++;
            double realVal = 1.0;
            double simVal = 1.0;
            if (cc.getCountValue() > 0.0 && cc.getSimulationValue() > 0.0) {
                realVal = cc.getCountValue();
                simVal = cc.getSimulationValue();
                series.add(realVal, simVal);
                comps.add(new Comp(realVal, "link" + cc.getId() + ".html",
                        "Link " + cc.getId() + "; " + "Count: " + realVal + ", Sim: " + simVal));
            } else {
                realVal = Math.max(1.0, cc.getCountValue());
                simVal = Math.max(1.0, cc.getSimulationValue());
                series_outliers.add(realVal, simVal);
            }

        } // if
    } // while
    dataset0.addSeries(series);
    dataset_outliers.addSeries(series_outliers);

    /*
     * first we have to sort the vector according to the rendering ordering
     * (which is the x value). REALLY??? After hours of searching no better
     * solution found! please help!
     */

    Collections.sort(comps, new MyComparator());

    for (Iterator<Comp> iter = comps.iterator(); iter.hasNext();) {
        Comp cp = iter.next();
        urls.add(cp.getURL());
        tooltips.add(cp.getTooltip());
    }

    url_gen.addURLSeries(urls);
    tt_gen.addToolTipSeries(tooltips);

    String title = "[" + this.countsType + "]\tVolumes " + (hour - 1) + ":00 - " + (hour) + ":00, Iteration: "
            + this.iteration_;
    this.setChartTitle(title);
    this.chart_ = ChartFactory.createXYLineChart(title, "Count Volumes [veh/h]", // x axis label
            "Sim Volumes [veh/h]", // y axis label
            dataset0, // data
            PlotOrientation.VERTICAL, false, // include legend
            true, // tooltips
            true // urls
    );
    XYPlot plot = this.chart_.getXYPlot();
    final LogarithmicAxis axis_x = new LogarithmicAxis("Count Volumes [veh/h]");
    final LogarithmicAxis axis_y = new LogarithmicAxis("Sim Volumes [veh/h]");
    axis_x.setAllowNegativesFlag(false);
    axis_y.setAllowNegativesFlag(false);

    // regular values
    XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer();
    renderer.setLinesVisible(false);
    renderer.setURLGenerator(url_gen);
    renderer.setSeriesPaint(0, Color.black);
    renderer.setSeriesToolTipGenerator(0, tt_gen);
    renderer.setSeriesShape(0, new Rectangle2D.Double(-1.5, -1.5, 3.0, 3.0));

    // outliers
    XYLineAndShapeRenderer renderer2 = new XYLineAndShapeRenderer();
    renderer2.setLinesVisible(false);
    renderer2.setSeriesPaint(0, Color.red);
    renderer2.setSeriesShape(0, new Ellipse2D.Double(-3.0, -3.0, 6.0, 6.0));

    // error band
    DefaultXYDataset dataset1 = new DefaultXYDataset();
    dataset1.addSeries("f1x", new double[][] { { 1.0, 10000.0 }, { 1.0, 10000.0 } });
    dataset1.addSeries("f2x", new double[][] { { 1.0, 10000.0 }, { 2.0, 20000.0 } });
    dataset1.addSeries("f05x", new double[][] { { 2.0, 10000.0 }, { 1.0, 5000.0 } });

    XYLineAndShapeRenderer renderer3 = new XYLineAndShapeRenderer();
    renderer3.setShapesVisible(false);
    renderer3.setSeriesPaint(0, Color.blue);
    renderer3.setSeriesPaint(1, Color.blue);
    renderer3.setSeriesPaint(2, Color.blue);
    renderer3.setBaseSeriesVisibleInLegend(false);
    renderer3.setSeriesItemLabelsVisible(0, true);
    renderer3.setSeriesItemLabelsVisible(1, false);
    renderer3.setSeriesItemLabelsVisible(2, false);

    XYTextAnnotation annotation0 = new XYTextAnnotation("2.0 count", 12000.0, 15500.0);
    annotation0.setFont(new Font("SansSerif", Font.BOLD, 11));
    plot.addAnnotation(annotation0);
    XYTextAnnotation annotation1 = new XYTextAnnotation("count", 13000.0, 10000.0);
    annotation1.setFont(new Font("SansSerif", Font.BOLD, 11));
    plot.addAnnotation(annotation1);
    XYTextAnnotation annotation2 = new XYTextAnnotation("0.5 count", 11000.0, 3500.0);
    annotation2.setFont(new Font("SansSerif", Font.BOLD, 11));
    plot.addAnnotation(annotation2);

    plot.setDomainAxis(axis_x);
    plot.setRangeAxis(axis_y);
    plot.setRenderer(0, renderer);

    plot.setRenderer(1, renderer2);
    plot.setDataset(1, dataset_outliers);

    plot.setRenderer(2, renderer3);
    plot.setDataset(2, dataset1);

    plot.getRangeAxis().setRange(1.0, 19000.0);
    plot.getDomainAxis().setRange(1.0, 19000.0);

    return this.chart_;
}

From source file:com.sciaps.view.SpectrometerStackPanel.java

/**
 * Creates new form SpecktrometerStackPanel
 *//*from  w w w .j  ava2s .  c o m*/
public SpectrometerStackPanel() {
    initComponents();

    regionPanels_ = new RegionsPanel(this);
    regionContainerPanel_.add(regionPanels_);

    specialRasterPanel_ = new SpecialRasterPanel();
    rasterSettingPanel_.add(specialRasterPanel_);

    xySeriesCollection_ = new XYSeriesCollection();
    jFreeChartPanel_ = new JFreeChartWrapperPanel();
    jFreeChartPanel_.populateSpectrumChartWithAbstractXYDataset(xySeriesCollection_, "Spectrum",
            "Wave Length(nm)", "Intensity");
    charDisplayPanel_.add(jFreeChartPanel_);

    chartMouseListener_ = new JFreeChartMouseListener(jFreeChartPanel_.getJFreeChart(),
            jFreeChartPanel_.getChartPanel(), regionPanels_);
    jFreeChartPanel_.getChartPanel().addChartMouseListener(chartMouseListener_);

    plot_ = jFreeChartPanel_.getJFreeChart().getXYPlot();
    XYSplineRenderer renderer = new XYSplineRenderer(5);

    StandardXYToolTipGenerator ttG = new StandardXYToolTipGenerator("{1}, {2}", new DecimalFormat("#0.00"),
            new DecimalFormat("#0.00"));
    renderer.setBaseToolTipGenerator(ttG);

    plot_.setRenderer(renderer);
    plot_.setBackgroundPaint(Color.WHITE);
    plot_.setDomainPannable(true);
    plot_.setRangePannable(true);

    plotSettingPanel_ = new PlotConfigPanel(plot_);
    chartRangeControlPanel_.add(plotSettingPanel_);

    shotCheckListPanel_ = new SpectrumShotPanel(this);
    shotListContainerPanel_.add(shotCheckListPanel_);

    spectrumAnalysisReportPanel_ = new SpectrumAnalysisReportPanel(this);
    analysisPanel_.add(spectrumAnalysisReportPanel_);

    // disable them by default
    shotListContainerPanel_.setVisible(false);
    rasterSettingPanel_.setVisible(false);
    regionContainerPanel_.setVisible(false);
    analysisPanel_.setVisible(false);
    jPanel6.setVisible(false);
}