hxb
2022-11-22 b3513b1713bb979d0a69c5a8c4ddcd038f184e6e
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
package com.mm.android.deviceaddmodule.mobilecommon.widget.linechart.adapter;
 
import java.text.DecimalFormat;
 
public class DefaultValueAdapter implements IValueAdapter {
 
 
    private DecimalFormat _formatter;
    protected int _digits = 0;
 
    public DefaultValueAdapter(int digits) {
        _digits = digits;
 
        StringBuffer b = new StringBuffer();
        for (int i = 0; i < _digits; i++) {
            if (i == 0)
                b.append(".");
            b.append("0");
        }
 
        _formatter = new DecimalFormat("###,###,###,##0" + b.toString());
    }
 
    @Override
    public String value2String(double value) {
        return _formatter.format(value);
    }
 
}