Example usage for org.jfree.chart ChartFactory createBarChart

List of usage examples for org.jfree.chart ChartFactory createBarChart

Introduction

In this page you can find the example usage for org.jfree.chart ChartFactory createBarChart.

Prototype

public static JFreeChart createBarChart(String title, String categoryAxisLabel, String valueAxisLabel,
        CategoryDataset dataset, PlotOrientation orientation, boolean legend, boolean tooltips, boolean urls) 

Source Link

Document

Creates a bar chart.

Usage

From source file:org.openmrs.module.usagestatistics668.web.view.chart.AccessEncounterChartView.java

/**
 * create bar chart for encounter data/*from   w  w  w.  ja  v a  2s  .  com*/
 * @param model model build for view
 * @param request
 * @return JFREEChart for viewing encounter data
 */
@Override
protected JFreeChart createChart(Map<String, Object> model, HttpServletRequest request) {

    AccessEncounterService svc = Context.getService(AccessEncounterService.class);
    List<Object[]> data = svc.getMostViewedEncounter(getFromDate(), getUntilDate(), getUsageFilter(),
            getMaxResults());
    String[] categories = new String[data.size()];
    int[] count = new int[data.size()];
    for (int i = 0; i < categories.length; i++) {
        categories[i] = String.valueOf(data.get(i)[0]);
        count[i] = ((BigInteger) data.get(i)[1]).intValue();
    }

    String yAxisLabel = ContextProvider.getMessage("usagestatistics668.summary.count");
    String xAxisLabel = ContextProvider.getMessage("usagestatistics668.summary.encounter");
    String seriesView = ContextProvider.getMessage("usagestatistics668.summary.any");
    if (getUsageFilter() == ActionCriteria.CREATED) {
        seriesView = ContextProvider.getMessage("usagestatistics668.summary.created");
    } else if (getUsageFilter() == ActionCriteria.UPDATED) {
        seriesView = ContextProvider.getMessage("usagestatistics668.summary.updated");
    } else if (getUsageFilter() == ActionCriteria.VIEWED) {
        seriesView = ContextProvider.getMessage("usagestatistics668.summary.viewed");
    } else if (getUsageFilter() == ActionCriteria.VOIDED) {
        seriesView = ContextProvider.getMessage("usagestatistics668.summary.voided");
    } else if (getUsageFilter() == ActionCriteria.UNVOIDED) {
        seriesView = ContextProvider.getMessage("usagestatistics668.summary.unvoided");
    }

    DefaultCategoryDataset dataset = new DefaultCategoryDataset();
    for (int c = 0; c < data.size(); c++) {
        dataset.addValue(count[c], seriesView, (categories != null) ? categories[c] : (c + ""));
    }

    JFreeChart chart = ChartFactory.createBarChart(null, // Chart title
            xAxisLabel, // Domain axis label
            yAxisLabel, // Range axis label
            dataset, // Data
            PlotOrientation.VERTICAL, // Orientation
            true, // Include legend
            false, // Tooltips?
            false // URLs?
    );

    return chart;
}

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

/**
 * Creates a chart.//from   w w  w.  j a va2  s  .c  o  m
 * 
 * @param dataset  the dataset.
 * 
 * @return A chart.
 */
private JFreeChart createChart(final CategoryDataset dataset) {

    final JFreeChart chart = ChartFactory.createBarChart("Bar Chart Demo 2", // chart title
            "Category", // domain axis label
            "Score (%)", // range axis label
            dataset, // data
            PlotOrientation.HORIZONTAL, // orientation
            true, // include legend
            true, false);

    // NOW DO SOME OPTIONAL CUSTOMISATION OF THE CHART...

    // set the background color for the chart...
    chart.setBackgroundPaint(Color.lightGray);

    // get a reference to the plot for further customisation...
    final CategoryPlot plot = chart.getCategoryPlot();
    plot.setRangeAxisLocation(AxisLocation.BOTTOM_OR_LEFT);

    // change the auto tick unit selection to integer units only...
    final NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
    rangeAxis.setRange(0.0, 100.0);
    rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());

    // OPTIONAL CUSTOMISATION COMPLETED.

    return chart;

}

