Example usage for org.jfree.chart.renderer.category CategoryItemRenderer setBasePositiveItemLabelPosition

List of usage examples for org.jfree.chart.renderer.category CategoryItemRenderer setBasePositiveItemLabelPosition

Introduction

In this page you can find the example usage for org.jfree.chart.renderer.category CategoryItemRenderer setBasePositiveItemLabelPosition.

Prototype

public void setBasePositiveItemLabelPosition(ItemLabelPosition position);

Source Link

Document

Sets the base positive item label position.

Usage

From source file:com.ouc.cpss.view.ProfitChartBuilder.java

public static JFreeChart createJFreeChart(CategoryDataset dataset) {

    JFreeChart chart = ChartFactory.createLineChart("?", "", "?",
            dataset, PlotOrientation.VERTICAL, true, true, false);
    // ?/*from   w w w  .j  a va  2s. c  o  m*/
    LegendTitle legendTitle = chart.getLegend(0);
    // 
    legendTitle.setItemFont(new Font("", Font.BOLD, 18));
    CategoryPlot plot = (CategoryPlot) chart.getPlot();
    // ?
    org.jfree.chart.axis.CategoryAxis categoryAxis = plot.getDomainAxis();
    // 
    categoryAxis.setLabelFont(new Font("", Font.BOLD, 18));

    // 
    categoryAxis.setTickLabelFont(new Font("", Font.BOLD, 12));
    // ?
    NumberAxis numberAxis = (NumberAxis) plot.getRangeAxis();
    // 
    numberAxis.setLabelFont(new Font("", Font.BOLD, 14));

    numberAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());//

    CategoryItemRenderer xylineandshaperenderer = plot.getRenderer();
    xylineandshaperenderer.setBaseItemLabelsVisible(true);
    xylineandshaperenderer.setBasePositiveItemLabelPosition(
            new ItemLabelPosition(ItemLabelAnchor.OUTSIDE2, TextAnchor.BASELINE_RIGHT));
    xylineandshaperenderer.setBaseItemLabelGenerator(new StandardCategoryItemLabelGenerator());
    return chart;
}

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

private static JFreeChart createChart(CategoryDataset categorydataset) {
    JFreeChart jfreechart = ChartFactory.createBarChart("Item Label Demo 3", "Category", "Value",
            categorydataset, PlotOrientation.VERTICAL, false, true, false);
    jfreechart.setBackgroundPaint(Color.white);
    CategoryPlot categoryplot = (CategoryPlot) jfreechart.getPlot();
    categoryplot.setBackgroundPaint(Color.lightGray);
    categoryplot.setDomainGridlinePaint(Color.white);
    categoryplot.setRangeGridlinePaint(Color.white);
    CategoryAxis categoryaxis = categoryplot.getDomainAxis();
    categoryaxis.setVisible(false);/*w w w  .java2s .  co m*/
    NumberAxis numberaxis = (NumberAxis) categoryplot.getRangeAxis();
    numberaxis.setUpperMargin(0.14999999999999999D);
    CategoryItemRenderer categoryitemrenderer = categoryplot.getRenderer();
    StandardCategoryItemLabelGenerator standardcategoryitemlabelgenerator = new StandardCategoryItemLabelGenerator(
            "{1}", NumberFormat.getInstance());
    categoryitemrenderer.setBaseItemLabelGenerator(standardcategoryitemlabelgenerator);
    categoryitemrenderer.setBaseItemLabelFont(new Font("SansSerif", 0, 12));
    categoryitemrenderer.setBaseItemLabelsVisible(true);
    categoryitemrenderer.setBasePositiveItemLabelPosition(new ItemLabelPosition(ItemLabelAnchor.CENTER,
            TextAnchor.CENTER, TextAnchor.CENTER, -1.5707963267948966D));
    return jfreechart;
}

From source file:se.backede.jeconomix.forms.report.TransactionReport.java

