Example usage for java.text NumberFormat getNumberInstance

List of usage examples for java.text NumberFormat getNumberInstance

Introduction

In this page you can find the example usage for java.text NumberFormat getNumberInstance.

Prototype

public static NumberFormat getNumberInstance(Locale inLocale) 

Source Link

Document

Returns a general-purpose number format for the specified locale.

Usage

From source file:com.nuvolect.deepdive.probe.DecompileApk.java

/**
 * Copy the specific APK to working folder.
 * Return a link to the parent folder./*w  ww . j a v  a  2 s  .  c o  m*/
 * @return
 */
public JSONObject extractApk() {

    JSONObject wrapper = new JSONObject();

    try {
        wrapper.put("extract_apk_status", 0);// 0==Start with failed file copy
        m_progressStream.putStream("Extract APK starting");

        PackageManager pm = m_ctx.getPackageManager();
        ApplicationInfo applicationInfo = pm.getApplicationInfo(m_packageName, PackageManager.GET_META_DATA);

        java.io.File inputFile = new File(applicationInfo.publicSourceDir);
        InputStream inputStream = new FileInputStream(inputFile);

        OutputStream outputStream = m_apkFile.getOutputStream();
        int bytes_copied = Util.copyFile(inputStream, outputStream);
        String formatted_count = NumberFormat.getNumberInstance(Locale.US).format(bytes_copied);

        m_progressStream.putStream("Extract APK complete, " + formatted_count + " bytes");

        wrapper.put("extract_apk_status", 1); // Change to success if we get here
        wrapper.put("extract_apk_url", m_appFolderUrl);

    } catch (PackageManager.NameNotFoundException | JSONException | IOException e) {
        LogUtil.logException(LogUtil.LogType.DECOMPILE, e);
        m_progressStream.putStream(e.toString());
        m_progressStream.putStream("Extract APK failed");
    }

    return wrapper;
}

From source file:org.lol.reddit.fragments.PostListingFragment.java

private void onSubredditReceived() {

    final String subtitle;

    if (postListingURL.getOrder() == null || postListingURL.getOrder() == PostListingController.Sort.HOT) {
        if (subreddit.subscribers == null) {
            subtitle = getString(R.string.header_subscriber_count_unknown);
        } else {/*from  w ww .jav a2  s .c  o  m*/
            subtitle = NumberFormat.getNumberInstance(Locale.getDefault()).format(subreddit.subscribers) + " "
                    + getString(R.string.header_subscriber_count);
        }

    } else {
        subtitle = postListingURL.humanReadableUrl();
    }

    getSupportActivity().runOnUiThread(new Runnable() {
        @Override
        public void run() {
            setHeader(StringEscapeUtils.unescapeHtml4(subreddit.title), subtitle);
            getSupportActivity().invalidateOptionsMenu();
        }
    });

}

From source file:it.JerseyIssueRestClientTest.java

@Test
public void testTransitionWithNumericCustomFieldPolishLocale() throws Exception {
    final double newValue = 123.45;
    final FieldInput fieldInput;
    if (IntegrationTestUtil.TESTING_JIRA_5_OR_NEWER) {
        fieldInput = new FieldInput(NUMERIC_CUSTOMFIELD_ID, Double.valueOf(newValue));
    } else {//from ww  w.  j  a  v a  2 s. co m
        fieldInput = new FieldInput(NUMERIC_CUSTOMFIELD_ID,
                NumberFormat.getNumberInstance(new Locale("pl")).format(newValue));
    }
    assertTransitionWithNumericCustomField(fieldInput, newValue);
}

From source file:it.JerseyIssueRestClientTest.java