From source file:j2se.jfreechart.barchart.BarChartDemo2.java

/**
 * Creates a chart./* ww  w.jav  a  2 s  .c o  m*/
 * 
 * @param dataset  the dataset.
 * 
 * @return A chart.
 */
private JFreeChart createChart(final CategoryDataset dataset) {

    final JFreeChart chart = ChartFactory.createBarChart("Bar Chart Demo 2", // chart title
            "Category", // domain axis label
            "Score (%)", // range axis label
            dataset, // data
            PlotOrientation.VERTICAL, // orientation
            true, // include legend
            true, false);

    // NOW DO SOME OPTIONAL CUSTOMISATION OF THE CHART...

    // set the background color for the chart...
    chart.setBackgroundPaint(Color.lightGray);

    // get a reference to the plot for further customisation...
    final CategoryPlot plot = chart.getCategoryPlot();
    plot.setRangeAxisLocation(AxisLocation.BOTTOM_OR_LEFT);

    // change the auto tick unit selection to integer units only...
    final NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
    rangeAxis.setRange(0.0, 100.0);
    rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());

    // OPTIONAL CUSTOMISATION COMPLETED.

    return chart;

}

From source file:org.openmrs.module.usagestatistics668.web.view.chart.AccessPatientChartView.java

/**
 * create bar chart for patient data//from  w  w  w  .  j  a  v  a  2s  . c  o m
 * @param model model build for view
 * @param request
 * @return JFREEChart for viewing encounter data
 */
@Override
protected JFreeChart createChart(Map<String, Object> model, HttpServletRequest request) {

    AccessPatientService svc = Context.getService(AccessPatientService.class);
    List<Object[]> data = svc.getMostViewedPatient(getFromDate(), getUntilDate(), getUsageFilter(),
            getMaxResults());
    //List<Object[]> data = svc.getMostViewedPatient(monthAgo, 2);
    String[] categories = new String[data.size()];
    int[] count = new int[data.size()];
    for (int i = 0; i < categories.length; i++) {
        categories[i] = String.valueOf(data.get(i)[0]);
        count[i] = ((BigInteger) data.get(i)[1]).intValue();
    }

    String seriesView = ContextProvider.getMessage("usagestatistics668.summary.any");
    if (getUsageFilter() == ActionCriteria.CREATED) {
        seriesView = ContextProvider.getMessage("usagestatistics668.summary.created");
    } else if (getUsageFilter() == ActionCriteria.UPDATED) {
        seriesView = ContextProvider.getMessage("usagestatistics668.summary.updated");
    } else if (getUsageFilter() == ActionCriteria.VIEWED) {
        seriesView = ContextProvider.getMessage("usagestatistics668.summary.viewed");
    } else if (getUsageFilter() == ActionCriteria.VOIDED) {
        seriesView = ContextProvider.getMessage("usagestatistics668.summary.voided");
    } else if (getUsageFilter() == ActionCriteria.UNVOIDED) {
        seriesView = ContextProvider.getMessage("usagestatistics668.summary.unvoided");
    }

    String yAxisLabel = ContextProvider.getMessage("usagestatistics668.summary.count");
    String xAxisLabel = ContextProvider.getMessage("usagestatistics668.summary.patient");

    DefaultCategoryDataset dataset = new DefaultCategoryDataset();
    for (int c = 0; c < data.size(); c++) {
        dataset.addValue(count[c], seriesView, (categories != null) ? categories[c] : (c + ""));
    }

    JFreeChart chart = ChartFactory.createBarChart(null, // Chart title
            xAxisLabel, // Domain axis label
            yAxisLabel, // Range axis label
            dataset, // Data
            PlotOrientation.VERTICAL, // Orientation
            true, // Include legend
            false, // Tooltips?
            false // URLs?
    );

    return chart;
}

From source file:Simulator.PerformanceCalculation.java

