Example usage for java.awt BasicStroke JOIN_ROUND

List of usage examples for java.awt BasicStroke JOIN_ROUND

Introduction

In this page you can find the example usage for java.awt BasicStroke JOIN_ROUND.

Prototype

int JOIN_ROUND

To view the source code for java.awt BasicStroke JOIN_ROUND.

Click Source Link

Document

Joins path segments by rounding off the corner at a radius of half the line width.

Usage

From source file:edu.ucla.stat.SOCR.chart.demo.SOCR_EM_MixtureModelChartDemo.java

public void init() {
    CLEAR_BUTTON = false;/*from w w  w.ja v a  2  s  .co m*/
    LEGEND_SWITCH = false;
    //DefaultDrawingSupplier supplier = new DefaultDrawingSupplier();
    DrawingSupplier supplier = new DefaultDrawingSupplier(DefaultDrawingSupplier.DEFAULT_PAINT_SEQUENCE,
            DefaultDrawingSupplier.DEFAULT_OUTLINE_PAINT_SEQUENCE,
            DefaultDrawingSupplier.DEFAULT_STROKE_SEQUENCE,
            DefaultDrawingSupplier.DEFAULT_OUTLINE_STROKE_SEQUENCE,
            DefaultDrawingSupplier.DEFAULT_SHAPE_SEQUENCE);
    //series_shapes = supplier.createStandardSeriesShapes();

    //color_mainGroup = supplier.getNextPaint(); //moved to EM
    for (int i = 0; i < 10; i++) {
        //color_kernels[i] = supplier.getNextPaint();
        //series_strokes[i] = supplier.getNextStroke();
        series_shapes[i] = supplier.getNextShape();
    }

    series_strokes[0] = new BasicStroke(1.0f, BasicStroke.CAP_SQUARE, BasicStroke.JOIN_BEVEL);

    series_strokes[1] = new BasicStroke(2.0f, BasicStroke.CAP_SQUARE, BasicStroke.JOIN_BEVEL);

    series_strokes[2] = new BasicStroke(3.0f, BasicStroke.CAP_SQUARE, BasicStroke.JOIN_BEVEL);

    series_strokes[3] = new BasicStroke(1.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, 1.0f,
            new float[] { 10.0f, 6.0f }, 0.0f);
    series_strokes[4] = new BasicStroke(2.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, 1.0f,
            new float[] { 10.0f, 6.0f }, 0.0f);

    series_strokes[5] = new BasicStroke(3.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, 1.0f,
            new float[] { 10.0f, 6.0f }, 0.0f);
    series_strokes[6] = new BasicStroke(1.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, 1.0f,
            new float[] { 6.0f, 6.0f }, 0.0f);
    series_strokes[7] = new BasicStroke(2.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, 1.0f,
            new float[] { 6.0f, 6.0f }, 0.0f);
    series_strokes[8] = new BasicStroke(3.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, 1.0f,
            new float[] { 6.0f, 6.0f }, 0.0f);

    series_strokes[9] = new BasicStroke(2.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, 1.0f,
            new float[] { 2.0f, 6.0f }, 0.0f);

    controlPanel = new JPanel();
    modelAllSelected = TOGETHER;
    num_series = 1;
    mEMexperiment = new MixtureEMExperiment[num_series];
    mEMexperiment[0] = new MixtureEMExperiment();
    resultsTables = new CustomJTable[num_series];
    resultsTables[0] = mEMexperiment[0].getResultsTable();

    initControlPanel();
    //initResutlsTable();
    SHOW_STATUS_TEXTAREA = false;

    super.init();

    indLabel = new JLabel("X");
    depLabel = new JLabel("Y");

    mEMexperiment[0].resetSize();

    packControlArea();
}

From source file:edu.unibonn.plotting.TimeSeriesPlotter_Sensors.java

private JFreeChart createChart(final XYDataset dataset, final XYDataset dataset_centroids,
        ArrayList<Cluster_KMeans> clusters) {
    final JFreeChart chart = ChartFactory.createTimeSeriesChart("Sensors", "Time", "Erlang", dataset, false, //t
            true, //t
            false //f
    );/*from  w  w w .jav  a2 s .c om*/

    ChartUtilities.applyCurrentTheme(chart);

    //chart.setBackgroundPaint(Color.white);

    //        final StandardLegend sl = (StandardLegend) chart.getLegend();
    //        sl.setDisplaySeriesShapes(true);

    final XYPlot plot = chart.getXYPlot();
    plot.setBackgroundPaint(Color.WHITE);
    plot.setDomainGridlinePaint(Color.white);
    plot.setRangeGridlinePaint(Color.white);
    //        plot.setAxisOffset(new Spacer(Spacer.ABSOLUTE, 5.0, 5.0, 5.0, 5.0));
    plot.setDomainCrosshairVisible(true);
    plot.setRangeCrosshairVisible(true);

    final XYItemRenderer renderer = plot.getRenderer();

    if (renderer instanceof StandardXYItemRenderer) {
        final StandardXYItemRenderer rr = (StandardXYItemRenderer) renderer;
        //rr.setPlotShapes(true);
        rr.setShapesFilled(true);
        rr.setItemLabelsVisible(true);
    }

    int temp_count = 0;

    //for (int i = 0; i < clusters.size(); i++)
    for (int i = 0; (i < 11) && (i < clusters.size()); i++) {
        Cluster_KMeans current_cluster = clusters.get(i);
        ArrayList<Sensor> member_time_series = current_cluster.getMembership();

        for (int j = 0; j < member_time_series.size(); j++) {
            renderer.setSeriesPaint(j + temp_count, getColor(i));
        }
        temp_count = temp_count + member_time_series.size();
    }

    final DateAxis axis = (DateAxis) plot.getDomainAxis();
    axis.setDateFormatOverride(new SimpleDateFormat("HH:mm"));

    //final ValueAxis axis_y = plot.getRangeAxis();
    //axis_y.setRange(0, 20);

    plot.setDataset(1, dataset_centroids);
    plot.setRenderer(1, new StandardXYItemRenderer());

    for (int i = 0; (i < clusters.size()); i++) {
        //plot.getRenderer(1).setSeriesPaint(i, getColor(i));
        plot.getRenderer(1).setSeriesPaint(i, Color.BLACK);
        plot.getRenderer(1).setSeriesStroke(i, new BasicStroke(3.0f, BasicStroke.CAP_ROUND,
                BasicStroke.JOIN_ROUND, 1.0f, new float[] { 10.0f, 6.0f }, 0.0f));
    }

    plot.setDatasetRenderingOrder(DatasetRenderingOrder.FORWARD);

    return chart;
}

