Example usage for org.jfree.chart.axis CategoryAxis setCategoryMargin

List of usage examples for org.jfree.chart.axis CategoryAxis setCategoryMargin

Introduction

In this page you can find the example usage for org.jfree.chart.axis CategoryAxis setCategoryMargin.

Prototype

public void setCategoryMargin(double margin) 

Source Link

Document

Sets the category margin and sends an AxisChangeEvent to all registered listeners.

Usage

From source file:gov.nih.nci.cma.web.graphing.GEPlot.java

public String generateLog2Chart(String xAxisLabel, String yAxisLabel, HttpSession session, PrintWriter pw) {
    String log2Filename = "";

    JFreeChart log2Chart = null;/*from  w  w  w  . j  ava2 s .  c o  m*/
    try {

        log2Chart = ChartFactory.createBarChart(null, xAxisLabel, // domain axis label
                yAxisLabel, log2Dataset, // data
                PlotOrientation.VERTICAL, // orientation
                true, // include legend
                true, // tooltips?
                false // URLs?
        );
        log2Chart.setBackgroundPaint(java.awt.Color.white);
        // lets start some customization to retro fit w/jcharts lookand feel
        CategoryPlot plot = log2Chart.getCategoryPlot();
        CategoryAxis axis = plot.getDomainAxis();
        axis.setCategoryLabelPositions(CategoryLabelPositions.DOWN_45);
        axis.setLowerMargin(0.02); // two percent
        axis.setCategoryMargin(0.20); // 20 percent
        axis.setUpperMargin(0.02); // two percent
        StatisticalBarRenderer renderer = new StatisticalBarRenderer();

        // BarRenderer renderer = (BarRenderer) plot.getRenderer();
        renderer.setItemMargin(0.01); // one percent
        renderer.setDrawBarOutline(true);
        renderer.setOutlinePaint(Color.BLACK);
        renderer.setBaseToolTipGenerator(new CategoryToolTipGenerator() {

            public String generateToolTip(CategoryDataset dataset, int series, int item) {
                String stdDev = (String) stdDevMap
                        .get(dataset.getRowKey(series) + "::" + dataset.getColumnKey(item));

                return "Probeset : " + dataset.getRowKey(series) + "<br/>Intensity : "
                        + new DecimalFormat("0.0000").format(dataset.getValue(series, item)) + "<br/>"
                        + "<br/>Std. Dev.: " + stdDev + "<br/>";
            }

        });

        // LegendTitle lg = chart.getLegend();
        plot.setRenderer(renderer);

        // lets generate a custom legend - assumes theres only one source?
        //LegendItemCollection lic = log2Chart.getLegend().getSources()[0].getLegendItems();
        //legendHtml = LegendCreator.buildLegend(lic, "Probesets");
        log2Chart.removeLegend();
        ChartRenderingInfo info = new ChartRenderingInfo(new StandardEntityCollection());
        log2Filename = ServletUtilities.saveChartAsPNG(log2Chart, imgW, 400, info, session);
        ChartUtilities.writeImageMap(pw, log2Filename, info, new CustomOverlibToolTipTagFragmentGenerator(),
                new StandardURLTagFragmentGenerator());

    } catch (Exception e) {
        System.out.println("Exception - " + e.toString());
        e.printStackTrace(System.out);
    }
    return log2Filename;
}

From source file:net.praqma.jenkins.memorymap.MemoryMapBuildAction.java