public JPanel waitTime1() {
    LinkedHashSet no = new LinkedHashSet();
    LinkedHashMap<Integer, ArrayList<Double>> wait1 = new LinkedHashMap<>();

    for (Map.Entry<Integer, TraceObject> entry : l.getLocalTrace().entrySet()) {
        TraceObject traceObject = entry.getValue();

        if (wait1.get(traceObject.getSurgeonId()) == null) {
            ArrayList details = new ArrayList();
            details.add(traceObject.getWaitTime1());
            wait1.put(traceObject.getSurgeonId(), details);
        } else {/*  w  w w  . j a va  2s .c  o m*/
            wait1.get(traceObject.getSurgeonId()).add(traceObject.getWaitTime1());
        }

        no.add(traceObject.getSurgeonId());
    }
    String[] column = new String[no.size()];

    String series1 = "Wait Time 1";
    for (int i = 0; i < no.size(); i++) {
        column[i] = "Surgeon " + (i + 1);
    }

    DefaultCategoryDataset dataset = new DefaultCategoryDataset();

    LinkedHashMap<Integer, Double> average = new LinkedHashMap<>();
    for (Map.Entry<Integer, ArrayList<Double>> entry : wait1.entrySet()) {
        Integer integer = entry.getKey();
        ArrayList<Double> arrayList = entry.getValue();
        double total = 0;
        for (Double double1 : arrayList) {
            total += double1;
        }
        average.put(integer, total / arrayList.size());
    }

    for (int i = 1; i <= average.size(); i++) {
        dataset.addValue(Math.round(average.get(i) / 600), series1, column[i - 1]);
    }
    JFreeChart chart = ChartFactory.createBarChart("Wait Time 1", // chart title
            "Surgeon ID", // domain axis label
            "Days", // range axis label
            dataset, // data
            PlotOrientation.VERTICAL, // orientation
            true, // include legend
            true, // tooltips?
            false // URLs?
    );

    return new ChartPanel(chart);
}

From source file:com.opensourcestrategies.financials.reports.JFreeFinancialCharts.java

/**
 * Liquidity snapshot chart.  Documentation is at http://www.opentaps.org/docs/index.php/Financials_Home_Screen
 *
 * Because a user might not have permission to view balances in all areas, this method takes into consideration
 * the ability to view various bars in the chart.
 *
 * @param accountsMap Map of accounts keyed by the glAccountType
 * @return String filename pointing to the chart, to be used with showChart URI request
 *///from  w w  w. j av  a2  s.co m
