Example usage for org.jfree.chart.block BlockBorder NONE

List of usage examples for org.jfree.chart.block BlockBorder NONE

Introduction

In this page you can find the example usage for org.jfree.chart.block BlockBorder NONE.

Prototype

BlockBorder NONE

To view the source code for org.jfree.chart.block BlockBorder NONE.

Click Source Link

Document

An empty border.

Usage

From source file:de.hs.mannheim.modUro.diagram.JCellcycletimeDiagram.java

protected JFreeChart createChart(XYDataset dataset, List<String> celltypes) {
    String title = "Cell cycle times";

    JFreeChart xyLineChart = ChartFactory.createXYLineChart(title, // title
            "t", // x-axis label
            "T", // y-axis label
            dataset);//w  w w .  j  a  v  a2s .c  o m

    String fontName = "Palatino";
    xyLineChart.getTitle().setFont(new Font(fontName, Font.BOLD, 18));

    XYPlot plot = (XYPlot) xyLineChart.getPlot();
    plot.setDomainPannable(true);
    plot.setRangePannable(true);
    plot.setDomainCrosshairVisible(true);
    plot.setRangeCrosshairVisible(true);
    plot.getDomainAxis().setLowerMargin(0.0);
    plot.getDomainAxis().setLabelFont(new Font(fontName, Font.BOLD, 14));
    plot.getDomainAxis().setTickLabelFont(new Font(fontName, Font.PLAIN, 12));
    plot.getRangeAxis().setLowerMargin(0.0);
    // plot.getRangeAxis().setRange(0.0, 1.01);
    plot.getRangeAxis().setLabelFont(new Font(fontName, Font.BOLD, 14));
    plot.getRangeAxis().setTickLabelFont(new Font(fontName, Font.PLAIN, 12));
    xyLineChart.getLegend().setItemFont(new Font(fontName, Font.PLAIN, 14));
    xyLineChart.getLegend().setFrame(BlockBorder.NONE);
    xyLineChart.getLegend().setHorizontalAlignment(HorizontalAlignment.CENTER);
    XYItemRenderer r = plot.getRenderer();

    // set the default stroke for all series
    int i = 0;
    for (String celltype : celltypes) {
        r.setSeriesPaint(i, CellTypeColor.getColor(celltype));
        i++;
    }
    return xyLineChart;
}

From source file:uk.ac.lkl.cram.ui.chart.AbstractChartMaker.java

/**
 * Apply some defaults to a chart, including background paint
 * and font.//from  ww w  .j  a va2  s  . com
 * @param chart the chart to which defaults should be applied
 */
private void setChartDefaults(JFreeChart chart) {
    Paint backgroundPaint = UIManager.getColor("InternalFrame.background");
    //Set the background colour of the chart
    chart.setBackgroundPaint(backgroundPaint);
    //Set the background colour of the plot to be the same as the chart
    Plot plot = chart.getPlot();
    plot.setBackgroundPaint(backgroundPaint);
    //No outline around the bars
    plot.setOutlineVisible(false);
    //Get the legend
    LegendTitle legend = chart.getLegend();
    //Set the font of the legend to be the same as the platform
    legend.setItemFont(UIManager.getFont("Label.font"));
    //Set the background colour of the legend to be the same as the platform
    legend.setBackgroundPaint(backgroundPaint);
    //No frame around the legend
    legend.setFrame(BlockBorder.NONE);
    //Locate the legend to the right of the chart
    legend.setPosition(RectangleEdge.RIGHT);
}

From source file:de.hs.mannheim.modUro.reader.JCellCountDiagram.java