protected JFreeChart createChart(CategoryDataset dataset, String title, String yaxis, int max, int min) {
    final JFreeChart chart = ChartFactory.createStackedAreaChart(title, // chart                                                                                                                                       // title
            null, // unused
            yaxis, // range axis label
            dataset, // data
            PlotOrientation.VERTICAL, // orientation
            true, // include legend
            true, // tooltips
            false // urls
    );//from w  w  w. ja v a  2 s  .c o  m

    final LegendTitle legend = chart.getLegend();

    legend.setPosition(RectangleEdge.BOTTOM);

    chart.setBackgroundPaint(Color.white);

    final CategoryPlot plot = chart.getCategoryPlot();

    plot.setBackgroundPaint(Color.WHITE);
    plot.setOutlinePaint(null);
    plot.setRangeGridlinesVisible(true);
    plot.setRangeGridlinePaint(Color.black);

    CategoryAxis domainAxis = new ShiftedCategoryAxis(null);
    plot.setDomainAxis(domainAxis);
    domainAxis.setCategoryLabelPositions(CategoryLabelPositions.UP_90);
    domainAxis.setLowerMargin(0.0);
    domainAxis.setUpperMargin(0.0);
    domainAxis.setCategoryMargin(0.0);

    final NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
    rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    rangeAxis.setUpperBound(max);
    rangeAxis.setLowerBound(min);

    final StackedAreaRenderer renderer = (StackedAreaRenderer) plot.getRenderer();
    renderer.setBaseStroke(new BasicStroke(2.0f));
    plot.setInsets(new RectangleInsets(5.0, 0, 0, 5.0));
    return chart;
}

From source file:dk.sdu.mmmi.featureous.views.codecharacterization.TanglingViewChart.java

public TanglingViewChart(boolean pkg, boolean sortByValue) {
    this.sortByValue = sortByValue;
    this.pkg = pkg;
    data = new DefaultKeyedValues2DDataset();
    String title = "Computational unit characterization";
    jchart = ChartFactory.createStackedBarChart(title, (pkg) ? "Package" : "Class", "Tangling", data,
            PlotOrientation.VERTICAL, true, false, false);
    CategoryPlot plot = (CategoryPlot) jchart.getPlot();
    //        chart.getLegend().setPosition(RectangleEdge.RIGHT);
    //        chart.getLegend().setVerticalAlignment(VerticalAlignment.TOP);
    //        chart.getLegend().setHorizontalAlignment(HorizontalAlignment.LEFT);
    LegendItemCollection lic = new LegendItemCollection();
    //        lic.add(new LegendItem("Infrastructural unit", "", "", "", new Rectangle(10, 10), Color.GREEN));
    //        lic.add(new LegendItem("Group-feature unit", "", "", "", new Rectangle(10, 10), Color.BLUE));
    //        lic.add(new LegendItem("Single-feature unit", "", "", "", new Rectangle(10, 10), Color.RED));
    plot.setFixedLegendItems(lic);/*from  w ww .j a  v a  2s  . co  m*/
    //        chart.removeLegend();
    plot.setDomainAxis(new SparselyLabeledCategoryAxis(20));
    CategoryAxis xAxis = (CategoryAxis) plot.getDomainAxis();
    xAxis.setCategoryLabelPositions(CategoryLabelPositions.UP_90);
    xAxis.setLabel((pkg) ? "Package" : "Class");
    //        xAxis.setTickLabelInsets(new RectangleInsets(0, 0, 5, 5));
    //        xAxis.setMaximumCategoryLabelLines(1);
    xAxis.setLowerMargin(0);
    xAxis.setCategoryMargin(0);
    xAxis.setUpperMargin(0);
    //        xAxis.setMaximumCategoryLabelWidthRatio(20f);
    jchart.setBackgroundPaint(Color.white);

    StackedBarRenderer renderer = new StackedBarRenderer() {

        @Override
        public void drawItem(Graphics2D g2, CategoryItemRendererState state, Rectangle2D dataArea,
                CategoryPlot plot, CategoryAxis domainAxis, ValueAxis rangeAxis, CategoryDataset dataset,
                int row, int column, int pass) {
            super.drawItem(g2, state, dataArea, plot, domainAxis, rangeAxis, dataset, row, column, pass);
            double start = plot.getDomainAxis().getCategoryStart(column, getColumnCount(), dataArea,
                    plot.getDomainAxisEdge());
            double end = plot.getDomainAxis().getCategoryEnd(column, getColumnCount(), dataArea,
                    plot.getDomainAxisEdge());

            String compUnit = data.getRowKey(row).toString();

            // Calculate y coeffs
            double posBase = getBase();
            //                for(int i = 0; i<row; i++){
            //                    Number val = dataset.getValue(i, column);
            //                    if(val!=null){
            //                        posBase = posBase + val.doubleValue();
            //                    }
            //                }

            Number value = dataset.getValue(row, column);
            if (value == null) {
                return;
            }
            double val = value.doubleValue();

            double translatedBase = plot.getRangeAxis().valueToJava2D(posBase, dataArea,
                    plot.getRangeAxisEdge());
            double translatedValue = plot.getRangeAxis().valueToJava2D(posBase + val, dataArea,
                    plot.getRangeAxisEdge());

            if (Controller.getInstance().getTraceSet().getSelectionManager().getSelectedClasses()
                    .contains(compUnit)
                    || Controller.getInstance().getTraceSet().getSelectionManager().getSelectedPkgs()
                            .contains(compUnit)) {
                g2.setPaint(UIUtils.SELECTION_COLOR);
                g2.setStroke(new BasicStroke(3f));
                Line2D l2d = new Line2D.Double(start, translatedBase, start, translatedValue);
                g2.draw(l2d);
                l2d = new Line2D.Double(end, translatedBase, end, translatedValue);
                g2.draw(l2d);
                l2d = new Line2D.Double(start, translatedBase, end, translatedBase);
                g2.draw(l2d);
                l2d = new Line2D.Double(start, translatedValue, end, translatedValue);
                g2.draw(l2d);
            }
        }
    };

    renderer.setToolTipGenerator(new CategoryToolTipGenerator() {

        public String generateToolTip(CategoryDataset cd, int i, int i1) {
            String key = data.getRowKey(i).toString();
            //                key = key.substring(0, key.length()-1);
            return "<html>" + i + " - " + key + "<br>" + Double.toString(cd.getValue(i, i1).doubleValue())
                    + "</hmtl>";
        }
    });

    plot.setRenderer(renderer);

    panel = new ChartPanel(jchart);

    panel.getPopupMenu().setEnabled(false);//add(SVGExporter.createExportAction(chart, panel));

    createView();
    Controller.getInstance().getTraceSet().getSelectionManager().addSelectionListener(this);
}