public static String createLiquiditySnapshotChart(Map<String, GenericValue> accountsMap,
        List<GenericValue> creditCardAccounts, Locale locale, boolean hasReceivablesPermission,
        boolean hasPayablesPermission, boolean hasInventoryPermission)
        throws GenericEntityException, IOException {
    Map<String, Object> uiLabelMap = UtilMessage.getUiLabels(locale);

    // create the dataset
    DefaultCategoryDataset dataset = new DefaultCategoryDataset();

    // compile the four bars
    if (hasReceivablesPermission) {
        double cashBalance = 0.0;
        cashBalance += getPostedBalance(accountsMap.get("UNDEPOSITED_RECEIPTS"));
        cashBalance += getPostedBalance(accountsMap.get("BANK_STLMNT_ACCOUNT"));
        dataset.addValue(cashBalance, "", (String) uiLabelMap.get("FinancialsCashEquivalents"));

        double receivablesBalance = 0.0;
        receivablesBalance += getPostedBalance(accountsMap.get("ACCOUNTS_RECEIVABLE"));
        // merchant account settlement balances are receivable
        receivablesBalance += getPostedBalance(accountsMap.get("MRCH_STLMNT_ACCOUNT"));
        dataset.addValue(receivablesBalance, "", (String) uiLabelMap.get("FinancialsReceivables"));
    }
    if (hasInventoryPermission) {
        double inventoryBalance = 0.0;
        inventoryBalance += getPostedBalance(accountsMap.get("INVENTORY_ACCOUNT"));
        inventoryBalance += getPostedBalance(accountsMap.get("RAWMAT_INVENTORY"));
        inventoryBalance += getPostedBalance(accountsMap.get("WIP_INVENTORY"));
        dataset.addValue(inventoryBalance, "", (String) uiLabelMap.get("WarehouseInventory"));
    }
    if (hasPayablesPermission) {
        double payablesBalance = 0.0;
        payablesBalance += getPostedBalance(accountsMap.get("ACCOUNTS_PAYABLE"));
        payablesBalance += getPostedBalance(accountsMap.get("COMMISSIONS_PAYABLE"));
        payablesBalance += getPostedBalance(accountsMap.get("UNINVOICED_SHIP_RCPT"));
        dataset.addValue(payablesBalance, "", (String) uiLabelMap.get("FinancialsPayables"));
    }

    // set up the chart
    JFreeChart chart = ChartFactory.createBarChart((String) uiLabelMap.get("FinancialsLiquiditySnapshot"), // chart title
            null, // domain axis label
            null, // range axis label
            dataset, // data
            PlotOrientation.VERTICAL, // orientation
            false, // include legend
            true, // tooltips
            false // urls
    );
    chart.setBackgroundPaint(Color.white);
    chart.setBorderVisible(true);
    chart.setPadding(new RectangleInsets(5.0, 5.0, 5.0, 5.0));

    // get a reference to the plot for further customisation...
    final CategoryPlot plot = chart.getCategoryPlot();
    plot.setRangeAxisLocation(AxisLocation.BOTTOM_OR_LEFT);

    // get the bar renderer to put effects on the bars
    final BarRenderer renderer = (BarRenderer) plot.getRenderer();
    renderer.setDrawBarOutline(false); // disable bar outlines

    // set up gradient paint on bar
    final GradientPaint gp = new GradientPaint(0.0f, 0.0f, Color.GREEN, 0.0f, 0.0f, Color.GRAY);
    renderer.setSeriesPaint(0, gp);

    // change the auto tick unit selection to integer units only...
    final NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
    rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());

    // tilt the category labels so they fit
    CategoryAxis domainAxis = plot.getDomainAxis();
    domainAxis.setCategoryLabelPositions(CategoryLabelPositions.createUpRotationLabelPositions(Math.PI / 6.0));

    // save as a png and return the file name
    return ServletUtilities.saveChartAsPNG(chart, 400, 300, null);
}

From source file:com.mergano.core.GraphChart.java

private JFreeChart createChart(final CategoryDataset dataset) {

    final JFreeChart chart = ChartFactory.createBarChart("Revenue", "Monthly", "Amount", dataset,
            PlotOrientation.VERTICAL, false, true, false);

    // NOW DO SOME OPTIONAL CUSTOMISATION OF THE CHART...
    // set the background color for the chart...
    chart.setBackgroundPaint(Color.white);

    // get a reference to the plot for further customisation...
    final CategoryPlot plot = chart.getCategoryPlot();
    plot.setBackgroundPaint(Color.white);
    plot.setDomainGridlinePaint(Color.white);
    plot.setRangeGridlinePaint(Color.white);

    // set the range axis to display integers only...
    final NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
    rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    rangeAxis.setUpperMargin(0.15);//  ww  w . j ava 2  s  . c o  m

    // disable bar outlines...
    final CategoryItemRenderer renderer = plot.getRenderer();
    renderer.setSeriesItemLabelsVisible(0, Boolean.TRUE);

    final CategoryAxis domainAxis = plot.getDomainAxis();
    domainAxis.setCategoryLabelPositions(CategoryLabelPositions.DOWN_90);

    return chart;

}

From source file:com.twocents.report.charts.BarChartDemo1.java

/**
 * Creates a sample chart./*  w w w  .  j  a  va 2s.c o m*/
 *
 * @param dataset  the dataset.
 *
 * @return The chart.
 */