protected JFreeChart createChart(XYDataset dataset, List<String> cellTypes) {
    String title = "Cell count";

    JFreeChart xyLineChart = ChartFactory.createXYLineChart(title, // title
            "t", // x-axis label
            "n", // y-axis label
            dataset);/*from   w w w  .j a v  a2  s. c  o  m*/

    String fontName = "Palatino";
    xyLineChart.getTitle().setFont(new Font(fontName, Font.BOLD, 18));

    XYPlot plot = (XYPlot) xyLineChart.getPlot();
    plot.setDomainPannable(true);
    plot.setRangePannable(true);
    plot.setDomainCrosshairVisible(true);
    plot.setRangeCrosshairVisible(true);
    plot.getDomainAxis().setLowerMargin(0.0);
    plot.getDomainAxis().setLabelFont(new Font(fontName, Font.BOLD, 14));
    plot.getDomainAxis().setTickLabelFont(new Font(fontName, Font.PLAIN, 12));
    plot.getRangeAxis().setLowerMargin(0.0);
    // plot.getRangeAxis().setRange(0.0, 1.01);
    plot.getRangeAxis().setLabelFont(new Font(fontName, Font.BOLD, 14));
    plot.getRangeAxis().setTickLabelFont(new Font(fontName, Font.PLAIN, 12));
    xyLineChart.getLegend().setItemFont(new Font(fontName, Font.PLAIN, 14));
    xyLineChart.getLegend().setFrame(BlockBorder.NONE);
    xyLineChart.getLegend().setHorizontalAlignment(HorizontalAlignment.CENTER);
    XYItemRenderer r = plot.getRenderer();
    // set the default stroke for all series
    int i = 0;
    for (String celltype : cellTypes) {
        r.setSeriesPaint(i, CellTypeColor.getColor(celltype));
        i++;
    }
    r.setSeriesPaint(i, Color.BLACK);
    return xyLineChart;
}

From source file:net.sf.mzmine.modules.peaklistmethods.alignment.ransac.AlignmentRansacPlot.java

public AlignmentRansacPlot() {
    super(null, true);

    dataset = new XYSeriesCollection();
    chart = ChartFactory.createXYLineChart("", null, null, dataset, PlotOrientation.VERTICAL, true, true,
            false);/*from  ww  w  . ja v a2  s  .co m*/

    chart.setBackgroundPaint(Color.white);
    setChart(chart);

    // title
    chartTitle = chart.getTitle();
    chartTitle.setMargin(5, 0, 0, 0);
    chartTitle.setFont(titleFont);

    // legend constructed by ChartFactory
    legend = chart.getLegend();
    legend.setItemFont(legendFont);
    legend.setFrame(BlockBorder.NONE);

    // set the plot properties
    plot = chart.getXYPlot();
    plot.setBackgroundPaint(Color.white);
    plot.setAxisOffset(new RectangleInsets(5.0, 5.0, 5.0, 5.0));
    plot.setDatasetRenderingOrder(DatasetRenderingOrder.FORWARD);

    // set grid properties
    plot.setDomainGridlinePaint(gridColor);
    plot.setRangeGridlinePaint(gridColor);

    // set crosshair (selection) properties

    plot.setDomainCrosshairVisible(true);
    plot.setRangeCrosshairVisible(true);
    plot.setDomainCrosshairPaint(crossHairColor);
    plot.setRangeCrosshairPaint(crossHairColor);
    plot.setDomainCrosshairStroke(crossHairStroke);
    plot.setRangeCrosshairStroke(crossHairStroke);

    // set default renderer properties
    XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer();
    renderer.setBaseLinesVisible(false);
    renderer.setBaseShapesVisible(true);
    renderer.setSeriesShape(0, dataPointsShape);
    renderer.setSeriesShape(1, dataPointsShape);
    renderer.setSeriesLinesVisible(2, true);
    renderer.setSeriesShapesVisible(2, false);
    renderer.setSeriesPaint(0, Color.RED);
    renderer.setSeriesPaint(1, Color.GRAY);
    renderer.setSeriesPaint(2, Color.BLUE);
    renderer.setBaseItemLabelPaint(labelsColor);

    plot.setRenderer(renderer);

}

From source file:com.googlecode.jchav.chart.MinMeanMaxChart.java

/**
 * Construct a new chart to display the given data.
 *
 * @param title The page id, used for the title of the chart.
 * @param data the data to plot.//from ww w.  jav  a  2 s  . c o m
 */