From source file:com.googlecode.logVisualizer.chart.HorizontalBarChartBuilder.java

private JFreeChart createChart(final CategoryDataset dataset) {
    final JFreeChart chart = ChartFactory.createBarChart(getTitle(), xLable, yLable, dataset,
            PlotOrientation.HORIZONTAL, isIncludeLegend(), true, false);
    final CategoryPlot plot = (CategoryPlot) chart.getPlot();
    final BarRenderer renderer = (BarRenderer) plot.getRenderer();
    final CategoryAxis categoryAxis = plot.getDomainAxis();
    final NumberAxis numberAxis = (NumberAxis) plot.getRangeAxis();

    plot.setNoDataMessage("No data available");
    plot.setBackgroundPaint(Color.white);
    plot.setRangeGridlinePaint(Color.black);
    plot.setRangeAxisLocation(AxisLocation.BOTTOM_OR_LEFT);
    setBarShadowVisible(chart, false);/*from   w  ww .ja  v  a 2 s .  co  m*/

    renderer.setBaseItemLabelsVisible(true);
    renderer.setBaseItemLabelGenerator(new StandardCategoryItemLabelGenerator());
    renderer.setBaseToolTipGenerator(
            new StandardCategoryToolTipGenerator("{1}, {2}", NumberFormat.getInstance()));

    categoryAxis.setCategoryMargin(0.02);
    categoryAxis.setUpperMargin(0.02);
    categoryAxis.setLowerMargin(0.02);
    numberAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    numberAxis.setUpperMargin(0.1);

    return chart;
}

From source file:com.googlecode.logVisualizer.chart.HorizontalStackedBarChartBuilder.java