@Test
public void testTransitionWithNumericCustomFieldEnglishLocale() throws Exception {
    setUser1();/*from  w  w  w .ja  va2 s.c  om*/
    final double newValue = 123.45;
    final FieldInput fieldInput = new FieldInput(NUMERIC_CUSTOMFIELD_ID,
            NumberFormat.getNumberInstance(new Locale("pl")).format(newValue));

    assertErrorCode(Response.Status.BAD_REQUEST,
            IntegrationTestUtil.TESTING_JIRA_5_OR_NEWER ? "Operation value must be a number"
                    : ("'" + fieldInput.getValue() + "' is an invalid number"),
            new Runnable() {
                @Override
                public void run() {
                    assertTransitionWithNumericCustomField(fieldInput, newValue);
                }
            });

    final FieldInput fieldInput2 = new FieldInput(NUMERIC_CUSTOMFIELD_ID, newValue); // this will be serialized always with "." according to JSL
    assertTransitionWithNumericCustomField(fieldInput2, newValue);

}

From source file:org.apache.storm.st.wrapper.TopoWrap.java

public String getLogs(final String componentId) throws IOException, TException, MalformedURLException {
    log.info("Fetching logs for componentId = " + componentId);
    List<ExecutorURL> exclaim2Urls = getLogUrls(componentId);
    log.info("Found " + exclaim2Urls.size() + " urls: " + exclaim2Urls.toString());
    List<String> urlContents = new ArrayList<>();
    for (ExecutorURL executorUrl : exclaim2Urls) {
        if (executorUrl == null || executorUrl.getDownloadUrl() == null) {
            continue;
        }//from ww  w  . j a  va 2s. c  o  m
        log.info("Fetching: " + executorUrl);
        URL downloadUrl = executorUrl.downloadUrl;
        String urlContent = IOUtils.toString(downloadUrl, StandardCharsets.UTF_8);
        urlContents.add(urlContent);
        if (urlContent.length() < 500) {
            log.info("Fetched: " + urlContent);
        } else {
            log.info("Fetched: " + NumberFormat.getNumberInstance(Locale.US).format(urlContent.length())
                    + " bytes.");
        }
        if (System.getProperty("regression.downloadWorkerLogs").equalsIgnoreCase("true")) {
            final String userDir = System.getProperty("user.dir");
            final File target = new File(userDir, "target");
            final File logDir = new File(target, "logs");
            final File logFile = new File(logDir,
                    downloadUrl.getHost() + "-" + downloadUrl.getFile().split("/")[2]);
            try {
                FileUtils.forceMkdir(logDir);
                FileUtils.write(logFile, urlContent, StandardCharsets.UTF_8);
            } catch (Throwable throwable) {
                log.info("Caught exception: " + ExceptionUtils.getFullStackTrace(throwable));
            }
        }
    }
    return StringUtils.join(urlContents, '\n');
}

From source file:org.dussan.vaadin.dcharts.DCharts.java

public DCharts autoSelectDecimalAndThousandsSeparator(Locale locale) {
    decimalSeparator = Character.toString(((DecimalFormat) NumberFormat.getNumberInstance(locale))
            .getDecimalFormatSymbols().getDecimalSeparator());
    thousandsSeparator = Character.toString(((DecimalFormat) NumberFormat.getNumberInstance(locale))
            .getDecimalFormatSymbols().getGroupingSeparator());
    chartData.put(DECIMAL_SEPARATOR, decimalSeparator);
    chartData.put(THOUSANDS_SEPARATOR, thousandsSeparator);
    return this;
}

From source file:org.dussan.vaadin.dcharts.DCharts.java

public DCharts autoSelectDecimalSeparator(Locale locale) {
    decimalSeparator = Character.toString(((DecimalFormat) NumberFormat.getNumberInstance(locale))
            .getDecimalFormatSymbols().getDecimalSeparator());
    chartData.put(DECIMAL_SEPARATOR, decimalSeparator);
    return this;
}

From source file:org.dussan.vaadin.dcharts.DCharts.java

public DCharts autoSelectThousandsSeparator(Locale locale) {
    thousandsSeparator = Character.toString(((DecimalFormat) NumberFormat.getNumberInstance(locale))
            .getDecimalFormatSymbols().getGroupingSeparator());
    chartData.put(THOUSANDS_SEPARATOR, thousandsSeparator);
    return this;
}

