Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  package eu.toolchain.perftests;
  
  import java.awt.Color;
  import java.awt.Stroke;
  import java.util.List;
  
 
 
 
 public class Charts {
     private static final Stroke LINE = new BasicStroke(2.0f);
 
     private static final Stroke DASHED = new BasicStroke(2.0f, .., 1.0f,
             new float[] { 6.0f, 6.0f }, 0.0f);
 
     private static final List<ColorCOLORS = ImmutableList.of(....,
             ......);
 
     private static ChartTheme currentTheme = new StandardChartTheme("JFree");
 
     public static final class Dataset {
         private final String yAxis;
         private final String xAxis;
         private final XYDataset dataset;
     }

    
Creates a chart.

Parameters:
dataset a dataset.
Returns:
A chart.
 
     public static JFreeChart createChart(String titleCollection<Datasetdatasets) {
         final XYPlot plot = new XYPlot();
 
         plot.setOrientation(.);
 
         int index = 0;
 
         for (final Dataset dataset : datasets) {
             final NumberAxis xAxis = new NumberAxis(dataset.xAxis);
             xAxis.setAutoRangeIncludesZero(false);
 
             final NumberAxis yAxis = new NumberAxis(dataset.yAxis);
 
             final StandardXYItemRenderer renderer = new StandardXYItemRenderer();
             renderer.setAutoPopulateSeriesPaint(false);
             renderer.setAutoPopulateSeriesStroke(false);
 
             renderer.setBaseShapesVisible(false);
             renderer.setBaseShapesFilled(false);
             renderer.setDrawSeriesLineAsPath(true);
             renderer.setBaseStroke();
 
             for (int i = 0; i < dataset.dataset.getSeriesCount(); i++)
                 renderer.setSeriesPaint(i.get(i % .size()));
 
             plot.setRangeAxis(indexxAxis);
             plot.setDomainAxis(indexyAxis);
             plot.setDataset(indexdataset.dataset);
             plot.setRenderer(indexrenderer);
 
             ++index;
         }
 
         final JFreeChart chart = new JFreeChart(title.plottrue);
 
         .apply(chart);
 
         return chart;
 
     }

    
Creates a panel for the demo (used by SuperDemo.java).

Returns:
A panel.
 
     public static ChartPanel createPanel(JFreeChart chart) {
         ChartPanel panel = new ChartPanel(chart);
         panel.setFillZoomRectangle(true);
         panel.setMouseWheelEnabled(true);
        return panel;
    }

    
Starting point for the demonstration application.
    public static void showChart(final String namefinal JFreeChart chart) {
        final ChartPanel chartPanel = createPanel(chart);
        final ApplicationFrame app = new ApplicationFrame(name);
        chartPanel.setPreferredSize(new java.awt.Dimension(1000, 600));
        app.setContentPane(chartPanel);
        app.pack();
        RefineryUtilities.centerFrameOnScreen(app);
        app.setVisible(true);
    }
New to GrepCode? Check out our FAQ X