private JFreeChart createChart(final CategoryDataset dataset) {
    final JFreeChart chart = ChartFactory.createStackedBarChart(getTitle(), xLable, yLable, dataset,
            PlotOrientation.HORIZONTAL, isIncludeLegend(), true, false);
    final CategoryPlot plot = (CategoryPlot) chart.getPlot();
    final StackedBarRenderer renderer = (StackedBarRenderer) plot.getRenderer();
    final CategoryAxis categoryAxis = plot.getDomainAxis();
    final NumberAxis numberAxis = (NumberAxis) plot.getRangeAxis();

    plot.setNoDataMessage("No data available");
    plot.setBackgroundPaint(Color.white);
    plot.setRangeGridlinePaint(Color.black);
    plot.setRangeAxisLocation(AxisLocation.BOTTOM_OR_LEFT);
    setBarShadowVisible(chart, false);/*  w  w w  .ja  v a2  s  .  c  om*/

    renderer.setDrawBarOutline(false);
    renderer.setBaseItemLabelsVisible(true);
    renderer.setBaseItemLabelGenerator(new StandardCategoryItemLabelGenerator());
    renderer.setBaseToolTipGenerator(
            new StandardCategoryToolTipGenerator("{1}, {2}", NumberFormat.getInstance()));

    categoryAxis.setCategoryMargin(0.02);
    categoryAxis.setUpperMargin(0.02);
    categoryAxis.setLowerMargin(0.02);
    numberAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    numberAxis.setUpperMargin(0.1);

    return chart;
}

From source file:com.googlecode.logVisualizer.chart.perDayConsumption.ConsumptionBarChartBuilder.java

private JFreeChart createChart(final ConsumptionDataset dataset) {
    final JFreeChart chart = ChartFactory.createStackedBarChart(getTitle(), xLable, yLable, dataset,
            PlotOrientation.VERTICAL, isIncludeLegend(), true, false);
    final CategoryPlot plot = (CategoryPlot) chart.getPlot();
    final StackedBarRenderer renderer = (StackedBarRenderer) plot.getRenderer();
    final CategoryAxis categoryAxis = plot.getDomainAxis();
    final NumberAxis numberAxis = (NumberAxis) plot.getRangeAxis();

    plot.setNoDataMessage("No data available");
    plot.setBackgroundPaint(Color.white);
    plot.setRangeGridlinePaint(Color.black);
    plot.setRangeAxisLocation(AxisLocation.BOTTOM_OR_LEFT);
    setBarShadowVisible(chart, false);/*  w  w w.  jav  a  2 s  . c  o m*/
    setStackColors(dataset, renderer);

    renderer.setDrawBarOutline(false);
    renderer.setBaseItemLabelsVisible(true);
    renderer.setBaseItemLabelGenerator(new ConsumptionLableGenerator());
    renderer.setBaseToolTipGenerator(new ConsumptionToolTipGenerator());

    categoryAxis.setCategoryMargin(0.07);
    categoryAxis.setUpperMargin(0.01);
    categoryAxis.setLowerMargin(0.01);
    numberAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    numberAxis.setUpperMargin(0.1);

    return chart;
}

From source file:hudson.tasks.test.AbstractTestResultAction.java

private JFreeChart createChart(StaplerRequest req, CategoryDataset dataset) {

    final String relPath = getRelPath(req);

    final JFreeChart chart = ChartFactory.createStackedAreaChart(null, // chart title
            null, // unused
            "count", // range axis label
            dataset, // data
            PlotOrientation.VERTICAL, // orientation
            false, // include legend
            true, // tooltips
            false // urls
    );/*  w  w w .  j  a  va 2 s .  co m*/

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

    // set the background color for the chart...

    //        final StandardLegend legend = (StandardLegend) chart.getLegend();
    //        legend.setAnchor(StandardLegend.SOUTH);

    chart.setBackgroundPaint(Color.white);

    final CategoryPlot plot = chart.getCategoryPlot();

    // plot.setAxisOffset(new Spacer(Spacer.ABSOLUTE, 5.0, 5.0, 5.0, 5.0));
    plot.setBackgroundPaint(Color.WHITE);
    plot.setOutlinePaint(null);
    plot.setForegroundAlpha(0.8f);
    //        plot.setDomainGridlinesVisible(true);
    //        plot.setDomainGridlinePaint(Color.white);
    plot.setRangeGridlinesVisible(true);
    plot.setRangeGridlinePaint(Color.black);

    CategoryAxis domainAxis = new ShiftedCategoryAxis(null);
    plot.setDomainAxis(domainAxis);
    domainAxis.setCategoryLabelPositions(CategoryLabelPositions.UP_90);
    domainAxis.setLowerMargin(0.0);
    domainAxis.setUpperMargin(0.0);
    domainAxis.setCategoryMargin(0.0);

    final NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
    rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());

    StackedAreaRenderer ar = new StackedAreaRenderer2() {
        @Override
        public String generateURL(CategoryDataset dataset, int row, int column) {
            NumberOnlyBuildLabel label = (NumberOnlyBuildLabel) dataset.getColumnKey(column);
            return relPath + label.getRun().getNumber() + "/testReport/";
        }

        @Override
        public String generateToolTip(CategoryDataset dataset, int row, int column) {
            NumberOnlyBuildLabel label = (NumberOnlyBuildLabel) dataset.getColumnKey(column);
            AbstractTestResultAction a = label.getRun().getAction(AbstractTestResultAction.class);
            switch (row) {
            case 0:
                return String.valueOf(Messages.AbstractTestResultAction_fail(label.getRun().getDisplayName(),
                        a.getFailCount()));
            case 1:
                return String.valueOf(Messages.AbstractTestResultAction_skip(label.getRun().getDisplayName(),
                        a.getSkipCount()));
            default:
                return String.valueOf(Messages.AbstractTestResultAction_test(label.getRun().getDisplayName(),
                        a.getTotalCount()));
            }
        }
    };
    plot.setRenderer(ar);
    ar.setSeriesPaint(0, ColorPalette.RED); // Failures.
    ar.setSeriesPaint(1, ColorPalette.YELLOW); // Skips.
    ar.setSeriesPaint(2, ColorPalette.BLUE); // Total.

    // crop extra space around the graph
    plot.setInsets(new RectangleInsets(0, 0, 0, 5.0));

    return chart;
}