private static JFreeChart createChart(CategoryDataset dataset) {

    // create the chart...
    JFreeChart chart = ChartFactory.createBarChart("Bar Chart Demo 1", // chart title
            "Category", // domain axis label
            "Value", // range axis label
            dataset, // data
            PlotOrientation.VERTICAL, // orientation
            true, // include legend
            true, // tooltips?
            false // URLs?
    );

    // NOW DO SOME OPTIONAL CUSTOMISATION OF THE CHART...

    // set the background color for the chart...
    chart.setBackgroundPaint(Color.white);

    // get a reference to the plot for further customisation...
    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
    //
    // ******************************************************************

    // set the range axis to display integers only...
    NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
    rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());

    // disable bar outlines...
    BarRenderer renderer = (BarRenderer) plot.getRenderer();
    renderer.setDrawBarOutline(false);

    // set up gradient paints for series...
    GradientPaint gp0 = new GradientPaint(0.0f, 0.0f, Color.blue, 0.0f, 0.0f, new Color(0, 0, 64));
    GradientPaint gp1 = new GradientPaint(0.0f, 0.0f, Color.green, 0.0f, 0.0f, new Color(0, 64, 0));
    GradientPaint gp2 = new GradientPaint(0.0f, 0.0f, Color.red, 0.0f, 0.0f, new Color(64, 0, 0));
    renderer.setSeriesPaint(0, gp0);
    renderer.setSeriesPaint(1, gp1);
    renderer.setSeriesPaint(2, gp2);

    CategoryAxis domainAxis = plot.getDomainAxis();
    domainAxis.setCategoryLabelPositions(CategoryLabelPositions.createUpRotationLabelPositions(Math.PI / 6.0));
    // OPTIONAL CUSTOMISATION COMPLETED.

    return chart;

}

From source file:com.jimaginary.machine.graph.params.PoissonParamPropertyPanel.java

private void initChart() {
    /*//from w ww  . j a  v  a  2  s  . c o m
    XYSeries series = new XYSeries("Distrbution");
    for( int i = 0 ; i < poisson.getParameter(PARAM_MAX) ; i++ ) {
    series.add(i, poisson.probMassOrDensity((float)i));
    }
    XYSeriesCollection dataset = new XYSeriesCollection();
    dataset.addSeries(series);
            
    // Generate the graph
    JFreeChart chart = ChartFactory.createXYLineChart(
    "Poisson Distribution (PMF)",
    poisson.getParamName(PARAM_MEAN),
    "probability",
    dataset,
    PlotOrientation.VERTICAL,  // Plot Orientation
    true,                      // Show Legend
    true,                      // Use tooltips
    false                      // Configure chart to generate URLs?
    );
    // add annotations if we have them
    if( idxNames != null ) {
    System.out.println("add annotations");
    XYPlot plot = chart.getXYPlot();
    for( int i = 0 ; i < poisson.getParameter(PARAM_MAX) ; i++ ) {
        XYTextAnnotation an = new XYTextAnnotation(idxNames[i], i, poisson.probMassOrDensity((float)i));
        plot.addAnnotation(an);
    }
    } else {
    System.out.println("not adding annotations");
    }
    */

    // BAR CHART
    DefaultCategoryDataset chartData = new DefaultCategoryDataset();
    if (idxNames != null) {
        for (int i = 0; i < idxNames.length; i++) {
            chartData.setValue(mathFunc.probMassOrDensity((float) i), mathFunc.getParamName(PARAM_MEAN),
                    idxNames[i]);
        }
    } else {
        for (int i = 0; i < mathFunc.getParameter(PARAM_MAX); i++) {
            chartData.setValue(mathFunc.probMassOrDensity((float) i), mathFunc.getParamName(PARAM_MEAN),
                    "" + i);
        }
    }
    JFreeChart chart = ChartFactory.createBarChart("Poisson Distribution (PMF)",
            mathFunc.getParamName(PARAM_MEAN), "probability", chartData, //Chart Data 
            PlotOrientation.VERTICAL, // orientation
            true, // include legend?
            true, // include tooltips?
            false // include URLs?
    );

    if (chartPanel != null) {
        jPanelChart.remove(chartPanel);
    }
    chartPanel = new ChartPanel(chart);
    jPanelChart.setLayout(new java.awt.BorderLayout());
    jPanelChart.add(chartPanel, BorderLayout.CENTER);
    jPanelChart.validate();
}

