com.github.mikephil.charting.highlight.Highlight.getYPx()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(10.6k)|赞(0)|评价(0)|浏览(163)

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

Highlight.getYPx介绍

[英]returns the y-position of the highlight in pixels
[中]

代码示例

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

protected float getHighlightPos(Highlight h) {
  return h.getYPx();
}

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

/**
 * Returns the Highlight of the DataSet that contains the closest value on the
 * y-axis.
 *
 * @param closestValues        contains two Highlight objects per DataSet closest to the selected x-position (determined by
 *                             rounding up an down)
 * @param x
 * @param y
 * @param axis                 the closest axis
 * @param minSelectionDistance
 * @return
 */
public Highlight getClosestHighlightByPixel(List<Highlight> closestValues, float x, float y,
                      YAxis.AxisDependency axis, float minSelectionDistance) {
  Highlight closest = null;
  float distance = minSelectionDistance;
  for (int i = 0; i < closestValues.size(); i++) {
    Highlight high = closestValues.get(i);
    if (axis == null || high.getAxis() == axis) {
      float cDistance = getDistance(x, y, high.getXPx(), high.getYPx());
      if (cDistance < distance) {
        closest = high;
        distance = cDistance;
      }
    }
  }
  return closest;
}

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

/**
 * Returns the Highlight object (contains x-index and DataSet index) of the selected value at the given touch
 * point
 * inside the CombinedChart.
 *
 * @param x
 * @param y
 * @return
 */
@Override
public Highlight getHighlightByTouchPoint(float x, float y) {
  if (mData == null) {
    Log.e(LOG_TAG, "Can't select by touch. No data set.");
    return null;
  } else {
    Highlight h = getHighlighter().getHighlight(x, y);
    if (h == null || !isHighlightFullBarEnabled()) return h;
    // For isHighlightFullBarEnabled, remove stackIndex
    return new Highlight(h.getX(), h.getY(),
        h.getXPx(), h.getYPx(),
        h.getDataSetIndex(), -1, h.getAxis());
  }
}

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

/**
 * Returns the Highlight object (contains x-index and DataSet index) of the selected value at the given touch
 * point
 * inside the BarChart.
 *
 * @param x
 * @param y
 * @return
 */
@Override
public Highlight getHighlightByTouchPoint(float x, float y) {
  if (mData == null) {
    Log.e(LOG_TAG, "Can't select by touch. No data set.");
    return null;
  } else {
    Highlight h = getHighlighter().getHighlight(x, y);
    if (h == null || !isHighlightFullBarEnabled()) return h;
    // For isHighlightFullBarEnabled, remove stackIndex
    return new Highlight(h.getX(), h.getY(),
        h.getXPx(), h.getYPx(),
        h.getDataSetIndex(), -1, h.getAxis());
  }
}

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

protected float getHighlightPos(Highlight h) {
  return h.getYPx();
}

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

protected float getHighlightPos(Highlight h) {
  return h.getYPx();
}

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

protected float getHighlightPos(Highlight h) {
  return h.getYPx();
}

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

protected float getHighlightPos(Highlight h) {
  return h.getYPx();
}

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

/**
 * Returns the Highlight of the DataSet that contains the closest value on the
 * y-axis.
 *
 * @param closestValues        contains two Highlight objects per DataSet closest to the selected x-position (determined by
 *                             rounding up an down)
 * @param x
 * @param y
 * @param axis                 the closest axis
 * @param minSelectionDistance
 * @return
 */
public Highlight getClosestHighlightByPixel(List<Highlight> closestValues, float x, float y,
                      YAxis.AxisDependency axis, float minSelectionDistance) {
  Highlight closest = null;
  float distance = minSelectionDistance;
  for (int i = 0; i < closestValues.size(); i++) {
    Highlight high = closestValues.get(i);
    if (axis == null || high.getAxis() == axis) {
      float cDistance = getDistance(x, y, high.getXPx(), high.getYPx());
      if (cDistance < distance) {
        closest = high;
        distance = cDistance;
      }
    }
  }
  return closest;
}

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

/**
 * Returns the Highlight of the DataSet that contains the closest value on the
 * y-axis.
 *
 * @param closestValues        contains two Highlight objects per DataSet closest to the selected x-position (determined by
 *                             rounding up an down)
 * @param x
 * @param y
 * @param axis                 the closest axis
 * @param minSelectionDistance
 * @return
 */