From source file:hr.restart.util.chart.ChartXYZ.java

/**
  * Creates a BAR CHART./*from  w w  w .j a  va 2  s. c o m*/
  * 
  * @param dataset The org.jfree.data.CategoryDataset
  * @param title The title
  * @return org.jfree.chart.JFreeChart
  */
final private JFreeChart createBarChart(final CategoryDataset dataset, String title) {

    final JFreeChart chart = ChartFactory.createBarChart(title, // chart title
            "", // domain axis label
            "", // range axis label
            dataset, // data
            PlotOrientation.VERTICAL, // the plot orientation
            true, // include legend
            true, false);

    chart.setBackgroundPaint(Color.white);

    //print the subtitles
    java.util.List subs = getSubtitles();
    if (subs != null) {
        for (int i = 0; i < subs.size(); i++) {
            chart.addSubtitle(new TextTitle(subs.get(i).toString()));
        }
    }

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

    // get a reference to the plot for further customisation...
    final CategoryPlot plot = chart.getCategoryPlot();
    //plot.setBackgroundPaint(Color.lightGray);
    //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());

    // disable bar outlines...
    final BarRenderer renderer = (BarRenderer) plot.getRenderer();
    renderer.setDrawBarOutline(false);
    renderer.setItemMargin(getItemMargin());
    adjustBarRenderer(renderer);

    final CategoryAxis domainAxis = plot.getDomainAxis();
    domainAxis.setCategoryMargin(getCategoryMargin());
    // OPTIONAL CUSTOMISATION COMPLETED.

    return chart;

}

From source file:edu.dlnu.liuwenpeng.ChartFactory.ChartFactory.java

/**    
 * Creates an area chart with default settings.  The chart object returned    
 * by this method uses a {@link CategoryPlot} instance as the plot, with a     
 * {@link CategoryAxis} for the domain axis, a {@link NumberAxis} as the    
 * range axis, and an {@link AreaRenderer} as the renderer.    
 *    //from www .j a  va  2  s  .c  om
 * @param title  the chart title (<code>null</code> permitted).    
 * @param categoryAxisLabel  the label for the category axis     
 *                           (<code>null</code> permitted).    
 * @param valueAxisLabel  the label for the value axis (<code>null</code>     
 *                        permitted).    
 * @param dataset  the dataset for the chart (<code>null</code> permitted).    
 * @param orientation  the plot orientation (<code>null</code> not     
 *                     permitted).    
 * @param legend  a flag specifying whether or not a legend is required.    
 * @param tooltips  configure chart to generate tool tips?    
 * @param urls  configure chart to generate URLs?    
 *    
 * @return An area chart.    
 */