public void addLineChart(Map<String, List<TransactionReportDto>> reports, Boolean average) {
    JFreeChart lineChart = ChartFactory.createLineChart("TOTAL", "MONTH", "Kr",
            ReportUtils.createDataset(reports, average), PlotOrientation.VERTICAL, true, true, true);

    ChartPanel chartPanel = new ChartPanel(lineChart);
    chartPanel.setPreferredSize(new java.awt.Dimension(lineChartPanel.getWidth(), lineChartPanel.getHeight()));

    CategoryAxis axis = lineChart.getCategoryPlot().getDomainAxis();
    CategoryItemRenderer renderer = lineChart.getCategoryPlot().getRenderer();

    ItemLabelPosition position = new ItemLabelPosition(ItemLabelAnchor.OUTSIDE1, TextAnchor.HALF_ASCENT_CENTER,
            TextAnchor.BOTTOM_CENTER, 0);
    renderer.setBasePositiveItemLabelPosition(position);

    renderer.setBaseItemLabelGenerator(new CategoryItemLabelGenerator() {

        @Override/*from  ww  w . j a  v  a 2 s .co  m*/
        public String generateLabel(CategoryDataset dataset, int series, int category) {
            if (average) {
                if (series == 0) {
                    Number value = dataset.getValue(series, category);
                    String result = value.toString(); // could apply formatting here
                    return result;
                }
            } else {
                Number value = dataset.getValue(series, category);
                String result = value.toString(); // could apply formatting here
                return result;
            }
            return null;
        }

        @Override
        public String generateRowLabel(CategoryDataset cd, int i) {
            return null;
        }

        @Override
        public String generateColumnLabel(CategoryDataset cd, int i) {
            return null;
        }
    });

    renderer.setBaseItemLabelsVisible(true);
    lineChartPanel.setLayout(new BorderLayout());
    lineChartPanel.add(chartPanel, BorderLayout.NORTH);
}

From source file:sturesy.voting.gui.VotingEvaluationPanelUI.java

private JFreeChart createChart(final CategoryDataset dataset, String questiontext, Color background,
        boolean showAnswers, List<Integer> correctAnswers, boolean showPercent) {
    String valueAxisLabel = Localize.getString(showPercent ? "label.votes.percent" : "label.votes.absolute");

    final JFreeChart chart = ChartFactory.createBarChart(questiontext, Localize.getString("label.answers"),
            valueAxisLabel, dataset, PlotOrientation.VERTICAL, false, true, false);

    chart.setBackgroundPaint(background);

    final CategoryPlot plot = chart.getCategoryPlot();
    plot.setNoDataMessage("NO DATA!");

    final CategoryItemRenderer renderer = new AnswersBarRenderer(showAnswers, correctAnswers);

    renderer.setBaseItemLabelsVisible(true);
    renderer.setBaseItemLabelFont(renderer.getBaseItemLabelFont().deriveFont(16.0f));

    final ItemLabelPosition p = new ItemLabelPosition(ItemLabelAnchor.CENTER, TextAnchor.CENTER,
            TextAnchor.CENTER, 45.0);//from   www. ja  va  2s . com

    renderer.setBasePositiveItemLabelPosition(p);

    plot.setRenderer(renderer);

    // change the margin at the top of the range axis...
    final ValueAxis rangeAxis = plot.getRangeAxis();
    rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    rangeAxis.setLowerMargin(0.15);
    rangeAxis.setUpperMargin(0.15);
    double upperrange = rangeAxis.getRange().getUpperBound();

    if (showPercent) {
        renderer.setBaseItemLabelGenerator(new AppendPercentRenderer());
        rangeAxis.setRange(new Range(0, upperrange > 100 ? 100 : upperrange), false, false);
    } else {
        renderer.setBaseItemLabelGenerator(new StandardCategoryItemLabelGenerator());
    }

    plot.getDomainAxis().setMaximumCategoryLabelLines(5);
    return chart;

}