From source file:mil.tatrc.physiology.biogears.verification.ScenarioPlotTool.java

public void createGraph(String toDir, Paint color, String title, String XAxisLabel, String YAxisLabel,
        XYSeries... xyData) {/*from w w  w  .j  a  v  a2 s.com*/
    new File(toDir).mkdir();

    Log.info("Creating Graph " + toDir + title);
    double resMin0 = 1.e6;
    double resMax0 = -1.e6;
    double resMin1 = 1.e6;
    double resMax1 = -1.e6;

    XYSeriesCollection dataSet = new XYSeriesCollection();
    for (XYSeries data : xyData)
        dataSet.addSeries(data);

    JFreeChart chart = ChartFactory.createXYLineChart(title, // chart title
            XAxisLabel, // x axis label
            YAxisLabel, // y axis label
            dataSet, // data
            PlotOrientation.VERTICAL, // orientation
            true, // include legend
            true, // tooltips
            false // urls
    );

    XYPlot plot = (XYPlot) chart.getPlot();

    if (title.contains("Residual")) {
        // Make plot symmetric about x axis
        resMax0 = xyData[0].getMaxY();
        resMin0 = xyData[0].getMinY();
        if (Math.abs(xyData[0].getMinY()) > Math.abs(xyData[0].getMaxY()))
            resMax0 = Math.abs(resMin0);
        if (Math.abs(xyData[0].getMaxY()) > Math.abs(xyData[0].getMinY()))
            resMin0 = -1.0 * Math.abs(resMax0);
        if ((resMin0 == 0.0) && (resMax0 == 0.0)) {
            resMin0 = -0.00001;
            resMax0 = 0.00001;
        }
        ValueAxis yAxis = plot.getRangeAxis();
        yAxis.setRange(resMin0 + 0.05 * resMin0, resMax0 + 0.05 * resMax0);//5% buffer so we can see top and bottom clearly
    } else if (title.contains("Error")) {
        // Make plot symmetric about x axis
        resMax0 = xyData[0].getMaxY();
        resMin0 = xyData[0].getMinY();
        if ((resMin0 == 0.0) && (resMax0 == 0.0)) {
            resMin0 = -0.00001;
            resMax0 = 0.00001;
        }
        if (resMin0 >= 0.0)
            resMin0 = -0.01;
        ValueAxis yAxis = plot.getRangeAxis();
        yAxis.setRange(resMin0 + 0.05 * resMin0, resMax0 + 0.05 * resMax0);//5% buffer so we can see top and bottom clearly

        /*
         yAxis.setTickLabelPaint(new Color(1,0,0));
         yAxis.setTickMarkPaint(new Color(1,0,0));
         yAxis.setAxisLinePaint(new Color(1,0,0));
         yAxis.setLabelPaint(new Color(1,0,0));
                
         ValueAxis xAxis = plot.getDomainAxis();
         xAxis.setTickLabelPaint(new Color(1,0,0));
         xAxis.setTickMarkPaint(new Color(1,0,0));
         yAxis.setAxisLinePaint(new Color(1,0,0));
         yAxis.setLabelPaint(new Color(1,0,0));
         */
    } else {
        if (xyData.length > 1) {
            // Make plot symmetric about x axis
            resMax0 = xyData[0].getMaxY();
            resMin0 = xyData[0].getMinY();
            resMax1 = xyData[1].getMaxY();
            resMin1 = xyData[1].getMinY();
            if (resMin1 < resMin0)
                resMin0 = resMin1;
            if (resMax1 > resMax0)
                resMax0 = resMax1;
            if ((resMin0 == 0.0) && (resMax0 == 0.0)) {
                resMin0 = -0.00001;
                resMax0 = 0.00001;
            }
            if (resMin0 >= 0.0)
                resMin0 = -0.01;
            if (YAxisLabel.indexOf("PlasmaConcentration") > -1)
                plot.setRangeAxis(new LogarithmicAxis("Log(" + YAxisLabel + ")"));
            else {
                ValueAxis yAxis = plot.getRangeAxis();
                yAxis.setRange(resMin0 + 0.05 * resMin0, resMax0 + 0.05 * resMax0);//5% buffer so we can see top and bottom clearly
            }
        } else {
            // Make plot symmetric about x axis
            resMax0 = xyData[0].getMaxY();
            resMin0 = xyData[0].getMinY();
            if ((resMin0 == 0.0) && (resMax0 == 0.0)) {
                resMin0 = -0.00001;
                resMax0 = 0.00001;
            }
            if (resMin0 >= 0.0)
                resMin0 = -0.01;
            if (YAxisLabel.indexOf("PlasmaConcentration") > -1)
                plot.setRangeAxis(new LogarithmicAxis("Log(" + YAxisLabel + ")"));
            else {
                ValueAxis yAxis = plot.getRangeAxis();
                yAxis.setRange(resMin0 + 0.05 * resMin0, resMax0 + 0.05 * resMax0);//5% buffer so we can see top and bottom clearly
            }
        }
    }

    formatXYPlot(chart, color);
    //Changing line widths and colors
    XYItemRenderer r = plot.getRenderer();
    BasicStroke wideLine = new BasicStroke(lineWidth);
    r.setSeriesStroke(0, wideLine);
    r.setSeriesStroke(1, wideLine);
    XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer) plot.getRenderer();
    if (xyData.length > 1) {
        renderer.setSeriesStroke(//makes a dashed line
                0, //argument below float[]{I,K} -> alternates between solid and opaque (solid for I, opaque for K)
                new BasicStroke(lineWidth, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, 1.0f,
                        new float[] { 15.0f, 30.0f }, 0.0f));
        renderer.setDrawSeriesLineAsPath(true);
        renderer.setUseFillPaint(true);
    }
    renderer.setBaseShapesVisible(false);
    renderer.setSeriesFillPaint(0, expectedLineColor);
    renderer.setSeriesFillPaint(1, computedLineColor);
    renderer.setSeriesPaint(0, expectedLineColor);
    renderer.setSeriesPaint(1, computedLineColor);

    try {
        if (toDir == null || toDir.isEmpty())
            toDir = ".";
        File JPGFile = new File(toDir + "/" + StringUtils.removeParens(title) + ".jpg");
        ChartUtilities.saveChartAsJPEG(JPGFile, chart, 1600, 800);
    } catch (IOException e) {
        Log.error(e.getMessage());
    }
}

From source file:org.fhaes.fhrecorder.view.GraphSummaryOverlay.java

/**
 * This method creates the JFreeChart based on all of the incoming data sets.
 * /*from ww  w  .  ja  va  2 s . c  o  m*/
 * @param eventsDataset This is the data set corresponding to the events bar chart graph.
 * @param recordersDataset This is the data set corresponding to the recorders line graph.
 * @param samplesDataset This is the data set corresponding to the samples line graph.
 * @return This returns a JFreeChart with all 3 of the graphs described.
 */
