com.github.mikephil.charting.utils.Utils.getDecimals()方法的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(2.8k)|赞(0)|评价(0)|浏览(74)

本文整理了Java中com.github.mikephil.charting.utils.Utils.getDecimals()方法的一些代码示例,展示了Utils.getDecimals()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Utils.getDecimals()方法的具体详情如下:
包路径:com.github.mikephil.charting.utils.Utils
类名称:Utils
方法名:getDecimals

Utils.getDecimals介绍

[英]Returns the appropriate number of decimals to be used for the provided number.
[中]返回要用于所提供数字的适当小数位数。

代码示例

代码示例来源:origin: PhilJay/MPAndroidChart

/**
 * Calculates the required number of digits for the values that might be
 * drawn in the chart (if enabled), and creates the default-value-formatter
 */
protected void setupDefaultFormatter(float min, float max) {
  float reference = 0f;
  if (mData == null || mData.getEntryCount() < 2) {
    reference = Math.max(Math.abs(min), Math.abs(max));
  } else {
    reference = Math.abs(max - min);
  }
  int digits = Utils.getDecimals(reference);
  // setup the formatter with a new number of digits
  mDefaultValueFormatter.setup(digits);
}

代码示例来源:origin: WallaceXiao/StockChart-MPAndroidChart

/**
 * Calculates the required number of digits for the values that might be
 * drawn in the chart (if enabled), and creates the default-value-formatter
 */
protected void setupDefaultFormatter(float min, float max) {
  float reference = 0f;
  if (mData == null || mData.getEntryCount() < 2) {
    reference = Math.max(Math.abs(min), Math.abs(max));
  } else {
    reference = Math.abs(max - min);
  }
  int digits = Utils.getDecimals(reference);
  // setup the formatter with a new number of digits
  mDefaultValueFormatter.setup(digits);
}

代码示例来源:origin: com.github.PhilJay/MPAndroidChart

/**
 * Calculates the required number of digits for the values that might be
 * drawn in the chart (if enabled), and creates the default-value-formatter
 */
protected void setupDefaultFormatter(float min, float max) {
  float reference = 0f;
  if (mData == null || mData.getEntryCount() < 2) {
    reference = Math.max(Math.abs(min), Math.abs(max));
  } else {
    reference = Math.abs(max - min);
  }
  int digits = Utils.getDecimals(reference);
  // setup the formatter with a new number of digits
  mDefaultValueFormatter.setup(digits);
}

代码示例来源:origin: xiaolongonly/Ticket-Analysis

/**
 * Calculates the required number of digits for the values that might be
 * drawn in the chart (if enabled), and creates the default-value-formatter
 */
protected void setupDefaultFormatter(float min, float max) {
  float reference = 0f;
  if (mData == null || mData.getEntryCount() < 2) {
    reference = Math.max(Math.abs(min), Math.abs(max));
  } else {
    reference = Math.abs(max - min);
  }
  int digits = Utils.getDecimals(reference);
  // setup the formatter with a new number of digits
  mDefaultValueFormatter.setup(digits);
}

代码示例来源:origin: WenWangAndroid/ChartManager

/**
 * Calculates the required number of digits for the values that might be
 * drawn in the chart (if enabled), and creates the default-value-formatter
 */
protected void setupDefaultFormatter(float min, float max) {
  float reference = 0f;
  if (mData == null || mData.getEntryCount() < 2) {
    reference = Math.max(Math.abs(min), Math.abs(max));
  } else {
    reference = Math.abs(max - min);
  }
  int digits = Utils.getDecimals(reference);
  // setup the formatter with a new number of digits
  mDefaultValueFormatter.setup(digits);
}

相关文章