From source file:Visao.grafico.Grafico.java

public void criaGrafico() {
    CategoryDataset cds = createDataset();
    titulo = "Grfico de " + ControlePrincipal.tipo_grafico;
    String eixoy = "Valores";
    String txt_legenda = "Ledenda:";
    boolean legenda = true;
    boolean tooltips = true;
    boolean urls = true;
    graf = ChartFactory.createBarChart3D(ControlePrincipal.descricao, txt_legenda, eixoy, cds,
            PlotOrientation.VERTICAL, legenda, tooltips, urls);

    CategoryPlot plot = (CategoryPlot) graf.getPlot();
    CategoryItemRenderer renderer = plot.getRenderer();
    renderer.setBaseItemLabelGenerator(new StandardCategoryItemLabelGenerator());
    renderer.setBaseItemLabelsVisible(false);
    //ItemLabelPosition p = new ItemLabelPosition(ItemLabelAnchor.CENTER,
    //TextAnchor.CENTER, TextAnchor.CENTER, 0.0);
    //renderer.setBasePositiveItemLabelPosition(p);

    /*ItemLabelPosition p = new ItemLabelPosition(ItemLabelAnchor.INSIDE12, TextAnchor.CENTER_RIGHT, TextAnchor.CENTER_RIGHT, -Math.PI / 2.0);
    renderer.setBasePositiveItemLabelPosition(p);
    ItemLabelPosition p2 = new ItemLabelPosition(ItemLabelAnchor.OUTSIDE12, TextAnchor.CENTER_LEFT, TextAnchor.CENTER_LEFT, -Math.PI / 2.0);
    renderer.setPositiveItemLabelPosition(p2);*/

    CategoryItemRenderer line = plot.getRenderer();

    //aqui  definido o label  
    line.setBaseItemLabelGenerator(new StandardCategoryItemLabelGenerator());
    line.setBaseItemLabelsVisible(true);
    line.setBaseItemLabelPaint(Color.BLACK);
    ItemLabelPosition p = new ItemLabelPosition(ItemLabelAnchor.OUTSIDE12, TextAnchor.BOTTOM_CENTER,
            TextAnchor.CENTER, 0.0);//w  ww . ja va  2s .c  o m
    line.setBasePositiveItemLabelPosition(p);

    myChartPanel = new ChartPanel(graf, true);
    myChartPanel.setSize(jPanel1.getWidth(), jPanel1.getHeight());
    myChartPanel.setVisible(true);
    jPanel1.removeAll();
    jPanel1.add(myChartPanel);
    jPanel1.revalidate();
    jPanel1.repaint();

}

From source file:loansystem.visual.panel.StartPage.java

private void dibujarGrafico(DefaultCategoryDataset datos, int tipoGrafico, String titulo, String ejeX,
        String ejeY, PlotOrientation orientacion, JPanel contenedor) {
    JFreeChart grafica = null;/*  w  w  w.ja  va2 s . c  o  m*/

    switch (tipoGrafico) {
    case BAR:
        grafica = ChartFactory.createBarChart3D(titulo, ejeX, ejeY, datos, orientacion, true, true, false);
        break;
    case LINE:

        break;

    case PIE:

        break;
    }

    grafica.getTitle().setPaint(Color.black);

    CategoryPlot p = grafica.getCategoryPlot();
    p.setRangeGridlinePaint(Color.black);

    CategoryItemRenderer renderer = ((CategoryPlot) grafica.getPlot()).getRenderer();
    renderer.setBaseItemLabelGenerator(new StandardCategoryItemLabelGenerator());
    renderer.setBaseItemLabelsVisible(true);
    ItemLabelPosition position = new ItemLabelPosition(ItemLabelAnchor.OUTSIDE12, TextAnchor.BASELINE_CENTER);
    renderer.setBasePositiveItemLabelPosition(position);

    int style = Font.BOLD;
    Font font = new Font("Tahoma", style, 12);
    renderer.setItemLabelFont(font);

    ChartPanel panel = new ChartPanel(grafica);
    contenedor.add(panel);
    contenedor.revalidate();
    contenedor.repaint();
}

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