private static JFreeChart createChart(final CategoryDataset eventsDataset,
        final CategoryDataset recordersDataset, final CategoryDataset samplesDataset) {

    final CategoryItemRenderer eventsRenderer = new BarRenderer();
    ((BarRenderer) eventsRenderer).setBarPainter(new StandardBarPainter()); // Remove shine
    ((BarRenderer) eventsRenderer).setShadowVisible(false);
    eventsRenderer.setSeriesPaint(0, new Color(224, 0, 51));
    eventsRenderer.setBaseToolTipGenerator(new StandardCategoryToolTipGenerator());

    final CategoryPlot plot = new CategoryPlot();
    plot.setDataset(eventsDataset);
    plot.setRenderer(eventsRenderer);

    plot.setDomainAxis(new CategoryAxis(""));
    plot.setRangeAxis(new NumberAxis(""));

    plot.setOrientation(PlotOrientation.VERTICAL);
    plot.setRangeGridlinesVisible(true);
    plot.setDomainGridlinesVisible(true);

    plot.setDomainAxis(new NumericCategoryAxis());

    plot.getDomainAxis().setTickLabelFont(new Font("SansSerif", Font.PLAIN, 12));

    final CategoryItemRenderer recorderRenderer = new LineAndShapeRenderer(true, false);
    recorderRenderer.setSeriesStroke(0, new BasicStroke(2.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND,
            1.0f, new float[] { 10.0f, 6.0f }, 0.0f));
    recorderRenderer.setSeriesPaint(0, new Color(102, 102, 255));
    recorderRenderer.setBaseToolTipGenerator(new StandardCategoryToolTipGenerator());

    // Temporarily removing recorders dataset
    // plot.setDataset(1, recordersDataset);
    // plot.setRenderer(1, recorderRenderer);

    final CategoryItemRenderer samplesRenderer = new LineAndShapeRenderer(true, false);
    samplesRenderer.setSeriesStroke(0, new BasicStroke(2.0f));
    samplesRenderer.setSeriesPaint(0, new Color(0, 153, 0));
    samplesRenderer.setBaseToolTipGenerator(new StandardCategoryToolTipGenerator());
    plot.setDataset(2, samplesDataset);
    plot.setRenderer(2, samplesRenderer);

    plot.setDatasetRenderingOrder(DatasetRenderingOrder.FORWARD);

    plot.getDomainAxis().setCategoryLabelPositions(CategoryLabelPositions.UP_90);
    plot.getDomainAxis().setLowerMargin(0.025);
    plot.getDomainAxis().setUpperMargin(0.025);

    final JFreeChart chart = new JFreeChart(plot);

    return chart;
}

From source file:edu.ucla.stat.SOCR.chart.demo.LineChartDemo5.java

protected JFreeChart createLegend(CategoryDataset dataset) {
    JFreeChart chart = ChartFactory.createLineChart(chartTitle, // chart title
            domainLabel, // domain axis label
            rangeLabel, // range axis label
            dataset, // data
            PlotOrientation.VERTICAL, // orientation
            true, // include legend
            true, // tooltips
            false // urls
    );/*from w ww.j a v  a2s.c o  m*/

    chart.setBackgroundPaint(Color.white);

    Shape[] shapes = new Shape[3];
    int[] xpoints;
    int[] ypoints;

    // right-pointing triangle
    xpoints = new int[] { -3, 3, -3 };
    ypoints = new int[] { -3, 0, 3 };
    shapes[0] = new Polygon(xpoints, ypoints, 3);

    // vertical rectangle
    shapes[1] = new Rectangle2D.Double(-2, -3, 3, 6);

    // left-pointing triangle
    xpoints = new int[] { -3, 3, 3 };
    ypoints = new int[] { 0, -3, 3 };
    shapes[2] = new Polygon(xpoints, ypoints, 3);

    DrawingSupplier supplier = new DefaultDrawingSupplier(DefaultDrawingSupplier.DEFAULT_PAINT_SEQUENCE,
            DefaultDrawingSupplier.DEFAULT_OUTLINE_PAINT_SEQUENCE,
            DefaultDrawingSupplier.DEFAULT_STROKE_SEQUENCE,
            DefaultDrawingSupplier.DEFAULT_OUTLINE_STROKE_SEQUENCE, shapes);
    CategoryPlot plot = chart.getCategoryPlot();
    plot.setOrientation(PlotOrientation.HORIZONTAL);
    plot.setBackgroundPaint(Color.lightGray);
    plot.setDomainGridlinePaint(Color.white);
    plot.setRangeGridlinePaint(Color.white);
    plot.setDrawingSupplier(supplier);

    // set the stroke for each series...
    plot.getRenderer().setSeriesStroke(0, new BasicStroke(2.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND,
            1.0f, new float[] { 10.0f, 6.0f }, 0.0f));
    plot.getRenderer().setSeriesStroke(1, new BasicStroke(2.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND,
            1.0f, new float[] { 6.0f, 6.0f }, 0.0f));
    plot.getRenderer().setSeriesStroke(2, new BasicStroke(2.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND,
            1.0f, new float[] { 2.0f, 6.0f }, 0.0f));

    // customise the renderer...
    LineAndShapeRenderer renderer = (LineAndShapeRenderer) plot.getRenderer();
    renderer.setBaseShapesVisible(true);
    renderer.setBaseItemLabelsVisible(true);
    renderer.setBaseItemLabelGenerator(new StandardCategoryItemLabelGenerator());
    renderer.setLegendItemLabelGenerator(new SOCRCategorySeriesLabelGenerator());
    return chart;

}

From source file:cs.stats.gui.StatsCharts.java