public MinMeanMaxChart(final String title, final SortedSet<Measurement> data) {
    // The renderer that does all the real work here:
    final MinMaxCategoryRenderer minMaxRenderer = new MinMaxCategoryRenderer();
    minMaxRenderer.setObjectIcon(new FilledCircle());

    // Munge the data into form JFreeChart can use:
    DefaultCategoryDataset dataset = new DefaultCategoryDataset();

    for (Measurement m : data) {
        // This ordering gives max=red, min=green, mean=blue
        dataset.addValue(m.getMaximumTime(), "max", m.getBuildId().getBuildName());
        dataset.addValue(m.getAverageTime(), "mean", m.getBuildId().getBuildName());
        dataset.addValue(m.getMinimumTime(), "min", m.getBuildId().getBuildName());
    }

    // Create the plot area:
    final CategoryPlot plot = new CategoryPlot();
    plot.setDataset(dataset);
    plot.setRenderer(minMaxRenderer);
    plot.setDomainAxis(new CategoryAxis("Build")); // TO DO: i18n
    plot.setRangeAxis(new NumberAxis("RT"));

    // Build labels running diagonally under the bars of the chart.
    plot.getDomainAxis().setCategoryLabelPositions(CategoryLabelPositions.UP_45);

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

    // the legend here would be the "min", "max", "mean" strings used when created int category data set.
    boolean showLegend = true;

    // Render the chart:
    JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT, plot, showLegend);
    chart.setTitle(title);
    chart.setBackgroundPaint(Color.WHITE);
    chart.setBorderVisible(false);

    if (showLegend) {
        chart.getLegend().setBorder(BlockBorder.NONE);
    }

    this.setChart(chart);

}

From source file:uk.ac.lkl.cram.ui.chart.TLALearningTypeChartFactory.java

private static JFreeChart createChart(PieDataset dataset) {
    //Create a pie chart from the chart factory with no title, a legend and no tooltips
    JFreeChart chart = ChartFactory.createPieChart(null, dataset, true, false, false);
    //Set the background colour of the chart
    Paint backgroundPaint = Color.white;
    chart.setBackgroundPaint(backgroundPaint);
    //Get the plot from the chart
    PiePlot plot = (PiePlot) chart.getPlot();
    //Set the background colour of the plot to be the same as the chart
    plot.setBackgroundPaint(backgroundPaint);
    //Remove shadows from the plot
    plot.setShadowXOffset(0);//from w  w  w .j  av a 2  s  .co  m
    plot.setShadowYOffset(0);
    //Remove the outline from the plot
    plot.setOutlineVisible(false);
    //Remove the labels from the plot
    plot.setLabelGenerator(null);
    //Set the colours for the segments
    plot.setSectionPaint(LearningTypeChartMaker.ACQUISITION, LearningTypeChartMaker.ACQUISITION_COLOR);
    plot.setSectionPaint(LearningTypeChartMaker.COLLABORATION, LearningTypeChartMaker.COLLABORATION_COLOR);
    plot.setSectionPaint(LearningTypeChartMaker.DISCUSSION, LearningTypeChartMaker.DISCUSSION_COLOR);
    plot.setSectionPaint(LearningTypeChartMaker.INQUIRY, LearningTypeChartMaker.INQUIRY_COLOR);
    plot.setSectionPaint(LearningTypeChartMaker.PRACTICE, LearningTypeChartMaker.PRACTICE_COLOR);
    plot.setSectionPaint(LearningTypeChartMaker.PRODUCTION, LearningTypeChartMaker.PRODUCTION_COLOR);
    //Get the legend from the chart
    LegendTitle legend = chart.getLegend();
    //Set the font of the legend to be the same as the platform UI
    legend.setItemFont(UIManager.getFont("Label.font"));
    //Set the background colour of the legend to be the same as the chart
    legend.setBackgroundPaint(backgroundPaint);
    //Remove the border from the legend
    legend.setFrame(BlockBorder.NONE);
    //Locate the legend to the right of the plot
    legend.setPosition(RectangleEdge.RIGHT);
    return chart;
}

From source file:org.jfree.chart.demo.BarChartDemo1.java

/**
 * Creates a sample chart.//  ww w  . ja v  a2s  .c o m
 *
 * @param dataset  the dataset.
 *
 * @return The chart.
 */
private static JFreeChart createChart(CategoryDataset dataset) {
    JFreeChart chart = ChartFactory.createBarChart("Performance: JFreeSVG vs Batik", null /* x-axis label*/,
            "Milliseconds" /* y-axis label */, dataset);
    chart.addSubtitle(
            new TextTitle("Time to generate 1000 charts in SVG " + "format (lower bars = better performance)"));
    chart.setBackgroundPaint(Color.white);
    CategoryPlot plot = (CategoryPlot) chart.getPlot();

    // ******************************************************************
    //  More than 150 demo applications are included with the JFreeChart
    //  Developer Guide...for more information, see:
    //
    //  >   http://www.object-refinery.com/jfreechart/guide.html
    //
    // ******************************************************************

    NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
    rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    BarRenderer renderer = (BarRenderer) plot.getRenderer();
    renderer.setDrawBarOutline(false);
    chart.getLegend().setFrame(BlockBorder.NONE);
    return chart;
}