/**
 * Creates a sample chart.//from   www. j  a va  2s .c  o  m
 * 
 * @param dataset  the dataset.
 * 
 * @return a sample chart.
 */
protected JFreeChart createChart(CategoryDataset dataset) {

    JFreeChart chart = ChartFactory.createBarChart(chartTitle, // chart title
            domainLabel, // domain axis label
            rangeLabel, // range axis label
            dataset, // data
            PlotOrientation.VERTICAL, // the plot orientation
            !legendPanelOn, // include legend
            true, false);

    chart.setBackgroundPaint(Color.lightGray);

    // get a reference to the plot for further customisation...
    CategoryPlot plot = (CategoryPlot) chart.getPlot();
    plot.setNoDataMessage("NO DATA!");

    CategoryItemRenderer renderer = new CustomBarRenderer(new Paint[] { Color.red, Color.blue, Color.green,
            Color.yellow, Color.orange, Color.cyan, Color.magenta, Color.blue });
    renderer.setBaseItemLabelGenerator(new StandardCategoryItemLabelGenerator());
    renderer.setBaseItemLabelsVisible(true);
    ItemLabelPosition p = new ItemLabelPosition(ItemLabelAnchor.CENTER, TextAnchor.CENTER, TextAnchor.CENTER,
            45.0);
    renderer.setBasePositiveItemLabelPosition(p);
    plot.setRenderer(renderer);

    CategoryMarker marker = new CategoryMarker("Category 3");
    marker.setLabel("Special");
    marker.setPaint(new Color(0xDD, 0xFF, 0xDD, 0x80));
    marker.setAlpha(0.5f);
    marker.setLabelAnchor(RectangleAnchor.TOP_LEFT);
    marker.setLabelTextAnchor(TextAnchor.TOP_LEFT);
    marker.setLabelOffsetType(LengthAdjustmentType.CONTRACT);
    plot.addDomainMarker(marker, Layer.BACKGROUND);

    // change the margin at the top of the range axis...
    NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
    rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    rangeAxis.setLowerMargin(0.15);
    rangeAxis.setUpperMargin(0.15);

    BarRenderer seriesRenderer = (BarRenderer) plot.getRenderer();
    seriesRenderer.setLegendItemLabelGenerator(new SOCRCategorySeriesLabelGenerator());

    setCategorySummary(dataset);
    return chart;

}

From source file:net.sf.dynamicreports.design.transformation.chartcustomizer.ShowValuesCustomizer.java

@Override
public void customize(JFreeChart chart, ReportParameters reportParameters) {
    if (chart.getPlot() instanceof CategoryPlot) {
        CategoryItemRenderer renderer = chart.getCategoryPlot().getRenderer();
        if (StringUtils.isBlank(valuePattern)) {
            renderer.setBaseItemLabelGenerator(new StandardCategoryItemLabelGenerator());
        } else {/*from   w w w  . j  a v a  2 s .com*/
            renderer.setBaseItemLabelGenerator(new StandardCategoryItemLabelGenerator(
                    StandardCategoryItemLabelGenerator.DEFAULT_LABEL_FORMAT_STRING,
                    new DecimalFormat(valuePattern)));
        }
        renderer.setBaseItemLabelsVisible(Boolean.TRUE);
        chart.getCategoryPlot().getRangeAxis().zoomRange(0, 1.1);
        if (renderer.getClass().equals(BarRenderer3D.class)) {
            ((BarRenderer3D) renderer).setItemLabelAnchorOffset(10D);
            renderer.setBasePositiveItemLabelPosition(
                    new ItemLabelPosition(ItemLabelAnchor.OUTSIDE12, TextAnchor.BASELINE_LEFT));
        }
    } else if (chart.getPlot() instanceof XYPlot) {
        XYItemRenderer renderer = chart.getXYPlot().getRenderer();
        if (StringUtils.isBlank(valuePattern)) {
            renderer.setBaseItemLabelGenerator(new StandardXYItemLabelGenerator());
        } else {
            renderer.setBaseItemLabelGenerator(
                    new StandardXYItemLabelGenerator(StandardXYItemLabelGenerator.DEFAULT_ITEM_LABEL_FORMAT,
                            NumberFormat.getNumberInstance(), new DecimalFormat(valuePattern)));
        }
        renderer.setBaseItemLabelsVisible(Boolean.TRUE);
        chart.getXYPlot().getRangeAxis().zoomRange(0, 1.1);
    }
}