private ChartPanel createChart(String axisLabel, int type) {
    int width = (screenSize.width - (screenSize.width / 35));
    int height = (int) (screenSize.height - (screenSize.height / (double) 4));

    //int width = (screenSize.width - (screenSize.width / 35)) / 2;
    //int height = (int) (screenSize.height - (screenSize.height / (double) 4)) / 2;

    lastValue = new double[SUBPLOT_COUNT];
    //================= visualise standard chart ==========================
    CombinedDomainXYPlot combineddomainxyplot = new CombinedDomainXYPlot(new DateAxis("Time"));

    lastValue[0] = 100D;//from www.  j  a v  a2s.  c  o m
    TimeSeries timeseries = null;
    XYPlot xyplot = null;

    //add new timeseries to modularity row
    datasets[type] = new TimeSeriesCollection();

    NumberAxis numberaxis = new NumberAxis(axisLabel);
    numberaxis.setAutoRangeIncludesZero(true);

    //fast
    StandardXYItemRenderer xyItemRender = new StandardXYItemRenderer();
    //original
    //xyItemRender = new StandardXYItemRenderer();

    xyItemRender.setSeriesStroke(0,
            new BasicStroke(lineThickness, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, 0, null, 0));
    xyItemRender.setSeriesStroke(1,
            new BasicStroke(lineThickness, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, 0, null, 0));
    xyItemRender.setSeriesStroke(2,
            new BasicStroke(lineThickness, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, 0, null, 0));
    xyItemRender.setSeriesStroke(3,
            new BasicStroke(lineThickness, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, 0, null, 0));
    xyItemRender.setSeriesStroke(4,
            new BasicStroke(lineThickness, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, 0, null, 0));
    xyItemRender.setSeriesStroke(5,
            new BasicStroke(lineThickness, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, 0, null, 0));
    xyItemRender.setSeriesStroke(6,
            new BasicStroke(lineThickness, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, 0, null, 0));
    xyItemRender.setSeriesStroke(7,
            new BasicStroke(lineThickness, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, 0, null, 0));
    xyItemRender.setSeriesStroke(8,
            new BasicStroke(lineThickness, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, 0, null, 0));
    xyItemRender.setSeriesStroke(9,
            new BasicStroke(lineThickness, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, 0, null, 0));

    //TODO colours need to be defined statically before the renderer is created!
    xyplot = new XYPlot(datasets[type], null, numberaxis, xyItemRender);

    switch (type) {
    case 0: {
        xyItemRender.setSeriesPaint(0, Color.BLACK);
        timeseries = new TimeSeries("Reply rate 1.0", org.jfree.data.time.Hour.class);
        datasets[type].addSeries(timeseries);

        xyItemRender.setSeriesPaint(1, Color.BLUE);
        timeseries = new TimeSeries("Reply rate 0.9", org.jfree.data.time.Hour.class);
        datasets[type].addSeries(timeseries);

        xyItemRender.setSeriesPaint(2, Color.ORANGE);
        timeseries = new TimeSeries("Reply rate 0.8", org.jfree.data.time.Hour.class);
        datasets[type].addSeries(timeseries);

        xyItemRender.setSeriesPaint(3, Color.GREEN);
        timeseries = new TimeSeries("Reply rate 0.7", org.jfree.data.time.Hour.class);
        datasets[type].addSeries(timeseries);

        xyItemRender.setSeriesPaint(4, Color.MAGENTA);
        timeseries = new TimeSeries("Reply rate 0.6", org.jfree.data.time.Hour.class);
        datasets[type].addSeries(timeseries);

        xyItemRender.setSeriesPaint(5, Color.LIGHT_GRAY);
        timeseries = new TimeSeries("Reply rate 0.5", org.jfree.data.time.Hour.class);
        datasets[type].addSeries(timeseries);

        xyItemRender.setSeriesPaint(6, Color.YELLOW);
        timeseries = new TimeSeries("Reply rate 0.4", org.jfree.data.time.Hour.class);
        datasets[type].addSeries(timeseries);

        //            xyItemRender.setSeriesPaint(7, Color.PINK);
        //            timeseries = new TimeSeries("Reply rate 0.3", org.jfree.data.time.Hour.class);
        //            datasets[type].addSeries(timeseries);
        //
        //            xyItemRender.setSeriesPaint(8, Color.RED);
        //            timeseries = new TimeSeries("Reply rate 0.2", org.jfree.data.time.Hour.class);
        //            datasets[type].addSeries(timeseries);
        //
        //            xyItemRender.setSeriesPaint(9, Color.CYAN);
        //            timeseries = new TimeSeries("Reply rate 0.1", org.jfree.data.time.Hour.class);
        //            datasets[type].addSeries(timeseries);
    }
        break;
    case 1: {
        xyItemRender.setSeriesPaint(0, Color.BLACK);
        timeseries = new TimeSeries("0% of community users removed", org.jfree.data.time.Hour.class);
        datasets[type].addSeries(timeseries);

        xyItemRender.setSeriesPaint(1, Color.BLUE);
        timeseries = new TimeSeries("1% of community users removed", org.jfree.data.time.Hour.class);
        datasets[type].addSeries(timeseries);

        xyItemRender.setSeriesPaint(2, Color.ORANGE);
        timeseries = new TimeSeries("2% of community users removed", org.jfree.data.time.Hour.class);
        datasets[type].addSeries(timeseries);

        xyItemRender.setSeriesPaint(3, Color.GREEN);
        timeseries = new TimeSeries("3% of community users removed", org.jfree.data.time.Hour.class);
        datasets[type].addSeries(timeseries);

        xyItemRender.setSeriesPaint(4, Color.MAGENTA);
        timeseries = new TimeSeries("3.5% of community users removed", org.jfree.data.time.Hour.class);
        datasets[type].addSeries(timeseries);

        xyItemRender.setSeriesPaint(5, Color.LIGHT_GRAY);
        timeseries = new TimeSeries("4% of community users removed", org.jfree.data.time.Hour.class);
        datasets[type].addSeries(timeseries);

        xyItemRender.setSeriesPaint(6, Color.YELLOW);
        timeseries = new TimeSeries("4.5% of community users removed", org.jfree.data.time.Hour.class);
        datasets[type].addSeries(timeseries);

        xyItemRender.setSeriesPaint(7, Color.PINK);
        timeseries = new TimeSeries("5% of community users removed", org.jfree.data.time.Hour.class);
        datasets[type].addSeries(timeseries);

        xyItemRender.setSeriesPaint(8, Color.RED);
        timeseries = new TimeSeries("5.5% of community users removed", org.jfree.data.time.Hour.class);
        datasets[type].addSeries(timeseries);

        xyItemRender.setSeriesPaint(9, Color.CYAN);
        timeseries = new TimeSeries("6% of community users removed", org.jfree.data.time.Hour.class);
        datasets[type].addSeries(timeseries);
    }
        break;
    case 2: {
        xyItemRender.setSeriesPaint(0, Color.GRAY);
        timeseries = new TimeSeries("Average number of thread replies (per hour)",
                org.jfree.data.time.Hour.class);
        datasets[type].addSeries(timeseries);
    }
        break;
    case 3: {
        xyItemRender.setSeriesPaint(0, Color.GREEN);
        timeseries = new TimeSeries("New thread arrival activity change (%)", org.jfree.data.time.Hour.class);
        datasets[type].addSeries(timeseries);
        xyItemRender.setSeriesPaint(1, Color.BLUE);
        timeseries = new TimeSeries("Thread reply activity change (%)", org.jfree.data.time.Hour.class);
        datasets[type].addSeries(timeseries);
    }
        break;
    case 4: {
        xyItemRender.setSeriesPaint(0, Color.GREEN);
        timeseries = new TimeSeries("Mean thread aswer time", org.jfree.data.time.Hour.class);
        datasets[type].addSeries(timeseries);
    }
        break;
    }

    NumberAxis rangeAxis = (NumberAxis) xyplot.getRangeAxis();
    //rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    rangeAxis.setTickUnit(new NumberTickUnit(0.1));

    xyplot.setBackgroundPaint(Color.lightGray);
    xyplot.setDomainGridlinePaint(Color.white);
    xyplot.setRangeGridlinePaint(Color.white);
    combineddomainxyplot.add(xyplot);

    ChartPanel chart = null;

    switch (type) {
    case 0: {
        jfreechart1 = new JFreeChart("", combineddomainxyplot);
        LegendTitle legendtitle = (LegendTitle) jfreechart1.getSubtitle(0);

        //set legend fonts
        jfreechart1.getLegend(0).setItemFont(new Font("Italic", Font.PLAIN, 11));

        legendtitle.setPosition(RectangleEdge.BOTTOM);
        legendtitle.setMargin(new RectangleInsets(UnitType.ABSOLUTE, 0.0D, 4D, 0.0D, 4D));
        jfreechart1.setBorderPaint(Color.black);
        jfreechart1.setBorderVisible(true);
        jfreechart1.setBackgroundPaint(Color.white);
        combineddomainxyplot.setBackgroundPaint(Color.lightGray);
        combineddomainxyplot.setDomainGridlinePaint(Color.white);
        combineddomainxyplot.setRangeGridlinePaint(Color.white);
        combineddomainxyplot.setAxisOffset(new RectangleInsets(4D, 4D, 4D, 4D));

        valueAxis1 = combineddomainxyplot.getDomainAxis();

        dateAxis1 = (DateAxis) valueAxis1;
        dateAxis1.setTickUnit(new DateTickUnit(1, 1));

        if (scope1 == 0) {
            valueAxis1.setAutoRange(true);
        } else {
            valueAxis1.setFixedAutoRange(scope1);
        }

        chart = new ChartPanel(jfreechart1);
        chart.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
        //chart.add(buildPlotDisplayManagementPanel(valueAxis1, dateAxis1, ddlScope1));
        combineddomainxyplot.setInsets(new RectangleInsets(40, 25, 0, 10));
        chart.setPreferredSize(new Dimension(width, height));

        jfreechart1.setAntiAlias(false);
    }
        break;
    case 1: {

        jfreechart2 = new JFreeChart("", combineddomainxyplot);
        LegendTitle legendtitle = (LegendTitle) jfreechart2.getSubtitle(0);

        //set legend fonts
        jfreechart2.getLegend(0).setItemFont(new Font("Italic", Font.PLAIN, 11));

        legendtitle.setPosition(RectangleEdge.BOTTOM);
        legendtitle.setMargin(new RectangleInsets(UnitType.ABSOLUTE, 0.0D, 4D, 0.0D, 4D));
        jfreechart2.setBorderPaint(Color.black);
        jfreechart2.setBorderVisible(true);
        jfreechart2.setBackgroundPaint(Color.white);
        combineddomainxyplot.setBackgroundPaint(Color.lightGray);
        combineddomainxyplot.setDomainGridlinePaint(Color.white);
        combineddomainxyplot.setRangeGridlinePaint(Color.white);
        combineddomainxyplot.setAxisOffset(new RectangleInsets(4D, 4D, 4D, 4D));

        valueAxis2 = combineddomainxyplot.getDomainAxis();
        dateAxis2 = (DateAxis) valueAxis2;
        dateAxis2.setTickUnit(new DateTickUnit(1, 1));

        if (scope2 == 0) {
            valueAxis2.setAutoRange(true);
        } else {
            valueAxis2.setFixedAutoRange(scope2);
        }

        chart = new ChartPanel(jfreechart2);
        chart.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
        combineddomainxyplot.setInsets(new RectangleInsets(40, 25, 0, 10));
        chart.setPreferredSize(new Dimension(width, height));

        jfreechart2.setAntiAlias(false);
    }
        break;
    case 2: {

        jfreechart3 = new JFreeChart("", combineddomainxyplot);
        LegendTitle legendtitle = (LegendTitle) jfreechart3.getSubtitle(0);

        //set legend fonts
        jfreechart3.getLegend(0).setItemFont(new Font("Italic", Font.PLAIN, 11));

        legendtitle.setPosition(RectangleEdge.BOTTOM);
        legendtitle.setMargin(new RectangleInsets(UnitType.ABSOLUTE, 0.0D, 4D, 0.0D, 4D));
        jfreechart3.setBorderPaint(Color.black);
        jfreechart3.setBorderVisible(true);
        jfreechart3.setBackgroundPaint(Color.white);
        combineddomainxyplot.setBackgroundPaint(Color.lightGray);
        combineddomainxyplot.setDomainGridlinePaint(Color.white);
        combineddomainxyplot.setRangeGridlinePaint(Color.white);
        combineddomainxyplot.setAxisOffset(new RectangleInsets(4D, 4D, 4D, 4D));

        valueAxis3 = combineddomainxyplot.getDomainAxis();
        dateAxis3 = (DateAxis) valueAxis3;

        if (scope3 == 0) {
            valueAxis3.setAutoRange(true);
        } else {
            valueAxis3.setFixedAutoRange(scope3);
        }

        chart = new ChartPanel(jfreechart3);
        chart.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
        chart.add(buildPlotDisplayManagementPanel(valueAxis3, dateAxis3, ddlScope3));
        combineddomainxyplot.setInsets(new RectangleInsets(40, 25, 0, 10));
        chart.setPreferredSize(new Dimension(width, height));

        jfreechart3.setAntiAlias(false);
    }
        break;
    case 3: {
        jfreechart4 = new JFreeChart("", combineddomainxyplot);
        LegendTitle legendtitle = (LegendTitle) jfreechart4.getSubtitle(0);

        //set legend fonts
        jfreechart4.getLegend(0).setItemFont(new Font("Italic", Font.PLAIN, 11));

        legendtitle.setPosition(RectangleEdge.BOTTOM);
        legendtitle.setMargin(new RectangleInsets(UnitType.ABSOLUTE, 0.0D, 4D, 0.0D, 4D));
        jfreechart4.setBorderPaint(Color.black);
        jfreechart4.setBorderVisible(true);
        jfreechart4.setBackgroundPaint(Color.white);
        combineddomainxyplot.setBackgroundPaint(Color.lightGray);
        combineddomainxyplot.setDomainGridlinePaint(Color.white);
        combineddomainxyplot.setRangeGridlinePaint(Color.white);
        combineddomainxyplot.setAxisOffset(new RectangleInsets(4D, 4D, 4D, 4D));

        valueAxis4 = combineddomainxyplot.getDomainAxis();
        dateAxis4 = (DateAxis) valueAxis4;

        if (scope4 == 0) {
            valueAxis4.setAutoRange(true);
        } else {
            valueAxis4.setFixedAutoRange(scope4);
        }

        chart = new ChartPanel(jfreechart4);
        chart.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
        chart.add(buildPlotDisplayManagementPanel(valueAxis4, dateAxis4, ddlScope4));
        combineddomainxyplot.setInsets(new RectangleInsets(40, 25, 0, 10));
        chart.setPreferredSize(new Dimension(width, height));

        jfreechart4.setAntiAlias(false);
    }
        break;
    case 4: {
        jfreechart5 = new JFreeChart("", combineddomainxyplot);
        LegendTitle legendtitle = (LegendTitle) jfreechart5.getSubtitle(0);

        //set legend fonts
        jfreechart5.getLegend(0).setItemFont(new Font("Italic", Font.PLAIN, 11));

        legendtitle.setPosition(RectangleEdge.BOTTOM);
        legendtitle.setMargin(new RectangleInsets(UnitType.ABSOLUTE, 0.0D, 4D, 0.0D, 4D));
        jfreechart5.setBorderPaint(Color.black);
        jfreechart5.setBorderVisible(true);
        jfreechart5.setBackgroundPaint(Color.white);
        combineddomainxyplot.setBackgroundPaint(Color.lightGray);
        combineddomainxyplot.setDomainGridlinePaint(Color.white);
        combineddomainxyplot.setRangeGridlinePaint(Color.white);
        combineddomainxyplot.setAxisOffset(new RectangleInsets(4D, 4D, 4D, 4D));

        valueAxis5 = combineddomainxyplot.getDomainAxis();
        dateAxis5 = (DateAxis) valueAxis5;

        if (scope5 == 0) {
            valueAxis5.setAutoRange(true);
        } else {
            valueAxis5.setFixedAutoRange(scope5);
        }

        chart = new ChartPanel(jfreechart5);
        chart.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
        chart.add(buildPlotDisplayManagementPanel(valueAxis5, dateAxis5, ddlScope5));
        combineddomainxyplot.setInsets(new RectangleInsets(40, 25, 0, 10));
        chart.setPreferredSize(new Dimension(width, height));

        jfreechart5.setAntiAlias(false);
    }
        break;
    }

    return chart;

}