From source file:ec.util.chart.swing.JTimeSeriesRendererSupportDemo.java

private static JFreeChart createTsChart() {
    XYPlot plot = new XYPlot();

    plot.setAxisOffset(RectangleInsets.ZERO_INSETS);

    DateAxis domainAxis = new DateAxis();
    domainAxis.setTickLabelsVisible(false);
    domainAxis.setLowerMargin(0.02);//from   w w  w. j a va2  s. c  o m
    domainAxis.setUpperMargin(0.02);
    plot.setDomainAxis(domainAxis);

    NumberAxis rangeAxis = new NumberAxis();
    rangeAxis.setAutoRangeIncludesZero(false);
    rangeAxis.setTickLabelsVisible(false);
    rangeAxis.setLowerMargin(0.02);
    rangeAxis.setUpperMargin(0.02);
    plot.setRangeAxis(rangeAxis);

    JFreeChart result = new JFreeChart("", null, plot, true);
    result.setPadding(new RectangleInsets(5, 5, 5, 5));
    result.getLegend().setFrame(BlockBorder.NONE);
    result.getLegend().setBackgroundPaint(null);

    return result;
}

From source file:net.sf.mzmine.modules.visualization.spectra.SpectraPlot.java

public SpectraPlot(ActionListener masterPlot) {

    super(null, true);

    setBackground(Color.white);//w  ww  .  j  a v a 2 s . c  o  m
    setCursor(Cursor.getPredefinedCursor(Cursor.CROSSHAIR_CURSOR));

    // initialize the chart by default time series chart from factory
    chart = ChartFactory.createXYLineChart("", // title
            "m/z", // x-axis label
            "Intensity", // y-axis label
            null, // data set
            PlotOrientation.VERTICAL, // orientation
            true, // isotopeFlag, // create legend?
            true, // generate tooltips?
            false // generate URLs?
    );
    chart.setBackgroundPaint(Color.white);
    setChart(chart);

    // title
    chartTitle = chart.getTitle();
    chartTitle.setMargin(5, 0, 0, 0);
    chartTitle.setFont(titleFont);

    chartSubTitle = new TextTitle();
    chartSubTitle.setFont(subTitleFont);
    chartSubTitle.setMargin(5, 0, 0, 0);
    chart.addSubtitle(chartSubTitle);

    // legend constructed by ChartFactory
    LegendTitle legend = chart.getLegend();
    legend.setItemFont(legendFont);
    legend.setFrame(BlockBorder.NONE);

    // disable maximum size (we don't want scaling)
    setMaximumDrawWidth(Integer.MAX_VALUE);
    setMaximumDrawHeight(Integer.MAX_VALUE);
    setMinimumDrawHeight(0);

    // set the plot properties
    plot = chart.getXYPlot();
    plot.setBackgroundPaint(Color.white);
    plot.setAxisOffset(new RectangleInsets(5.0, 5.0, 5.0, 5.0));

    // set rendering order
    plot.setDatasetRenderingOrder(DatasetRenderingOrder.FORWARD);

    // set grid properties
    plot.setDomainGridlinePaint(gridColor);
    plot.setRangeGridlinePaint(gridColor);

    // set crosshair (selection) properties
    plot.setDomainCrosshairVisible(false);
    plot.setRangeCrosshairVisible(false);

    NumberFormat mzFormat = MZmineCore.getConfiguration().getMZFormat();
    NumberFormat intensityFormat = MZmineCore.getConfiguration().getIntensityFormat();

    // set the X axis (retention time) properties
    NumberAxis xAxis = (NumberAxis) plot.getDomainAxis();
    xAxis.setNumberFormatOverride(mzFormat);
    xAxis.setUpperMargin(0.001);
    xAxis.setLowerMargin(0.001);
    xAxis.setTickLabelInsets(new RectangleInsets(0, 0, 20, 20));

    // set the Y axis (intensity) properties
    NumberAxis yAxis = (NumberAxis) plot.getRangeAxis();
    yAxis.setNumberFormatOverride(intensityFormat);

    // set focusable state to receive key events
    setFocusable(true);

    // register key handlers
    GUIUtils.registerKeyHandler(this, KeyStroke.getKeyStroke("LEFT"), masterPlot, "PREVIOUS_SCAN");
    GUIUtils.registerKeyHandler(this, KeyStroke.getKeyStroke("RIGHT"), masterPlot, "NEXT_SCAN");
    GUIUtils.registerKeyHandler(this, KeyStroke.getKeyStroke('+'), this, "ZOOM_IN");
    GUIUtils.registerKeyHandler(this, KeyStroke.getKeyStroke('-'), this, "ZOOM_OUT");

    // add items to popup menu
    if (masterPlot instanceof SpectraVisualizerWindow) {
        JPopupMenu popupMenu = getPopupMenu();

        popupMenu.addSeparator();

        GUIUtils.addMenuItem(popupMenu, "Toggle centroid/continuous mode", masterPlot, "TOGGLE_PLOT_MODE");
        GUIUtils.addMenuItem(popupMenu, "Toggle displaying of data points in continuous mode", masterPlot,
                "SHOW_DATA_POINTS");
        GUIUtils.addMenuItem(popupMenu, "Toggle displaying of peak values", masterPlot, "SHOW_ANNOTATIONS");
        GUIUtils.addMenuItem(popupMenu, "Toggle displaying of picked peaks", masterPlot, "SHOW_PICKED_PEAKS");

        popupMenu.addSeparator();

        GUIUtils.addMenuItem(popupMenu, "Set axes range", masterPlot, "SETUP_AXES");

        GUIUtils.addMenuItem(popupMenu, "Set same range to all windows", masterPlot, "SET_SAME_RANGE");

        popupMenu.addSeparator();

        GUIUtils.addMenuItem(popupMenu, "Add isotope pattern", masterPlot, "ADD_ISOTOPE_PATTERN");
    }

}