From source file:org.eurocarbdb.application.glycoworkbench.plugin.reporting.ProfilesComparisonReportChartCanvas.java

private void createChart() {

    // create dataset
    theDataset = createDataset();/*w w w  . j  ava2 s  .  com*/

    // create axis
    CategoryAxis categoryAxis = new CategoryAxis("");
    categoryAxis.setCategoryLabelPositions(org.jfree.chart.axis.CategoryLabelPositions.UP_45);
    ValueAxis valueAxis = new NumberAxis("Normalized Intensities");

    // create renderer
    CategoryItemRenderer renderer = null;
    if (theOptions.REPRESENTATION == theOptions.BARS)
        renderer = new org.jfree.chart.renderer.category.BarRenderer();
    else if (theOptions.REPRESENTATION == theOptions.ERRORBARS)
        renderer = new org.jfree.chart.renderer.category.StatisticalBarRenderer();
    else if (theOptions.REPRESENTATION == theOptions.DISTRIBUTIONS)
        renderer = new org.jfree.chart.renderer.category.ScatterRenderer();

    ItemLabelPosition position1 = new ItemLabelPosition(ItemLabelAnchor.OUTSIDE12, TextAnchor.BOTTOM_CENTER);
    renderer.setBasePositiveItemLabelPosition(position1);
    ItemLabelPosition position2 = new ItemLabelPosition(ItemLabelAnchor.OUTSIDE6, TextAnchor.TOP_CENTER);
    renderer.setBaseNegativeItemLabelPosition(position2);

    // create plot
    thePlot = new CategoryPlot(theDataset, categoryAxis, valueAxis, renderer);
    thePlot.setOrientation(org.jfree.chart.plot.PlotOrientation.VERTICAL);

    // add mean values 
    if (theOptions.REPRESENTATION == theOptions.DISTRIBUTIONS) {
        thePlot.setDataset(1, createMeansDataset());
        thePlot.mapDatasetToRangeAxis(1, 0);

        CategoryItemRenderer lr = new org.jfree.chart.renderer.category.LevelRenderer();
        lr.setPaint(Color.black);
        thePlot.setRenderer(1, lr);
    }

    // create chart
    theChart = new JFreeChart("", JFreeChart.DEFAULT_TITLE_FONT, thePlot, true);
    theChart.setBackgroundPaint(Color.white);
    theChart.setBorderVisible(false);

}

From source file:it.eng.spagobi.engines.chart.bo.charttypes.barcharts.OverlaidStackedBarLine.java