From source file:cs.gui.stats.PerformanceStats.java

private ChartPanel createChart(String axisLabel, int type) {
    int width = (screenSize.width - (screenSize.width / 35));
    int height = (int) (screenSize.height - (screenSize.height / (double) 4));

    //int width = (screenSize.width - (screenSize.width / 35)) / 2;
    //int height = (int) (screenSize.height - (screenSize.height / (double) 4)) / 2;

    lastValue = new double[SUBPLOT_COUNT];
    //================= visualise standard chart ==========================
    CombinedDomainXYPlot combineddomainxyplot = new CombinedDomainXYPlot(new DateAxis("Time"));

    lastValue[0] = 100D;//w w w .  ja v a2 s . c  om
    TimeSeries timeseries = null;
    XYPlot xyplot = null;

    //add new timeseries to modularity row
    datasets[type] = new TimeSeriesCollection();

    NumberAxis numberaxis = new NumberAxis(axisLabel);
    numberaxis.setAutoRangeIncludesZero(true);

    //fast
    StandardXYItemRenderer xyItemRender = new StandardXYItemRenderer();
    //original
    //xyItemRender = new StandardXYItemRenderer();

    xyItemRender.setSeriesStroke(0,
            new BasicStroke(lineThickness, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, 0, null, 0));
    xyItemRender.setSeriesStroke(1,
            new BasicStroke(lineThickness, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, 0, null, 0));
    xyItemRender.setSeriesStroke(2,
            new BasicStroke(lineThickness, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, 0, null, 0));
    xyItemRender.setSeriesStroke(3,
            new BasicStroke(lineThickness, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, 0, null, 0));

    //TODO colours need to be defined statically before the renderer is created!
    xyplot = new XYPlot(datasets[type], null, numberaxis, xyItemRender);

    switch (type) {
    case 0: {
        xyItemRender.setSeriesPaint(0, Color.BLACK);
        timeseries = new TimeSeries("Number of existing threads", org.jfree.data.time.Hour.class);
        datasets[type].addSeries(timeseries);
        timeseries = new TimeSeries("Number of answered threads", org.jfree.data.time.Hour.class);
        datasets[type].addSeries(timeseries);
    }
        break;
    case 1: {
        xyItemRender.setSeriesPaint(0, Color.YELLOW);
        timeseries = new TimeSeries("Mean thread answer time (per day)", org.jfree.data.time.Hour.class);
        datasets[type].addSeries(timeseries);
    }
        break;
    case 2: {
        xyItemRender.setSeriesPaint(0, Color.GRAY);
        timeseries = new TimeSeries("Number of thread replies", org.jfree.data.time.Hour.class);
        datasets[type].addSeries(timeseries);
    }
        break;
    case 3: {
        xyItemRender.setSeriesPaint(0, Color.GREEN);
        timeseries = new TimeSeries("New thread arrival activity change (%)", org.jfree.data.time.Hour.class);
        datasets[type].addSeries(timeseries);
        xyItemRender.setSeriesPaint(1, Color.BLUE);
        timeseries = new TimeSeries("Thread reply activity change (%)", org.jfree.data.time.Hour.class);
        datasets[type].addSeries(timeseries);
    }
        break;
    case 4: {
        xyItemRender.setSeriesPaint(0, Color.GREEN);
        timeseries = new TimeSeries("Mean thread aswer time (per month)", org.jfree.data.time.Hour.class);
        datasets[type].addSeries(timeseries);
    }
        break;
    }

    NumberAxis rangeAxis = (NumberAxis) xyplot.getRangeAxis();
    rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());

    xyplot.setBackgroundPaint(Color.lightGray);
    xyplot.setDomainGridlinePaint(Color.white);
    xyplot.setRangeGridlinePaint(Color.white);
    combineddomainxyplot.add(xyplot);

    ChartPanel chart = null;

    switch (type) {
    case 0: {
        jfreechart1 = new JFreeChart("", combineddomainxyplot);
        LegendTitle legendtitle = (LegendTitle) jfreechart1.getSubtitle(0);

        //set legend fonts
        jfreechart1.getLegend(0).setItemFont(new Font("Italic", Font.PLAIN, 11));

        legendtitle.setPosition(RectangleEdge.BOTTOM);
        legendtitle.setMargin(new RectangleInsets(UnitType.ABSOLUTE, 0.0D, 4D, 0.0D, 4D));
        jfreechart1.setBorderPaint(Color.black);
        jfreechart1.setBorderVisible(true);
        jfreechart1.setBackgroundPaint(Color.white);
        combineddomainxyplot.setBackgroundPaint(Color.lightGray);
        combineddomainxyplot.setDomainGridlinePaint(Color.white);
        combineddomainxyplot.setRangeGridlinePaint(Color.white);
        combineddomainxyplot.setAxisOffset(new RectangleInsets(4D, 4D, 4D, 4D));

        valueAxis1 = combineddomainxyplot.getDomainAxis();
        dateAxis1 = (DateAxis) valueAxis1;

        if (scope1 == 0) {
            valueAxis1.setAutoRange(true);
        } else {
            valueAxis1.setFixedAutoRange(scope1);
        }

        chart = new ChartPanel(jfreechart1);
        chart.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
        chart.add(buildPlotDisplayManagementPanel(valueAxis1, dateAxis1, ddlScope1));
        combineddomainxyplot.setInsets(new RectangleInsets(40, 25, 0, 10));
        chart.setPreferredSize(new Dimension(width, height));

        jfreechart1.setAntiAlias(false);
    }
        break;
    case 1: {

        jfreechart2 = new JFreeChart("", combineddomainxyplot);
        LegendTitle legendtitle = (LegendTitle) jfreechart2.getSubtitle(0);

        //set legend fonts
        jfreechart2.getLegend(0).setItemFont(new Font("Italic", Font.PLAIN, 11));

        legendtitle.setPosition(RectangleEdge.BOTTOM);
        legendtitle.setMargin(new RectangleInsets(UnitType.ABSOLUTE, 0.0D, 4D, 0.0D, 4D));
        jfreechart2.setBorderPaint(Color.black);
        jfreechart2.setBorderVisible(true);
        jfreechart2.setBackgroundPaint(Color.white);
        combineddomainxyplot.setBackgroundPaint(Color.lightGray);
        combineddomainxyplot.setDomainGridlinePaint(Color.white);
        combineddomainxyplot.setRangeGridlinePaint(Color.white);
        combineddomainxyplot.setAxisOffset(new RectangleInsets(4D, 4D, 4D, 4D));

        valueAxis2 = combineddomainxyplot.getDomainAxis();
        dateAxis2 = (DateAxis) valueAxis2;

        if (scope2 == 0) {
            valueAxis2.setAutoRange(true);
        } else {
            valueAxis2.setFixedAutoRange(scope2);
        }

        chart = new ChartPanel(jfreechart2);
        chart.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
        chart.add(buildPlotDisplayManagementPanel(valueAxis2, dateAxis2, ddlScope2));
        combineddomainxyplot.setInsets(new RectangleInsets(40, 25, 0, 10));
        chart.setPreferredSize(new Dimension(width, height));

        jfreechart2.setAntiAlias(false);
    }
        break;
    case 2: {

        jfreechart3 = new JFreeChart("", combineddomainxyplot);
        LegendTitle legendtitle = (LegendTitle) jfreechart3.getSubtitle(0);

        //set legend fonts
        jfreechart3.getLegend(0).setItemFont(new Font("Italic", Font.PLAIN, 11));

        legendtitle.setPosition(RectangleEdge.BOTTOM);
        legendtitle.setMargin(new RectangleInsets(UnitType.ABSOLUTE, 0.0D, 4D, 0.0D, 4D));
        jfreechart3.setBorderPaint(Color.black);
        jfreechart3.setBorderVisible(true);
        jfreechart3.setBackgroundPaint(Color.white);
        combineddomainxyplot.setBackgroundPaint(Color.lightGray);
        combineddomainxyplot.setDomainGridlinePaint(Color.white);
        combineddomainxyplot.setRangeGridlinePaint(Color.white);
        combineddomainxyplot.setAxisOffset(new RectangleInsets(4D, 4D, 4D, 4D));

        valueAxis3 = combineddomainxyplot.getDomainAxis();
        dateAxis3 = (DateAxis) valueAxis3;

        if (scope3 == 0) {
            valueAxis3.setAutoRange(true);
        } else {
            valueAxis3.setFixedAutoRange(scope3);
        }

        chart = new ChartPanel(jfreechart3);
        chart.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
        chart.add(buildPlotDisplayManagementPanel(valueAxis3, dateAxis3, ddlScope3));
        combineddomainxyplot.setInsets(new RectangleInsets(40, 25, 0, 10));
        chart.setPreferredSize(new Dimension(width, height));

        jfreechart3.setAntiAlias(false);
    }
        break;
    case 3: {
        jfreechart4 = new JFreeChart("", combineddomainxyplot);
        LegendTitle legendtitle = (LegendTitle) jfreechart4.getSubtitle(0);

        //set legend fonts
        jfreechart4.getLegend(0).setItemFont(new Font("Italic", Font.PLAIN, 11));

        legendtitle.setPosition(RectangleEdge.BOTTOM);
        legendtitle.setMargin(new RectangleInsets(UnitType.ABSOLUTE, 0.0D, 4D, 0.0D, 4D));
        jfreechart4.setBorderPaint(Color.black);
        jfreechart4.setBorderVisible(true);
        jfreechart4.setBackgroundPaint(Color.white);
        combineddomainxyplot.setBackgroundPaint(Color.lightGray);
        combineddomainxyplot.setDomainGridlinePaint(Color.white);
        combineddomainxyplot.setRangeGridlinePaint(Color.white);
        combineddomainxyplot.setAxisOffset(new RectangleInsets(4D, 4D, 4D, 4D));

        valueAxis4 = combineddomainxyplot.getDomainAxis();
        dateAxis4 = (DateAxis) valueAxis4;

        if (scope4 == 0) {
            valueAxis4.setAutoRange(true);
        } else {
            valueAxis4.setFixedAutoRange(scope4);
        }

        chart = new ChartPanel(jfreechart4);
        chart.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
        chart.add(buildPlotDisplayManagementPanel(valueAxis4, dateAxis4, ddlScope4));
        combineddomainxyplot.setInsets(new RectangleInsets(40, 25, 0, 10));
        chart.setPreferredSize(new Dimension(width, height));

        jfreechart4.setAntiAlias(false);
    }
        break;
    case 4: {
        jfreechart5 = new JFreeChart("", combineddomainxyplot);
        LegendTitle legendtitle = (LegendTitle) jfreechart5.getSubtitle(0);

        //set legend fonts
        jfreechart5.getLegend(0).setItemFont(new Font("Italic", Font.PLAIN, 11));

        legendtitle.setPosition(RectangleEdge.BOTTOM);
        legendtitle.setMargin(new RectangleInsets(UnitType.ABSOLUTE, 0.0D, 4D, 0.0D, 4D));
        jfreechart5.setBorderPaint(Color.black);
        jfreechart5.setBorderVisible(true);
        jfreechart5.setBackgroundPaint(Color.white);
        combineddomainxyplot.setBackgroundPaint(Color.lightGray);
        combineddomainxyplot.setDomainGridlinePaint(Color.white);
        combineddomainxyplot.setRangeGridlinePaint(Color.white);
        combineddomainxyplot.setAxisOffset(new RectangleInsets(4D, 4D, 4D, 4D));

        valueAxis5 = combineddomainxyplot.getDomainAxis();
        dateAxis5 = (DateAxis) valueAxis5;

        if (scope5 == 0) {
            valueAxis5.setAutoRange(true);
        } else {
            valueAxis5.setFixedAutoRange(scope5);
        }

        chart = new ChartPanel(jfreechart5);
        chart.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
        chart.add(buildPlotDisplayManagementPanel(valueAxis5, dateAxis5, ddlScope5));
        combineddomainxyplot.setInsets(new RectangleInsets(40, 25, 0, 10));
        chart.setPreferredSize(new Dimension(width, height));

        jfreechart5.setAntiAlias(false);
    }
        break;
    }

    return chart;

}