public Highlight getClosestHighlightByPixel(List<Highlight> closestValues, float x, float y,
                      YAxis.AxisDependency axis, float minSelectionDistance) {
  Highlight closest = null;
  float distance = minSelectionDistance;
  for (int i = 0; i < closestValues.size(); i++) {
    Highlight high = closestValues.get(i);
    if (axis == null || high.getAxis() == axis) {
      float cDistance = getDistance(x, y, high.getXPx(), high.getYPx());
      if (cDistance < distance) {
        closest = high;
        distance = cDistance;
      }
    }
  }
  return closest;
}

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

/**
 * Returns the Highlight of the DataSet that contains the closest value on the
 * y-axis.
 *
 * @param closestValues        contains two Highlight objects per DataSet closest to the selected x-position (determined by
 *                             rounding up an down)
 * @param x
 * @param y
 * @param axis                 the closest axis
 * @param minSelectionDistance
 * @return
 */
public Highlight getClosestHighlightByPixel(List<Highlight> closestValues, float x, float y,
                      YAxis.AxisDependency axis, float minSelectionDistance) {
  Highlight closest = null;
  float distance = minSelectionDistance;
  for (int i = 0; i < closestValues.size(); i++) {
    Highlight high = closestValues.get(i);
    if (axis == null || high.getAxis() == axis) {
      float cDistance = getDistance(x, y, high.getXPx(), high.getYPx());
      if (cDistance < distance) {
        closest = high;
        distance = cDistance;
      }
    }
  }
  return closest;
}

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

/**
 * Returns the Highlight of the DataSet that contains the closest value on the
 * y-axis.
 *
 * @param closestValues        contains two Highlight objects per DataSet closest to the selected x-position (determined by
 *                             rounding up an down)
 * @param x
 * @param y
 * @param axis                 the closest axis
 * @param minSelectionDistance
 * @return
 */
public Highlight getClosestHighlightByPixel(List<Highlight> closestValues, float x, float y,
                      YAxis.AxisDependency axis, float minSelectionDistance) {
  Highlight closest = null;
  float distance = minSelectionDistance;
  for (int i = 0; i < closestValues.size(); i++) {
    Highlight high = closestValues.get(i);
    if (axis == null || high.getAxis() == axis) {
      float cDistance = getDistance(x, y, high.getXPx(), high.getYPx());
      if (cDistance < distance) {
        closest = high;
        distance = cDistance;
      }
    }
  }
  return closest;
}

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

/**
 * Returns the Highlight object (contains x-index and DataSet index) of the selected value at the given touch
 * point
 * inside the BarChart.
 *
 * @param x
 * @param y
 * @return
 */
@Override
public Highlight getHighlightByTouchPoint(float x, float y) {
  if (mData == null) {
    Log.e(LOG_TAG, "Can't select by touch. No data set.");
    return null;
  } else {
    Highlight h = getHighlighter().getHighlight(x, y);
    if (h == null || !isHighlightFullBarEnabled()) return h;
    // For isHighlightFullBarEnabled, remove stackIndex
    return new Highlight(h.getX(), h.getY(),
        h.getXPx(), h.getYPx(),
        h.getDataSetIndex(), -1, h.getAxis());
  }
}

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

/**
 * Returns the Highlight object (contains x-index and DataSet index) of the selected value at the given touch
 * point
 * inside the BarChart.
 *
 * @param x
 * @param y
 * @return
 */
@Override
public Highlight getHighlightByTouchPoint(float x, float y) {
  if (mData == null) {
    Log.e(LOG_TAG, "Can't select by touch. No data set.");
    return null;
  } else {
    Highlight h = getHighlighter().getHighlight(x, y);
    if (h == null || !isHighlightFullBarEnabled()) return h;
    // For isHighlightFullBarEnabled, remove stackIndex
    return new Highlight(h.getX(), h.getY(),
        h.getXPx(), h.getYPx(),
        h.getDataSetIndex(), -1, h.getAxis());
  }
}

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

/**
 * Returns the Highlight object (contains x-index and DataSet index) of the selected value at the given touch
 * point
 * inside the BarChart.
 *
 * @param x
 * @param y
 * @return
 */