public static JFreeChart createAreaChart(String title, String categoryAxisLabel, String valueAxisLabel,
        CategoryDataset dataset, PlotOrientation orientation, boolean legend, boolean tooltips, boolean urls) {

    if (orientation == null) {
        throw new IllegalArgumentException("Null 'orientation' argument.");
    }
    CategoryAxis categoryAxis = new CategoryAxis(categoryAxisLabel);
    categoryAxis.setCategoryMargin(0.0);

    ValueAxis valueAxis = new NumberAxis(valueAxisLabel);

    AreaRenderer renderer = new AreaRenderer();
    if (tooltips) {
        renderer.setBaseToolTipGenerator(new StandardCategoryToolTipGenerator());
    }
    if (urls) {
        renderer.setBaseItemURLGenerator(new StandardCategoryURLGenerator());
    }

    CategoryPlot plot = new CategoryPlot(dataset, categoryAxis, valueAxis, renderer);
    plot.setOrientation(orientation);
    JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT, plot, legend);

    return chart;

}

From source file:edu.dlnu.liuwenpeng.ChartFactory.ChartFactory.java

/**    
 * Creates a waterfall chart.  The chart object returned by this method     
 * uses a {@link CategoryPlot} instance as the plot, with a     
 * {@link CategoryAxis} for the domain axis, a {@link NumberAxis} as the    
 * range axis, and a {@link WaterfallBarRenderer} as the renderer.    
 *    /*from  www  .  j av a 2s . c om*/
 * @param title  the chart title (<code>null</code> permitted).    
 * @param categoryAxisLabel  the label for the category axis     
 *                           (<code>null</code> permitted).    
 * @param valueAxisLabel  the label for the value axis (<code>null</code>     
 *                        permitted).    
 * @param dataset  the dataset for the chart (<code>null</code> permitted).    
 * @param orientation  the plot orientation (horizontal or vertical)     
 *                     (<code>null</code> NOT permitted).    
 * @param legend  a flag specifying whether or not a legend is required.    
 * @param tooltips  configure chart to generate tool tips?    
 * @param urls  configure chart to generate URLs?    
 *    
 * @return A waterfall chart.    
 */
public static JFreeChart createWaterfallChart(String title, String categoryAxisLabel, String valueAxisLabel,
        CategoryDataset dataset, PlotOrientation orientation, boolean legend, boolean tooltips, boolean urls) {

    if (orientation == null) {
        throw new IllegalArgumentException("Null 'orientation' argument.");
    }
    CategoryAxis categoryAxis = new CategoryAxis(categoryAxisLabel);
    categoryAxis.setCategoryMargin(0.0);

    ValueAxis valueAxis = new NumberAxis(valueAxisLabel);

    WaterfallBarRenderer renderer = new WaterfallBarRenderer();
    if (orientation == PlotOrientation.HORIZONTAL) {
        ItemLabelPosition position = new ItemLabelPosition(ItemLabelAnchor.CENTER, TextAnchor.CENTER,
                TextAnchor.CENTER, Math.PI / 2.0);
        renderer.setBasePositiveItemLabelPosition(position);
        renderer.setBaseNegativeItemLabelPosition(position);
    } else if (orientation == PlotOrientation.VERTICAL) {
        ItemLabelPosition position = new ItemLabelPosition(ItemLabelAnchor.CENTER, TextAnchor.CENTER,
                TextAnchor.CENTER, 0.0);
        renderer.setBasePositiveItemLabelPosition(position);
        renderer.setBaseNegativeItemLabelPosition(position);
    }
    if (tooltips) {
        StandardCategoryToolTipGenerator generator = new StandardCategoryToolTipGenerator();
        renderer.setBaseToolTipGenerator(generator);
    }
    if (urls) {
        renderer.setBaseItemURLGenerator(new StandardCategoryURLGenerator());
    }

    CategoryPlot plot = new CategoryPlot(dataset, categoryAxis, valueAxis, renderer);
    plot.clearRangeMarkers();
    Marker baseline = new ValueMarker(0.0);
    baseline.setPaint(Color.black);
    plot.addRangeMarker(baseline, Layer.FOREGROUND);
    plot.setOrientation(orientation);
    JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT, plot, legend);

    return chart;

}