From source file:ch.agent.crnickl.demo.stox.Chart.java

private XYItemRenderer getLineRenderer() throws KeyedException {
    XYLineAndShapeRenderer lineRenderer = new XYLineAndShapeRenderer();
    lineRenderer.setDrawSeriesLineAsPath(true);
    lineRenderer.setSeriesStroke(0,/*from w w w  .  j a  v a 2 s.  c  om*/
            new BasicStroke(getStrokeWidth(), BasicStroke.CAP_SQUARE, BasicStroke.JOIN_ROUND));
    lineRenderer.setBaseShapesVisible(false);
    return lineRenderer;
}

From source file:edu.uchc.octane.OctaneWindowControl.java

/**
 * Draw trajectory overlay on images //w w  w . j  av  a 2 s . c  o m
 */
protected void drawOverlay() {
    if (!showOverlay_) {
        imp_.setOverlay(null);
        return;
    }
    GeneralPath path = new GeneralPath();
    for (int i = 0; i < dataset_.getSize(); i++) {
        Trajectory v = dataset_.getTrajectoryByIndex(i);
        if (v.marked) {
            // path.append(new Arc2D.Double(v.get(0).x-0.15,v.get(0).y,0.3,0.3,0,360,Arc2D.OPEN), false);
            path.moveTo(v.get(0).x, v.get(0).y);
            for (int j = 1; j < v.size(); j++) {
                path.lineTo(v.get(j).x, v.get(j).y);
            }
            // path.append(new Rectangle2D.Double(v.get(v.size()-1).x-0.15,v.get(v.size()-1).y-0.15,0.3,0.3), false);
        }
    }
    imp_.setOverlay(path, Color.yellow, new BasicStroke(0.1f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND));
}