@Override
public Highlight getHighlightByTouchPoint(float x, float y) {
  if (mData == null) {
    Log.e(LOG_TAG, "Can't select by touch. No data set.");
    return null;
  } else {
    Highlight h = getHighlighter().getHighlight(x, y);
    if (h == null || !isHighlightFullBarEnabled()) return h;
    // For isHighlightFullBarEnabled, remove stackIndex
    return new Highlight(h.getX(), h.getY(),
        h.getXPx(), h.getYPx(),
        h.getDataSetIndex(), -1, h.getAxis());
  }
}

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

/**
 * Returns the Highlight object (contains x-index and DataSet index) of the selected value at the given touch
 * point
 * inside the CombinedChart.
 *
 * @param x
 * @param y
 * @return
 */
@Override
public Highlight getHighlightByTouchPoint(float x, float y) {
  if (mData == null) {
    Log.e(LOG_TAG, "Can't select by touch. No data set.");
    return null;
  } else {
    Highlight h = getHighlighter().getHighlight(x, y);
    if (h == null || !isHighlightFullBarEnabled()) return h;
    // For isHighlightFullBarEnabled, remove stackIndex
    return new Highlight(h.getX(), h.getY(),
        h.getXPx(), h.getYPx(),
        h.getDataSetIndex(), -1, h.getAxis());
  }
}

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

/**
 * Returns the Highlight object (contains x-index and DataSet index) of the selected value at the given touch
 * point
 * inside the BarChart.
 *
 * @param x
 * @param y
 * @return
 */
@Override
public Highlight getHighlightByTouchPoint(float x, float y) {
  if (mData == null) {
    Log.e(LOG_TAG, "Can't select by touch. No data set.");
    return null;
  } else {
    Highlight h = getHighlighter().getHighlight(x, y);
    if (h == null || !isHighlightFullBarEnabled()) {
      return h;
    }
    // For isHighlightFullBarEnabled, remove stackIndex
    return new Highlight(h.getX(), h.getY(),
        h.getXPx(), h.getYPx(),
        h.getDataSetIndex(), -1, h.getAxis());
  }
}

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

/**
 * Returns the Highlight object (contains x-index and DataSet index) of the selected value at the given touch
 * point
 * inside the CombinedChart.
 *
 * @param x
 * @param y
 * @return
 */
@Override
public Highlight getHighlightByTouchPoint(float x, float y) {
  if (mData == null) {
    Log.e(LOG_TAG, "Can't select by touch. No data set.");
    return null;
  } else {
    Highlight h = getHighlighter().getHighlight(x, y);
    if (h == null || !isHighlightFullBarEnabled()) return h;
    // For isHighlightFullBarEnabled, remove stackIndex
    return new Highlight(h.getX(), h.getY(),
        h.getXPx(), h.getYPx(),
        h.getDataSetIndex(), -1, h.getAxis());
  }
}

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

/**
 * Returns the Highlight object (contains x-index and DataSet index) of the selected value at the given touch
 * point
 * inside the CombinedChart.
 *
 * @param x
 * @param y
 * @return
 */
@Override
public Highlight getHighlightByTouchPoint(float x, float y) {
  if (mData == null) {
    Log.e(LOG_TAG, "Can't select by touch. No data set.");
    return null;
  } else {
    Highlight h = getHighlighter().getHighlight(x, y);
    if (h == null || !isHighlightFullBarEnabled()) return h;
    // For isHighlightFullBarEnabled, remove stackIndex
    return new Highlight(h.getX(), h.getY(),
        h.getXPx(), h.getYPx(),
        h.getDataSetIndex(), -1, h.getAxis());
  }
}

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

/**
 * Returns the Highlight object (contains x-index and DataSet index) of the selected value at the given touch
 * point
 * inside the CombinedChart.
 *
 * @param x
 * @param y
 * @return
 */
@Override
public Highlight getHighlightByTouchPoint(float x, float y) {
  if (mData == null) {
    Log.e(LOG_TAG, "Can't select by touch. No data set.");
    return null;
  } else {
    Highlight h = getHighlighter().getHighlight(x, y);
    if (h == null || !isHighlightFullBarEnabled()) {
      return h;
    }
    // For isHighlightFullBarEnabled, remove stackIndex
    return new Highlight(h.getX(), h.getY(),
        h.getXPx(), h.getYPx(),
        h.getDataSetIndex(), -1, h.getAxis());
  }
}

相关文章