public JFreeChart createChart(DatasetMap datasets) {

    // create the first renderer...

    CategoryPlot plot = new CategoryPlot();
    NumberFormat nf = NumberFormat.getNumberInstance(locale);

    NumberAxis rangeAxis = new NumberAxis(getValueLabel());
    rangeAxis.setLabelFont(new Font(styleXaxesLabels.getFontName(), Font.PLAIN, styleXaxesLabels.getSize()));
    rangeAxis.setLabelPaint(styleXaxesLabels.getColor());
    rangeAxis//  ww  w. j a  v  a 2 s . c o  m
            .setTickLabelFont(new Font(styleXaxesLabels.getFontName(), Font.PLAIN, styleXaxesLabels.getSize()));
    rangeAxis.setTickLabelPaint(styleXaxesLabels.getColor());
    rangeAxis.setNumberFormatOverride(nf);
    plot.setRangeAxis(rangeAxis);
    if (rangeIntegerValues == true) {
        rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    }

    CategoryAxis domainAxis = new CategoryAxis(getCategoryLabel());
    domainAxis.setLabelFont(new Font(styleYaxesLabels.getFontName(), Font.PLAIN, styleYaxesLabels.getSize()));
    domainAxis.setLabelPaint(styleYaxesLabels.getColor());
    domainAxis
            .setTickLabelFont(new Font(styleYaxesLabels.getFontName(), Font.PLAIN, styleYaxesLabels.getSize()));
    domainAxis.setTickLabelPaint(styleYaxesLabels.getColor());
    plot.setDomainAxis(domainAxis);

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

    DefaultCategoryDataset datasetBar = (DefaultCategoryDataset) datasets.getDatasets().get("stackedbar");

    //I create one bar renderer and one line

    MyStandardCategoryItemLabelGenerator generator = null;
    if (additionalLabels) {
        generator = new MyStandardCategoryItemLabelGenerator(catSerLabels, "{1}", NumberFormat.getInstance());
    }

    if (useBars) {
        CategoryItemRenderer barRenderer = new StackedBarRenderer();

        if (maxBarWidth != null) {
            ((BarRenderer) barRenderer).setMaximumBarWidth(maxBarWidth.doubleValue());
        }

        if (additionalLabels) {
            barRenderer.setBaseItemLabelGenerator(generator);
            double orient = (-Math.PI / 2.0);
            if (styleValueLabels.getOrientation().equalsIgnoreCase("horizontal")) {
                orient = 0.0;
            }
            barRenderer.setBaseItemLabelFont(
                    new Font(styleValueLabels.getFontName(), Font.PLAIN, styleValueLabels.getSize()));
            barRenderer.setBaseItemLabelPaint(styleValueLabels.getColor());
            barRenderer.setBaseItemLabelsVisible(true);
            barRenderer.setBasePositiveItemLabelPosition(new ItemLabelPosition(ItemLabelAnchor.CENTER,
                    TextAnchor.CENTER, TextAnchor.CENTER, orient));
            barRenderer.setBaseNegativeItemLabelPosition(new ItemLabelPosition(ItemLabelAnchor.CENTER,
                    TextAnchor.CENTER, TextAnchor.CENTER, orient));

        }

        if (colorMap != null) {
            for (Iterator iterator = datasetBar.getRowKeys().iterator(); iterator.hasNext();) {
                String serName = (String) iterator.next();
                String labelName = "";
                int index = -1;
                if (seriesCaptions != null && seriesCaptions.size() > 0) {
                    labelName = serName;
                    serName = (String) seriesCaptions.get(serName);
                    index = datasetBar.getRowIndex(labelName);
                } else
                    index = datasetBar.getRowIndex(serName);

                Color color = (Color) colorMap.get(serName);
                if (color != null) {
                    barRenderer.setSeriesPaint(index, color);
                }
            }
        }
        // add tooltip if enabled
        if (enableToolTips) {
            MyCategoryToolTipGenerator generatorToolTip = new MyCategoryToolTipGenerator(freeToolTips,
                    seriesTooltip, categoriesTooltip, seriesCaptions);
            barRenderer.setToolTipGenerator(generatorToolTip);
        }

        //defines url for drill
        boolean document_composition = false;
        if (mode.equalsIgnoreCase(SpagoBIConstants.DOCUMENT_COMPOSITION))
            document_composition = true;

        logger.debug("Calling Url Generation");

        MyCategoryUrlGenerator mycatUrl = null;
        if (super.rootUrl != null) {
            logger.debug("Set MycatUrl");
            mycatUrl = new MyCategoryUrlGenerator(super.rootUrl);

            mycatUrl.setDocument_composition(document_composition);
            mycatUrl.setCategoryUrlLabel(super.categoryUrlName);
            mycatUrl.setSerieUrlLabel(super.serieUrlname);
            mycatUrl.setDrillDocTitle(drillDocTitle);
            mycatUrl.setTarget(target);
        }
        if (mycatUrl != null) {
            barRenderer.setItemURLGenerator(mycatUrl);
        }

        plot.setDataset(1, datasetBar);
        plot.setRenderer(1, barRenderer);

    }

    if (useLines) {

        LineAndShapeRenderer lineRenderer = new LineAndShapeRenderer();
        //lineRenderer.setShapesFilled(false);
        lineRenderer.setShapesFilled(true);
        if (additionalLabels) {
            lineRenderer.setBaseItemLabelGenerator(generator);
            lineRenderer.setBaseItemLabelFont(
                    new Font(defaultLabelsStyle.getFontName(), Font.PLAIN, defaultLabelsStyle.getSize()));
            lineRenderer.setBaseItemLabelPaint(defaultLabelsStyle.getColor());
            lineRenderer.setBaseItemLabelsVisible(true);
        }

        DefaultCategoryDataset datasetLine = (DefaultCategoryDataset) datasets.getDatasets().get("line");

        if (enableToolTips) {
            MyCategoryToolTipGenerator generatorToolTip = new MyCategoryToolTipGenerator(freeToolTips,
                    seriesTooltip, categoriesTooltip, seriesCaptions);
            lineRenderer.setToolTipGenerator(generatorToolTip);
        }

        if (colorMap != null) {
            for (Iterator iterator = datasetLine.getRowKeys().iterator(); iterator.hasNext();) {
                String serName = (String) iterator.next();
                String labelName = "";
                int index = -1;

                if (seriesCaptions != null && seriesCaptions.size() > 0) {
                    labelName = serName;
                    serName = (String) seriesCaptions.get(serName);
                    index = datasetLine.getRowIndex(labelName);
                } else
                    index = datasetLine.getRowIndex(serName);

                Color color = (Color) colorMap.get(serName);
                if (color != null) {
                    lineRenderer.setSeriesPaint(index, color);
                }
            }
        }
        plot.setDataset(0, datasetLine);
        plot.setRenderer(0, lineRenderer);
    }

    if (secondAxis) {
        NumberAxis na = new NumberAxis(secondAxisLabel);
        na.setLabelFont(new Font(styleXaxesLabels.getFontName(), Font.PLAIN, styleXaxesLabels.getSize()));
        na.setLabelPaint(styleXaxesLabels.getColor());
        na.setTickLabelFont(new Font(styleXaxesLabels.getFontName(), Font.PLAIN, styleXaxesLabels.getSize()));
        na.setTickLabelPaint(styleXaxesLabels.getColor());
        na.setUpperMargin(0.10);
        if (rangeIntegerValues == true) {
            na.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
        }
        na.setNumberFormatOverride(nf);
        plot.setRangeAxis(1, na);
        plot.mapDatasetToRangeAxis(0, 1);
    }

    //plot.setDatasetRenderingOrder(DatasetRenderingOrder.FORWARD);

    plot.getDomainAxis().setCategoryLabelPositions(CategoryLabelPositions.UP_45);
    JFreeChart chart = new JFreeChart(plot);
    TextTitle title = setStyleTitle(name, styleTitle);
    chart.setTitle(title);
    if (subName != null && !subName.equals("")) {
        TextTitle subTitle = setStyleTitle(subName, styleSubTitle);
        chart.addSubtitle(subTitle);
    }

    chart.setBackgroundPaint(Color.white);

    if (legend == true)
        drawLegend(chart);
    return chart;

}