本文整理了Java中com.github.mikephil.charting.utils.Utils.formatNumber()
方法的一些代码示例,展示了Utils.formatNumber()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Utils.formatNumber()
方法的具体详情如下:
包路径:com.github.mikephil.charting.utils.Utils
类名称:Utils
方法名:formatNumber
[英]Formats the given number to the given number of decimals, and returns the number as a string, maximum 35 characters. If thousands are separated, the separating character is a dot (".").
[中]将给定的数字格式化为给定的小数位数,并以字符串形式返回该数字,最多35个字符。如果数千个字符被分隔开,则分隔字符是一个点(“.”)。
代码示例来源:origin: PhilJay/MPAndroidChart
/**
* Formats the given number to the given number of decimals, and returns the
* number as a string, maximum 35 characters. If thousands are separated, the separating
* character is a dot (".").
*
* @param number
* @param digitCount
* @param separateThousands set this to true to separate thousands values
* @return
*/
public static String formatNumber(float number, int digitCount, boolean separateThousands) {
return formatNumber(number, digitCount, separateThousands, '.');
}
代码示例来源:origin: PhilJay/MPAndroidChart
@Override
public void refreshContent(Entry e, Highlight highlight) {
if (e instanceof CandleEntry) {
CandleEntry ce = (CandleEntry) e;
tvContent.setText(Utils.formatNumber(ce.getHigh(), 0, true));
} else {
tvContent.setText(Utils.formatNumber(e.getY(), 0, true));
}
super.refreshContent(e, highlight);
}
代码示例来源:origin: PhilJay/MPAndroidChart
@Override
public void refreshContent(Entry e, Highlight highlight) {
if (e instanceof BarEntry) {
BarEntry be = (BarEntry) e;
if(be.getYVals() != null) {
// draw the stack value
tvContent.setText(Utils.formatNumber(be.getYVals()[highlight.getStackIndex()], 0, true));
} else {
tvContent.setText(Utils.formatNumber(be.getY(), 0, true));
}
} else {
tvContent.setText(Utils.formatNumber(e.getY(), 0, true));
}
super.refreshContent(e, highlight);
}
代码示例来源:origin: xiaolongonly/Ticket-Analysis
/**
* Formats the given number to the given number of decimals, and returns the
* number as a string, maximum 35 characters. If thousands are separated, the separating
* character is a dot (".").
*
* @param number
* @param digitCount
* @param separateThousands set this to true to separate thousands values
* @return
*/
public static String formatNumber(float number, int digitCount, boolean separateThousands) {
return formatNumber(number, digitCount, separateThousands, '.');
}
代码示例来源:origin: WallaceXiao/StockChart-MPAndroidChart
/**
* Formats the given number to the given number of decimals, and returns the
* number as a string, maximum 35 characters. If thousands are separated, the separating
* character is a dot (".").
*
* @param number
* @param digitCount
* @param separateThousands set this to true to separate thousands values
* @return
*/
public static String formatNumber(float number, int digitCount, boolean separateThousands) {
return formatNumber(number, digitCount, separateThousands, '.');
}
代码示例来源:origin: com.github.PhilJay/MPAndroidChart
/**
* Formats the given number to the given number of decimals, and returns the
* number as a string, maximum 35 characters. If thousands are separated, the separating
* character is a dot (".").
*
* @param number
* @param digitCount
* @param separateThousands set this to true to separate thousands values
* @return
*/
public static String formatNumber(float number, int digitCount, boolean separateThousands) {
return formatNumber(number, digitCount, separateThousands, '.');
}
代码示例来源:origin: WenWangAndroid/ChartManager
/**
* Formats the given number to the given number of decimals, and returns the
* number as a string, maximum 35 characters. If thousands are separated, the separating
* character is a dot (".").
*
* @param number
* @param digitCount
* @param separateThousands set this to true to separate thousands values
* @return
*/
public static String formatNumber(float number, int digitCount, boolean separateThousands) {
return formatNumber(number, digitCount, separateThousands, '.');
}
代码示例来源:origin: zhuanghongji/mp-android-chart
@Override
public void refreshContent(Entry e, Highlight highlight) {
if (e instanceof CandleEntry) {
CandleEntry ce = (CandleEntry) e;
tvContent.setText("" + Utils.formatNumber(ce.getHigh(), 0, true));
} else {
tvContent.setText("" + Utils.formatNumber(e.getY(), 0, true));
}
super.refreshContent(e, highlight);
}
代码示例来源:origin: tiandawu/IotXmpp
@Override
public void refreshContent(Entry e, Highlight highlight) {
if (e instanceof CandleEntry) {
CandleEntry ce = (CandleEntry) e;
tvContent.setText("" + Utils.formatNumber(ce.getHigh(), 0, true));
} else {
tvContent.setText("" + e.getVal());
}
}
代码示例来源:origin: zhuanghongji/mp-android-chart
@Override
public void refreshContent(Entry e, Highlight highlight) {
if (e instanceof BarEntry) {
BarEntry be = (BarEntry) e;
if(be.getYVals() != null) {
// draw the stack value
tvContent.setText("" + Utils.formatNumber(be.getYVals()[highlight.getStackIndex()], 0, true));
} else {
tvContent.setText("" + Utils.formatNumber(be.getY(), 0, true));
}
} else {
tvContent.setText("" + Utils.formatNumber(e.getY(), 0, true));
}
super.refreshContent(e, highlight);
}
内容来源于网络,如有侵权,请联系作者删除!