private static JFreeChart createChart(XYDataset xydataset) {
   JFreeChart jfreechart =
       ChartFactory.createXYLineChart(
           "Line Chart Demo 2", "X", "Y", xydataset, PlotOrientation.VERTICAL, true, true, false);
   jfreechart.setBackgroundPaint(Color.white);
   XYPlot xyplot = (XYPlot) jfreechart.getPlot();
   xyplot.setBackgroundPaint(Color.lightGray);
   xyplot.setAxisOffset(new RectangleInsets(5D, 5D, 5D, 5D));
   xyplot.setDomainGridlinePaint(Color.white);
   xyplot.setRangeGridlinePaint(Color.white);
   XYLineAndShapeRenderer xylineandshaperenderer = (XYLineAndShapeRenderer) xyplot.getRenderer();
   xylineandshaperenderer.setBaseShapesVisible(true);
   xylineandshaperenderer.setBaseShapesFilled(true);
   NumberAxis numberaxis = (NumberAxis) xyplot.getRangeAxis();
   numberaxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
   return jfreechart;
 }
Exemple #2
0
  private static JFreeChart createChart(XYDataset xydataset) {
    JFreeChart jfreechart =
        ChartFactory.createXYLineChart(
            "Mälu hõivamine",
            "mälublokid",
            null,
            xydataset,
            PlotOrientation.VERTICAL,
            true,
            true,
            false);
    XYPlot xyplot = (XYPlot) jfreechart.getPlot();
    XYStepAreaRenderer xysteparearenderer = new XYStepAreaRenderer(2);
    xysteparearenderer.setBaseToolTipGenerator(new StandardXYToolTipGenerator());
    xysteparearenderer.setDefaultEntityRadius(6);
    xyplot.setRenderer(xysteparearenderer);
    XYPlot plot = (XYPlot) jfreechart.getPlot();
    ValueAxis range = plot.getRangeAxis();
    range.setVisible(false);

    return jfreechart;
  }
Exemple #3
0
 /** Creates fundamental diagram chart. */
 private JFreeChart makeFDChart() {
   updateFDSeries();
   XYSeriesCollection dataset = new XYSeriesCollection();
   dataset.addSeries(ffFD);
   dataset.addSeries(cFD);
   dataset.addSeries(cdFD);
   JFreeChart chart =
       ChartFactory.createXYLineChart(
           null, // chart title
           "Density (vpm)", // x axis label
           "Flow (vph)", // y axis label
           dataset, // data
           PlotOrientation.VERTICAL,
           false, // include legend
           false, // tooltips
           false // urls
           );
   XYPlot plot = (XYPlot) chart.getPlot();
   plot.getRenderer().setSeriesPaint(0, Color.GREEN);
   plot.getRenderer().setSeriesPaint(1, Color.RED);
   plot.getRenderer().setSeriesPaint(2, Color.BLUE);
   plot.getRenderer().setStroke(new BasicStroke(2));
   return chart;
 }