From source file:com.icloud.framework.http.heritrix.ArchiveUtils.java

private static String doubleToString(double val, int maxFractionDigits, int minFractionDigits) {
    NumberFormat f = NumberFormat.getNumberInstance(Locale.US);
    f.setMaximumFractionDigits(maxFractionDigits);
    f.setMinimumFractionDigits(minFractionDigits);
    return f.format(val);
}

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

public JFreeChart createChart(DatasetMap datasets) {
    logger.debug("IN");

    // 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/*from   w  ww .jav a  2  s .  c o m*/
            .setTickLabelFont(new Font(styleXaxesLabels.getFontName(), Font.PLAIN, styleXaxesLabels.getSize()));
    rangeAxis.setTickLabelPaint(styleXaxesLabels.getColor());
    //      rangeAxis.setLowerBound(600);
    //      rangeAxis.setUpperBound(720);
    if (firstAxisLB != null && firstAxisUB != null) {
        rangeAxis.setLowerBound(firstAxisLB);
        rangeAxis.setUpperBound(firstAxisUB);
    }

    rangeAxis.setUpperMargin(0.10);
    plot.setRangeAxis(0, rangeAxis);
    if (rangeIntegerValues == true) {
        rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    }
    rangeAxis.setNumberFormatOverride(nf);

    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());
    domainAxis.setUpperMargin(0.10);
    plot.setDomainAxis(domainAxis);

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

    DefaultCategoryDataset datasetLineFirstAxis = (DefaultCategoryDataset) datasets.getDatasets().get("1-line");
    DefaultCategoryDataset datasetBarFirstAxis = (DefaultCategoryDataset) datasets.getDatasets().get("1-bar");
    DefaultCategoryDataset datasetLineSecondAxis = (DefaultCategoryDataset) datasets.getDatasets()
            .get("2-line");
    DefaultCategoryDataset datasetBarSecondAxis = (DefaultCategoryDataset) datasets.getDatasets().get("2-bar");

    //I create one bar renderer and one line
    MyStandardCategoryItemLabelGenerator generator = null;

    // value labels and additional values are mutually exclusive
    if (showValueLabels == true)
        additionalLabels = false;

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

    if (useBars) {

        CategoryItemRenderer barRenderer = null;
        if (stackedBarRenderer_1 == true) {
            barRenderer = new StackedBarRenderer();
        } else {
            barRenderer = new BarRenderer();
        }

        CategoryItemRenderer barRenderer2 = new BarRenderer();

        if (stackedBarRenderer_2 == true) {
            barRenderer2 = new StackedBarRenderer();
        } else {
            barRenderer2 = new BarRenderer();
        }

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

        if (showValueLabels) {
            barRenderer.setBaseItemLabelGenerator(new FilterZeroStandardCategoryItemLabelGenerator());
            barRenderer.setBaseItemLabelsVisible(true);
            barRenderer.setBaseItemLabelFont(
                    new Font(styleValueLabels.getFontName(), Font.PLAIN, styleValueLabels.getSize()));
            barRenderer.setBaseItemLabelPaint(styleValueLabels.getColor());

            //            barRenderer.setBasePositiveItemLabelPosition(new ItemLabelPosition(
            //                  ItemLabelAnchor.OUTSIDE12, TextAnchor.BASELINE_LEFT));
            //
            //            barRenderer.setBaseNegativeItemLabelPosition(new ItemLabelPosition(
            //                  ItemLabelAnchor.OUTSIDE12, TextAnchor.BASELINE_LEFT));

            if (valueLabelsPosition.equalsIgnoreCase("inside")) {
                barRenderer.setBasePositiveItemLabelPosition(
                        new ItemLabelPosition(ItemLabelAnchor.CENTER, TextAnchor.BASELINE_LEFT));
                barRenderer.setBaseNegativeItemLabelPosition(
                        new ItemLabelPosition(ItemLabelAnchor.CENTER, TextAnchor.BASELINE_LEFT));
            } else {
                barRenderer.setBasePositiveItemLabelPosition(
                        new ItemLabelPosition(ItemLabelAnchor.OUTSIDE12, TextAnchor.BASELINE_LEFT));
                barRenderer.setBaseNegativeItemLabelPosition(
                        new ItemLabelPosition(ItemLabelAnchor.OUTSIDE12, TextAnchor.BASELINE_LEFT));
            }

        } else if (additionalLabels) {
            barRenderer.setToolTipGenerator(new StandardCategoryToolTipGenerator());
            barRenderer.setBaseItemLabelGenerator(generator);
            double orient = (-Math.PI / 2.0);
            if (styleValueLabels.getOrientation().equalsIgnoreCase("horizontal")) {
                orient = 0.0;
            }

            barRenderer.setBasePositiveItemLabelPosition(new ItemLabelPosition(ItemLabelAnchor.CENTER,
                    TextAnchor.CENTER, TextAnchor.CENTER, orient));
            barRenderer.setBaseNegativeItemLabelPosition(new ItemLabelPosition(ItemLabelAnchor.CENTER,
                    TextAnchor.CENTER, TextAnchor.CENTER, orient));
            barRenderer.setBaseItemLabelFont(
                    new Font(defaultLabelsStyle.getFontName(), Font.PLAIN, defaultLabelsStyle.getSize()));
            barRenderer.setBaseItemLabelPaint(defaultLabelsStyle.getColor());
            barRenderer.setBaseItemLabelsVisible(true);
        }

        if (showValueLabels) {
            barRenderer2.setBaseItemLabelGenerator(new FilterZeroStandardCategoryItemLabelGenerator());
            barRenderer2.setBaseItemLabelsVisible(true);
            barRenderer2.setBaseItemLabelFont(
                    new Font(styleValueLabels.getFontName(), Font.PLAIN, styleValueLabels.getSize()));
            barRenderer2.setBaseItemLabelPaint(styleValueLabels.getColor());

            //            barRenderer2.setBasePositiveItemLabelPosition(new ItemLabelPosition(
            //                  ItemLabelAnchor.OUTSIDE12, TextAnchor.BASELINE_LEFT));
            //
            //            barRenderer2.setBaseNegativeItemLabelPosition(new ItemLabelPosition(
            //                  ItemLabelAnchor.OUTSIDE12, TextAnchor.BASELINE_LEFT));

            if (valueLabelsPosition.equalsIgnoreCase("inside")) {
                barRenderer2.setBasePositiveItemLabelPosition(
                        new ItemLabelPosition(ItemLabelAnchor.CENTER, TextAnchor.BASELINE_LEFT));
                barRenderer2.setBaseNegativeItemLabelPosition(
                        new ItemLabelPosition(ItemLabelAnchor.CENTER, TextAnchor.BASELINE_LEFT));
            } else {
                barRenderer2.setBasePositiveItemLabelPosition(
                        new ItemLabelPosition(ItemLabelAnchor.OUTSIDE12, TextAnchor.BASELINE_LEFT));
                barRenderer2.setBaseNegativeItemLabelPosition(
                        new ItemLabelPosition(ItemLabelAnchor.OUTSIDE12, TextAnchor.BASELINE_LEFT));
            }

        } else if (additionalLabels) {
            barRenderer2.setBaseItemLabelGenerator(generator);
            double orient = (-Math.PI / 2.0);
            if (styleValueLabels.getOrientation().equalsIgnoreCase("horizontal")) {
                orient = 0.0;
            }

            barRenderer2.setBasePositiveItemLabelPosition(new ItemLabelPosition(ItemLabelAnchor.CENTER,
                    TextAnchor.CENTER, TextAnchor.CENTER, orient));
            barRenderer2.setBaseNegativeItemLabelPosition(new ItemLabelPosition(ItemLabelAnchor.CENTER,
                    TextAnchor.CENTER, TextAnchor.CENTER, orient));

            barRenderer2.setBaseItemLabelFont(
                    new Font(defaultLabelsStyle.getFontName(), Font.PLAIN, defaultLabelsStyle.getSize()));
            barRenderer2.setBaseItemLabelPaint(defaultLabelsStyle.getColor());
            barRenderer2.setBaseItemLabelsVisible(true);

        }

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

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

                Color color = (Color) colorMap.get(serName);
                if (color != null) {
                    barRenderer.setSeriesPaint(index, color);
                }
            }
            for (Iterator iterator = datasetBarSecondAxis.getRowKeys().iterator(); iterator.hasNext();) {
                idx++;
                String serName = (String) iterator.next();
                String labelName = "";
                int index = -1;

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

                Color color = (Color) colorMap.get(serName);
                if (color != null) {
                    barRenderer2.setSeriesPaint(index, color);
                    /* test con un renderer
                    if (idx > index){
                       index = idx+1;
                    }
                            
                    barRenderer.setSeriesPaint(index, color);*/
                }
            }
        }
        // add tooltip if enabled
        if (enableToolTips) {
            MyCategoryToolTipGenerator generatorToolTip = new MyCategoryToolTipGenerator(freeToolTips,
                    seriesTooltip, categoriesTooltip, seriesCaptions);
            barRenderer.setToolTipGenerator(generatorToolTip);
            barRenderer2.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
                && (!mycatUrl.getCategoryUrlLabel().equals("") || !mycatUrl.getSerieUrlLabel().equals(""))) {
            barRenderer.setItemURLGenerator(mycatUrl);
            barRenderer2.setItemURLGenerator(mycatUrl);
        }

        plot.setDataset(2, datasetBarFirstAxis);
        plot.setDataset(3, datasetBarSecondAxis);

        plot.setRenderer(2, barRenderer);
        plot.setRenderer(3, barRenderer2);

    }

    if (useLines) {

        LineAndShapeRenderer lineRenderer = new LineAndShapeRenderer();
        LineAndShapeRenderer lineRenderer2 = new LineAndShapeRenderer();

        //lineRenderer.setShapesFilled(false);
        lineRenderer.setShapesFilled(true);
        lineRenderer2.setShapesFilled(true);

        // no shapes for line_no_shapes  series
        for (Iterator iterator = lineNoShapeSeries1.iterator(); iterator.hasNext();) {
            String ser = (String) iterator.next();
            // if there iS a abel associated search for that

            String label = null;
            if (seriesLabelsMap != null) {
                label = (String) seriesLabelsMap.get(ser);
            }
            if (label == null)
                label = ser;
            int index = datasetLineFirstAxis.getRowIndex(label);
            if (index != -1) {
                lineRenderer.setSeriesShapesVisible(index, false);
            }
        }

        for (Iterator iterator = lineNoShapeSeries2.iterator(); iterator.hasNext();) {
            String ser = (String) iterator.next();
            // if there iS a abel associated search for that
            String label = null;
            if (seriesLabelsMap != null) {
                label = (String) seriesLabelsMap.get(ser);
            }
            if (label == null)
                label = ser;
            int index = datasetLineSecondAxis.getRowIndex(label);
            if (index != -1) {
                lineRenderer2.setSeriesShapesVisible(index, false);
            }
        }

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

        if (showValueLabels) {
            lineRenderer.setBaseItemLabelGenerator(new FilterZeroStandardCategoryItemLabelGenerator());
            lineRenderer.setBaseItemLabelsVisible(true);
            lineRenderer.setBaseItemLabelFont(
                    new Font(styleValueLabels.getFontName(), Font.ITALIC, styleValueLabels.getSize()));
            lineRenderer.setBaseItemLabelPaint(styleValueLabels.getColor());

            lineRenderer.setBasePositiveItemLabelPosition(
                    new ItemLabelPosition(ItemLabelAnchor.OUTSIDE12, TextAnchor.BASELINE_RIGHT));

            lineRenderer.setBaseNegativeItemLabelPosition(
                    new ItemLabelPosition(ItemLabelAnchor.OUTSIDE12, TextAnchor.BASELINE_RIGHT));

        } else if (additionalLabels) {
            lineRenderer.setBaseItemLabelGenerator(generator);
            lineRenderer.setBaseItemLabelFont(
                    new Font(defaultLabelsStyle.getFontName(), Font.PLAIN, defaultLabelsStyle.getSize()));
            lineRenderer.setBaseItemLabelPaint(defaultLabelsStyle.getColor());
            lineRenderer.setBaseItemLabelsVisible(true);
        }

        if (showValueLabels) {
            lineRenderer2.setBaseItemLabelGenerator(new FilterZeroStandardCategoryItemLabelGenerator());
            lineRenderer2.setBaseItemLabelsVisible(true);
            lineRenderer2.setBaseItemLabelFont(
                    new Font(styleValueLabels.getFontName(), Font.ITALIC, styleValueLabels.getSize()));
            lineRenderer2.setBaseItemLabelPaint(styleValueLabels.getColor());

            lineRenderer2.setBasePositiveItemLabelPosition(
                    new ItemLabelPosition(ItemLabelAnchor.OUTSIDE12, TextAnchor.BASELINE_RIGHT));

            lineRenderer2.setBaseNegativeItemLabelPosition(
                    new ItemLabelPosition(ItemLabelAnchor.OUTSIDE12, TextAnchor.BASELINE_RIGHT));

        } else if (additionalLabels) {
            lineRenderer2.setBaseItemLabelGenerator(generator);
            lineRenderer2.setBaseItemLabelFont(
                    new Font(defaultLabelsStyle.getFontName(), Font.PLAIN, defaultLabelsStyle.getSize()));
            lineRenderer2.setBaseItemLabelPaint(defaultLabelsStyle.getColor());
            lineRenderer2.setBaseItemLabelsVisible(true);
        }

        //         DefaultCategoryDataset datasetSecondAxis=(DefaultCategoryDataset)datasets.getDatasets().get("2");

        if (colorMap != null) {
            for (Iterator iterator = datasetLineSecondAxis.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 = datasetLineSecondAxis.getRowIndex(labelName);
                } else
                    index = datasetLineSecondAxis.getRowIndex(serName);

                Color color = (Color) colorMap.get(serName);
                if (color != null) {
                    lineRenderer2.setSeriesPaint(index, color);
                }
            }
            for (Iterator iterator = datasetLineFirstAxis.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 = datasetLineFirstAxis.getRowIndex(labelName);
                } else
                    index = datasetLineFirstAxis.getRowIndex(serName);

                Color color = (Color) colorMap.get(serName);
                if (color != null) {
                    lineRenderer.setSeriesPaint(index, color);
                }
            }

        }
        plot.setDataset(0, datasetLineFirstAxis);
        plot.setRenderer(0, lineRenderer);
        plot.setDataset(1, datasetLineSecondAxis);
        plot.setRenderer(1, lineRenderer2);

    }

    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);
        na.setNumberFormatOverride(nf);
        //         rangeAxis.setLowerBound(270);
        //         rangeAxis.setUpperBound(340);
        if (secondAxisLB != null && secondAxisUB != null) {
            rangeAxis.setLowerBound(secondAxisLB);
            rangeAxis.setUpperBound(secondAxisUB);
        }
        plot.setRangeAxis(1, na);
        plot.mapDatasetToRangeAxis(0, 0);
        plot.mapDatasetToRangeAxis(2, 0);
        plot.mapDatasetToRangeAxis(1, 1);
        plot.mapDatasetToRangeAxis(3, 1);
        if (rangeIntegerValues == true) {
            na.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
        }

    }

    //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);

    logger.debug("OUT");

    return chart;

}