Example usage for java.text DecimalFormat setMultiplier

List of usage examples for java.text DecimalFormat setMultiplier

Introduction

In this page you can find the example usage for java.text DecimalFormat setMultiplier.

Prototype

public void setMultiplier(int newValue) 

Source Link

Document

Sets the multiplier for use in percent, per mille, and similar formats.

Usage

From source file:Main.java

public static void main(String[] argv) throws Exception {
    DecimalFormat format = new DecimalFormat();
    format.setMultiplier(100);
    System.out.println(format.format(123456789.12345678));

}

From source file:net.sourceforge.processdash.ui.web.reports.AreaChart.java

/** Create a line chart. */
public JFreeChart createChart() {
    JFreeChart chart;//  ww w.  j a v a 2s. c o  m
    CategoryDataset catData = data.catDataSource();

    Object stacked = parameters.get("stacked");
    if (stacked != null) {
        chart = ChartFactory.createStackedAreaChart(null, null, null, catData, PlotOrientation.VERTICAL, true,
                true, false);
        if ("pct".equals(stacked)) {
            ((StackedAreaRenderer) chart.getCategoryPlot().getRenderer()).setRenderAsPercentages(true);
            DecimalFormat fmt = new DecimalFormat();
            fmt.setMultiplier(100);
            ((NumberAxis) chart.getCategoryPlot().getRangeAxis()).setNumberFormatOverride(fmt);
            if (parameters.get("units") == null)
                parameters.put("units", "%");
        }

    } else {
        chart = ChartFactory.createAreaChart(null, null, null, catData, PlotOrientation.VERTICAL, true, true,
                false);
    }

    setupCategoryChart(chart);

    Object colorScheme = parameters.get("colorScheme");
    if ("consistent".equals(colorScheme))
        configureConsistentColors(chart.getCategoryPlot(), catData);
    else if (parameters.containsKey("c1"))
        configureIndividualColors(chart.getCategoryPlot(), catData);

    return chart;
}