Example usage for org.jfree.chart StandardChartTheme createDarknessTheme

List of usage examples for org.jfree.chart StandardChartTheme createDarknessTheme

Introduction

In this page you can find the example usage for org.jfree.chart StandardChartTheme createDarknessTheme.

Prototype

public static ChartTheme createDarknessTheme() 

Source Link

Document

Creates and returns a theme called "Darkness".

Usage

From source file:jhplot.HPlotChart.java

/**
    * Set a custom theme for chart.. It can be: LEGACY_THEME, JFREE_THEME,
    * DARKNESS_THEME//from w ww  .  j av a2  s  .c  o m
    * 
    * @param s
    *            a theme, can be either LEGACY_THEME, JFREE_THEME,
    *            DARKNESS_THEME
    */
public void setTheme(String s) {

    if (s.equals("LEGACY_THEME")) {
        ChartFactory.setChartTheme(StandardChartTheme.createLegacyTheme());
        ChartUtilities.applyCurrentTheme(chart);
    } else if (s.equals("JFREE_THEME")) {
        ChartFactory.setChartTheme(StandardChartTheme.createJFreeTheme());
        ChartUtilities.applyCurrentTheme(chart);
    } else if (s.equals("DARKNESS_THEME")) {
        ChartFactory.setChartTheme(StandardChartTheme.createDarknessTheme());
        ChartUtilities.applyCurrentTheme(chart);

    }
}

From source file:jhplot.HChart.java

/**
 * Set a custom theme for chart.. It can be: LEGACY_THEME, JFREE_THEME,
 * DARKNESS_THEME// ww  w.j a va  2s. c o m
 * 
 * @param s
 *            a theme, can be either LEGACY_THEME, JFREE_THEME,
 *            DARKNESS_THEME
 */
public void setTheme(String s) {

    if (s.equals("LEGACY_THEME")) {
        ChartFactory.setChartTheme(StandardChartTheme.createLegacyTheme());
        applyThemeToChart();
    } else if (s.equals("JFREE_THEME")) {
        ChartFactory.setChartTheme(StandardChartTheme.createJFreeTheme());
        applyThemeToChart();
    } else if (s.equals("DARKNESS_THEME")) {
        ChartFactory.setChartTheme(StandardChartTheme.createDarknessTheme());
        applyThemeToChart();
    }
}

From source file:org.apache.jmeter.visualizers.CreateReport.java

/**
 * Creates a table; widths are set with setWidths().
 * @return a PdfPTable/*  w ww .ja va 2 s  . c o m*/
 * @throws DocumentException
 */

//createGraphs("Average Response Time of samples for each Request","Average(ms)",2);
public Image createGraphs(String chartName, String colName, int colNo) {
    DefaultCategoryDataset dataset = new DefaultCategoryDataset();
    for (int i = 0; i < model.getRowCount(); i++)
        dataset.setValue((long) model.getValueAt(i, colNo), "Average", model.getValueAt(i, 0).toString());
    ChartFactory.setChartTheme(StandardChartTheme.createDarknessTheme());

    final JFreeChart chart = ChartFactory.createBarChart3D(chartName, // chart title
            "Requests", // domain axis label

            "Average (ms)", // range axis label
            dataset, // data
            PlotOrientation.VERTICAL, // orientation
            true, // include legend
            true, // tooltips
            false // urls
    );

    final CategoryPlot plot = chart.getCategoryPlot();
    final CategoryAxis axis = plot.getDomainAxis();
    axis.setCategoryLabelPositions(CategoryLabelPositions.createUpRotationLabelPositions(Math.PI / 8.0));
    final BarRenderer3D renderer = (BarRenderer3D) plot.getRenderer();
    renderer.setDrawBarOutline(false);
    renderer.setMaximumBarWidth(0.05);

    try {
        //java.io.OutputStream out= new OutputStream(new FileOutputStream(BASEPATH+"//MyFile.jpg"));
        ChartUtilities.saveChartAsJPEG(new File(BASEPATH + "//MyFile.jpg"), chart, 500, 400);
    } catch (IOException e1) {
        // TODO Auto-generated catch block
        e1.printStackTrace();
    }

    Image img = null;
    try {
        img = Image.getInstance(BASEPATH + "//MyFile.jpg");
    } catch (BadElementException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    } catch (MalformedURLException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }

    return img;
}