From source file:com.ikon.servlet.admin.StatsGraphServlet.java

public void doGet(HttpServletRequest request, HttpServletResponse response)
        throws IOException, ServletException {
    String action = WebUtils.getString(request, "action", "graph");
    String type = WebUtils.getString(request, "t");
    JFreeChart chart = null;//from  w  ww  .ja va 2s. c o m
    updateSessionManager(request);

    try {
        if ("refresh".equals(action)) {
            new RepositoryInfo().runAs(null);
            ServletContext sc = getServletContext();
            sc.getRequestDispatcher("/admin/stats.jsp").forward(request, response);
        } else {
            response.setContentType("image/png");
            OutputStream out = response.getOutputStream();

            if (DOCUMENTS.equals(type) || DOCUMENTS_SIZE.equals(type) || FOLDERS.equals(type)) {
                chart = repoStats(type);
            } else if (DISK.equals(type)) {
                chart = diskStats();
            } else if (JVM_MEMORY.equals(type)) {
                chart = jvmMemStats();
            } else if (OS_MEMORY.equals(type)) {
                chart = osMemStats();
            }

            if (chart != null) {
                // Customize title font
                chart.getTitle().setFont(new Font("Tahoma", Font.BOLD, 16));

                // Match body {   background-color:#F6F6EE; }
                chart.setBackgroundPaint(new Color(246, 246, 238));

                // Customize no data
                PiePlot plot = (PiePlot) chart.getPlot();
                plot.setNoDataMessage("No data to display");

                // Customize labels
                plot.setLabelGenerator(null);

                // Customize legend
                LegendTitle legend = new LegendTitle(plot, new ColumnArrangement(), new ColumnArrangement());
                legend.setPosition(RectangleEdge.BOTTOM);
                legend.setFrame(BlockBorder.NONE);
                legend.setItemFont(new Font("Tahoma", Font.PLAIN, 12));
                chart.removeLegend();
                chart.addLegend(legend);

                if (DISK.equals(type) || JVM_MEMORY.equals(type) || OS_MEMORY.equals(type)) {
                    ChartUtilities.writeChartAsPNG(out, chart, 225, 225);
                } else {
                    ChartUtilities.writeChartAsPNG(out, chart, 250, 250);
                }
            }

            out.flush();
            out.close();
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
}