From source file:com.vgi.mafscaling.VECalc.java

protected void createChart(JPanel plotPanel, String xAxisName, String yAxisName) {
    JFreeChart chart = ChartFactory.createScatterPlot(null, null, null, null, PlotOrientation.VERTICAL, false,
            true, false);/*w  ww  .  j  av  a2  s .c om*/
    chart.setBorderVisible(true);

    chartPanel = new ChartPanel(chart, true, true, true, true, true);
    chartPanel.setAutoscrolls(true);
    chartPanel.setMouseZoomable(false);

    GridBagConstraints gbl_chartPanel = new GridBagConstraints();
    gbl_chartPanel.anchor = GridBagConstraints.CENTER;
    gbl_chartPanel.insets = new Insets(3, 3, 3, 3);
    gbl_chartPanel.weightx = 1.0;
    gbl_chartPanel.weighty = 1.0;
    gbl_chartPanel.fill = GridBagConstraints.BOTH;
    gbl_chartPanel.gridx = 0;
    gbl_chartPanel.gridy = 1;
    plotPanel.add(chartPanel, gbl_chartPanel);

    XYLineAndShapeRenderer lineRenderer = new XYLineAndShapeRenderer();
    lineRenderer.setUseFillPaint(true);
    lineRenderer.setBaseToolTipGenerator(
            new StandardXYToolTipGenerator(StandardXYToolTipGenerator.DEFAULT_TOOL_TIP_FORMAT,
                    new DecimalFormat("0.00"), new DecimalFormat("0.00")));

    Stroke stroke = new BasicStroke(2.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, 1.0f, null, 0.0f);
    lineRenderer.setSeriesStroke(0, stroke);
    lineRenderer.setSeriesPaint(0, Color.RED);
    lineRenderer.setSeriesShape(0, ShapeUtilities.createDiamond((float) 2.5));

    lineRenderer.setLegendItemLabelGenerator(new StandardXYSeriesLabelGenerator() {
        private static final long serialVersionUID = 7593430826693873496L;

        public String generateLabel(XYDataset dataset, int series) {
            XYSeries xys = ((XYSeriesCollection) dataset).getSeries(series);
            return xys.getDescription();
        }
    });

    NumberAxis xAxis = new NumberAxis(xAxisName);
    xAxis.setAutoRangeIncludesZero(false);
    NumberAxis yAxis = new NumberAxis(yAxisName);
    yAxis.setAutoRangeIncludesZero(false);

    XYSeriesCollection lineDataset = new XYSeriesCollection();

    XYPlot plot = chart.getXYPlot();
    plot.setRangePannable(true);
    plot.setDomainPannable(true);
    plot.setDomainGridlinePaint(Color.DARK_GRAY);
    plot.setRangeGridlinePaint(Color.DARK_GRAY);
    plot.setBackgroundPaint(new Color(224, 224, 224));

    plot.setDataset(0, lineDataset);
    plot.setRenderer(0, lineRenderer);
    plot.setDomainAxis(0, xAxis);
    plot.setRangeAxis(0, yAxis);
    plot.mapDatasetToDomainAxis(0, 0);
    plot.mapDatasetToRangeAxis(0, 0);

    LegendTitle legend = new LegendTitle(plot.getRenderer());
    legend.setItemFont(new Font("Arial", 0, 10));
    legend.setPosition(RectangleEdge.TOP);
    chart.addLegend(legend);
}