From source file:org.exist.xquery.modules.jfreechart.JFreeChartFactory.java

/**
 *  Create JFreeChart graph using the supplied parameters.
 *
 * @param chartType One of the many chart types.
 * @param conf      Chart configuration/*from w  ww . j  av  a2  s .com*/
 * @param is        Inputstream containing chart data
 * @return          Initialized chart or NULL in case of issues.
 * @throws IOException Thrown when a problem is reported while parsing XML data.
 */
public static JFreeChart createJFreeChart(String chartType, Configuration conf, InputStream is)
        throws XPathException {

    logger.debug("Generating " + chartType);

    // Currently two dataset types supported
    CategoryDataset categoryDataset = null;
    PieDataset pieDataset = null;

    try {
        if ("PieChart".equals(chartType) || "PieChart3D".equals(chartType) || "RingChart".equals(chartType)) {
            logger.debug("Reading XML PieDataset");
            pieDataset = DatasetReader.readPieDatasetFromXML(is);

        } else {
            logger.debug("Reading XML CategoryDataset");
            categoryDataset = DatasetReader.readCategoryDatasetFromXML(is);
        }

    } catch (IOException ex) {
        throw new XPathException(ex.getMessage());

    } finally {
        try {
            is.close();
        } catch (IOException ex) {
            //
        }
    }

    // Return chart
    JFreeChart chart = null;

    // Big chart type switch
    if ("AreaChart".equalsIgnoreCase(chartType)) {
        chart = ChartFactory.createAreaChart(conf.getTitle(), conf.getCategoryAxisLabel(),
                conf.getValueAxisLabel(), categoryDataset, conf.getOrientation(), conf.isGenerateLegend(),
                conf.isGenerateTooltips(), conf.isGenerateUrls());

        setCategoryChartParameters(chart, conf);

    } else if ("BarChart".equalsIgnoreCase(chartType)) {
        chart = ChartFactory.createBarChart(conf.getTitle(), conf.getCategoryAxisLabel(),
                conf.getValueAxisLabel(), categoryDataset, conf.getOrientation(), conf.isGenerateLegend(),
                conf.isGenerateTooltips(), conf.isGenerateUrls());

        setCategoryChartParameters(chart, conf);

    } else if ("BarChart3D".equalsIgnoreCase(chartType)) {
        chart = ChartFactory.createBarChart3D(conf.getTitle(), conf.getCategoryAxisLabel(),
                conf.getValueAxisLabel(), categoryDataset, conf.getOrientation(), conf.isGenerateLegend(),
                conf.isGenerateTooltips(), conf.isGenerateUrls());

        setCategoryChartParameters(chart, conf);

    } else if ("LineChart".equalsIgnoreCase(chartType)) {
        chart = ChartFactory.createLineChart(conf.getTitle(), conf.getCategoryAxisLabel(),
                conf.getValueAxisLabel(), categoryDataset, conf.getOrientation(), conf.isGenerateLegend(),
                conf.isGenerateTooltips(), conf.isGenerateUrls());

        setCategoryChartParameters(chart, conf);

    } else if ("LineChart3D".equalsIgnoreCase(chartType)) {
        chart = ChartFactory.createLineChart3D(conf.getTitle(), conf.getCategoryAxisLabel(),
                conf.getValueAxisLabel(), categoryDataset, conf.getOrientation(), conf.isGenerateLegend(),
                conf.isGenerateTooltips(), conf.isGenerateUrls());

        setCategoryChartParameters(chart, conf);

    } else if ("MultiplePieChart".equalsIgnoreCase(chartType)) {
        chart = ChartFactory.createMultiplePieChart(conf.getTitle(), categoryDataset, conf.getOrder(),
                conf.isGenerateLegend(), conf.isGenerateTooltips(), conf.isGenerateUrls());

        setPieChartParameters(chart, conf);

    } else if ("MultiplePieChart3D".equalsIgnoreCase(chartType)) {
        chart = ChartFactory.createMultiplePieChart3D(conf.getTitle(), categoryDataset, conf.getOrder(),
                conf.isGenerateLegend(), conf.isGenerateTooltips(), conf.isGenerateUrls());

        setPieChartParameters(chart, conf);

    } else if ("PieChart".equalsIgnoreCase(chartType)) {
        chart = ChartFactory.createPieChart(conf.getTitle(), pieDataset, conf.isGenerateLegend(),
                conf.isGenerateTooltips(), conf.isGenerateUrls());

        setPieChartParameters(chart, conf);

    } else if ("PieChart3D".equalsIgnoreCase(chartType)) {
        chart = ChartFactory.createPieChart3D(conf.getTitle(), pieDataset, conf.isGenerateLegend(),
                conf.isGenerateTooltips(), conf.isGenerateUrls());

        setPieChartParameters(chart, conf);

    } else if ("RingChart".equalsIgnoreCase(chartType)) {
        chart = ChartFactory.createRingChart(conf.getTitle(), pieDataset, conf.isGenerateLegend(),
                conf.isGenerateTooltips(), conf.isGenerateUrls());

        setPieChartParameters(chart, conf);
    } else if ("SpiderWebChart".equalsIgnoreCase(chartType)) {
        SpiderWebPlot plot = new SpiderWebPlot(categoryDataset);
        if (conf.isGenerateTooltips()) {
            plot.setToolTipGenerator(new StandardCategoryToolTipGenerator());
        }
        chart = new JFreeChart(conf.getTitle(), JFreeChart.DEFAULT_TITLE_FONT, plot, false);

        if (conf.isGenerateLegend()) {
            LegendTitle legend = new LegendTitle(plot);
            legend.setPosition(RectangleEdge.BOTTOM);
            chart.addSubtitle(legend);
        } else {
            TextTitle subTitle = new TextTitle(" ");
            subTitle.setPosition(RectangleEdge.BOTTOM);
            chart.addSubtitle(subTitle);
        }

        setCategoryChartParameters(chart, conf);

    } else if ("StackedAreaChart".equalsIgnoreCase(chartType)) {
        chart = ChartFactory.createStackedAreaChart(conf.getTitle(), conf.getCategoryAxisLabel(),
                conf.getValueAxisLabel(), categoryDataset, conf.getOrientation(), conf.isGenerateLegend(),
                conf.isGenerateTooltips(), conf.isGenerateUrls());

        setCategoryChartParameters(chart, conf);

    } else if ("StackedBarChart".equalsIgnoreCase(chartType)) {
        chart = ChartFactory.createStackedBarChart(conf.getTitle(), conf.getDomainAxisLabel(),
                conf.getRangeAxisLabel(), categoryDataset, conf.getOrientation(), conf.isGenerateLegend(),
                conf.isGenerateTooltips(), conf.isGenerateUrls());

        setCategoryChartParameters(chart, conf);

    } else if ("StackedBarChart3D".equalsIgnoreCase(chartType)) {
        chart = ChartFactory.createStackedBarChart3D(conf.getTitle(), conf.getCategoryAxisLabel(),
                conf.getValueAxisLabel(), categoryDataset, conf.getOrientation(), conf.isGenerateLegend(),
                conf.isGenerateTooltips(), conf.isGenerateUrls());

        setCategoryChartParameters(chart, conf);

    } else if ("WaterfallChart".equalsIgnoreCase(chartType)) {
        chart = ChartFactory.createWaterfallChart(conf.getTitle(), conf.getCategoryAxisLabel(),
                conf.getValueAxisLabel(), categoryDataset, conf.getOrientation(), conf.isGenerateLegend(),
                conf.isGenerateTooltips(), conf.isGenerateUrls());

        setCategoryChartParameters(chart, conf);
    } else {
        logger.error("Illegal chartype. Choose one of " + "AreaChart BarChart BarChart3D LineChart LineChart3D "
                + "MultiplePieChart MultiplePieChart3D PieChart PieChart3D "
                + "RingChart SpiderWebChart StackedAreaChart StackedBarChart "
                + "StackedBarChart3D WaterfallChart");
    }

    setCommonParameters(chart, conf);

    return chart;
}